QBluetoothServiceInfo Class
QBluetoothServiceInfo 클래스는 블루투스 서비스의 속성에 액세스할 수 있게 해줍니다. 더 보기...
Header: | #include <QBluetoothServiceInfo> |
qmake: | QT += bluetooth |
공용 유형
class | Alternative |
class | Sequence |
enum | AttributeId { ServiceRecordHandle, ServiceClassIds, ServiceRecordState, ServiceId, ProtocolDescriptorList, …, ServiceProvider } |
enum | Protocol { UnknownProtocol, L2capProtocol, RfcommProtocol } |
공용 함수
QBluetoothServiceInfo() | |
QBluetoothServiceInfo(const QBluetoothServiceInfo &other) | |
~QBluetoothServiceInfo() | |
QVariant | attribute(quint16 attributeId) const |
QList<quint16> | attributes() const |
bool | contains(quint16 attributeId) const |
QBluetoothDeviceInfo | device() const |
bool | isComplete() const |
bool | isRegistered() const |
bool | isValid() const |
QBluetoothServiceInfo::Sequence | protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const |
int | protocolServiceMultiplexer() const |
bool | registerService(const QBluetoothAddress &localAdapter = QBluetoothAddress()) |
void | removeAttribute(quint16 attributeId) |
int | serverChannel() const |
quint8 | serviceAvailability() const |
QList<QBluetoothUuid> | serviceClassUuids() const |
QString | serviceDescription() const |
QString | serviceName() const |
QString | serviceProvider() const |
QBluetoothUuid | serviceUuid() const |
void | setAttribute(quint16 attributeId, const QBluetoothServiceInfo::Alternative &value) |
void | setAttribute(quint16 attributeId, const QBluetoothServiceInfo::Sequence &value) |
void | setAttribute(quint16 attributeId, const QBluetoothUuid &value) |
void | setAttribute(quint16 attributeId, const QVariant &value) |
void | setDevice(const QBluetoothDeviceInfo &device) |
void | setServiceAvailability(quint8 availability) |
void | setServiceDescription(const QString &description) |
void | setServiceName(const QString &name) |
void | setServiceProvider(const QString &provider) |
void | setServiceUuid(const QBluetoothUuid &uuid) |
QBluetoothServiceInfo::Protocol | socketProtocol() const |
bool | unregisterService() |
QBluetoothServiceInfo & | operator=(const QBluetoothServiceInfo &other) |
상세 설명
QBluetoothServiceInfo는 블루투스 장치에서 제공하는 서비스에 대한 정보를 제공합니다. 또한 로컬 장치에 새 서비스를 등록하는 데 사용할 수 있습니다. 이러한 등록은 블루투스 SDP 항목에만 영향을 줍니다. 수신 연결을 수신 대기 중인 모든 서버(예: RFCOMM 서버)는 registerService()가 호출되기 전에 시작되어야 합니다. 등록 해제는 역순으로 진행해야 합니다.
QBluetoothServiceInfo는 전통적인 의미의 값 유형이 아닙니다. 동일한 서비스 정보 객체의 모든 복사본은 변경 시 분리되지 않으므로 동일한 데이터를 공유합니다. 따라서 두 개의 복사본이 동일한 블루투스 서비스를 (비)등록할 수 있습니다.
iOS에서는 이 클래스를 사용할 수 없는데, 플랫폼이 QBluetoothServiceInfo 관련 기능에 액세스할 수 있는 API를 노출하지 않기 때문입니다.
멤버 유형 문서
enum QBluetoothServiceInfo::AttributeId
블루투스 서비스 속성. 이러한 속성에 대한 자세한 설명은 Bluetooth 핵심 사양을 참조하세요.
상수 | 값 | 설명 |
---|---|---|
QBluetoothServiceInfo::ServiceRecordHandle | 0x0000 | 속성을 검색할 수 있는 서비스 레코드를 지정합니다. |
QBluetoothServiceInfo::ServiceClassIds | 0x0001 | 서비스가 준수하는 서비스 클래스의 UUID입니다. 가장 일반적인 서비스 클래스는 (QBluetoothUuid::ServiceClassUuid)에 정의되어 있습니다. |
QBluetoothServiceInfo::ServiceRecordState | 0x0002 | 다른 서비스 속성이 추가, 삭제 또는 수정되면 속성이 변경됩니다. |
QBluetoothServiceInfo::ServiceId | 0x0003 | 서비스를 고유하게 식별하는 UUID. |
QBluetoothServiceInfo::ProtocolDescriptorList | 0x0004 | 서비스에서 사용하는 프로토콜 목록입니다. 가장 일반적인 프로토콜 UUID는 다음에 정의됩니다. QBluetoothUuid::ProtocolUuid |
QBluetoothServiceInfo::BrowseGroupList | 0x0005 | 서비스가 속해 있는 찾아보기 그룹 목록입니다. |
QBluetoothServiceInfo::LanguageBaseAttributeIdList | 0x0006 | 사람이 읽을 수 있는 속성을 지원하기 위한 언어 기반 속성 ID 목록입니다. |
QBluetoothServiceInfo::ServiceInfoTimeToLive | 0x0007 | 서비스 레코드가 유효하고 변경되지 않은 상태로 유지될 것으로 예상되는 시간(초)입니다. |
QBluetoothServiceInfo::ServiceAvailability | 0x0008 | 서비스의 가용성을 나타내는 값입니다. |
QBluetoothServiceInfo::BluetoothProfileDescriptorList | 0x0009 | 서비스가 준수하는 프로필 목록입니다. |
QBluetoothServiceInfo::DocumentationUrl | 0x000A | 서비스에 대한 설명서를 가리키는 URL. |
QBluetoothServiceInfo::ClientExecutableUrl | 0x000B | 서비스를 활용하는 데 사용할 수 있는 애플리케이션의 위치를 가리키는 URL입니다. |
QBluetoothServiceInfo::IconUrl | 0x000C | 서비스를 나타내는 아이콘의 위치로 연결되는 URL. |
QBluetoothServiceInfo::AdditionalProtocolDescriptorList | 0x000D | 서비스에서 사용하는 추가 프로토콜. 이 속성은 ProtocolDescriptorList 을 확장합니다. |
QBluetoothServiceInfo::PrimaryLanguageBase | 0x0100 | 기본 언어 텍스트 설명자의 기본 색인입니다. |
QBluetoothServiceInfo::ServiceName | PrimaryLanguageBase + 0x0000 | 기본 언어로 된 Bluetooth 서비스의 이름입니다. |
QBluetoothServiceInfo::ServiceDescription | PrimaryLanguageBase + 0x0001 | 기본 언어로 된 블루투스 서비스에 대한 설명입니다. |
QBluetoothServiceInfo::ServiceProvider | PrimaryLanguageBase + 0x0002 | Bluetooth 서비스 기본 언어를 제공하는 회사/단체의 이름입니다. |
참고: Windows에서는 서비스가 만들어질 때 ServiceClassIds 및 ProtocolDescriptorList가 자동으로 기본값으로 설정됩니다. 이러한 속성의 값을 수동으로 설정하면 작동하지 않으며 이 플랫폼에서 예기치 않은 결과가 발생할 수 있습니다.
enum QBluetoothServiceInfo::Protocol
이 열거형은 서비스에서 사용하는 소켓 프로토콜을 설명합니다.
Constant | 값 | 설명 |
---|---|---|
QBluetoothServiceInfo::UnknownProtocol | 0 | 서비스가 알 수 없는 소켓 프로토콜을 사용합니다. |
QBluetoothServiceInfo::L2capProtocol | 1 | 서비스가 L2CAP 소켓 프로토콜을 사용합니다. 이 프로토콜은 Android의 직접 소켓 연결에는 지원되지 않습니다. |
QBluetoothServiceInfo::RfcommProtocol | 2 | 서비스가 RFCOMM 소켓 프로토콜을 사용합니다. |
멤버 함수 문서
QBluetoothServiceInfo::QBluetoothServiceInfo()
유효하지 않은 새 QBluetoothServiceInfo를 생성합니다;
QBluetoothServiceInfo::QBluetoothServiceInfo(const QBluetoothServiceInfo &other)
other 의 복사본인 새 QBluetoothServiceInfo 를 생성합니다.
두 복사본은 쓰기 시 분리되지 않는 동일한 기본 데이터를 계속 공유합니다.
[noexcept]
QBluetoothServiceInfo::~QBluetoothServiceInfo()
QBluetoothServiceInfo 객체를 삭제합니다.
QVariant QBluetoothServiceInfo::attribute(quint16 attributeId) const
attributeId 속성의 값을 반환합니다.
setAttribute()도 참조하세요 .
QList<quint16> QBluetoothServiceInfo::attributes() const
QBluetoothServiceInfo 객체가 가지고 있는 모든 속성 ID 목록을 반환합니다.
bool QBluetoothServiceInfo::contains(quint16 attributeId) const
QBluetoothServiceInfo 객체에 attributeId 속성이 포함되어 있으면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.
QBluetoothDeviceInfo QBluetoothServiceInfo::device() const
이 서비스를 제공하는 블루투스 장치의 주소를 반환합니다.
setDevice()도 참조하세요 .
bool QBluetoothServiceInfo::isComplete() const
QBluetoothServiceInfo 객체가 완료된 것으로 간주되면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.
완전한 QBluetoothServiceInfo 객체에는 ProtocolDescriptorList 어트리뷰트가 포함됩니다.
bool QBluetoothServiceInfo::isRegistered() const
서비스 정보가 플랫폼의 서비스 검색 프로토콜(SDP) 구현에 등록되어 있으면 true를 반환하고, 그렇지 않으면 false를 반환합니다.
bool QBluetoothServiceInfo::isValid() const
QBluetoothServiceInfo 객체가 유효하면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.
유효하지 않은 QBluetoothServiceInfo 객체에는 어트리뷰트가 없습니다.
QBluetoothServiceInfo::Sequence QBluetoothServiceInfo::protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const
프로토콜 파라미터를 프로토콜 protocol 에 대해 QBluetoothServiceInfo::Sequence 로 반환합니다.
protocol 이 지원되지 않는 경우 빈 QBluetoothServiceInfo::Sequence 이 반환됩니다.
int QBluetoothServiceInfo::protocolServiceMultiplexer() const
이 함수는 편의성 함수입니다. L2CAP 프로토콜을 지원하는 서비스의 경우 프로토콜/서비스 멀티플렉서를 반환하고, 그렇지 않으면 -1을 반환합니다.
이 함수는 QBluetoothServiceInfo::attribute(QBluetoothServiceInfo::ProtocolDescriptorList)에서 반환한 QBluetoothServiceInfo::Sequence 에서 정보를 추출하는 것과 같습니다.
bool QBluetoothServiceInfo::registerService(const QBluetoothAddress &localAdapter = QBluetoothAddress())
이 서비스를 플랫폼의 서비스 검색 프로토콜(SDP) 구현에 등록하여 다른 디바이스가 서비스 검색을 수행할 때 찾을 수 있도록 합니다. 서비스가 성공적으로 등록되면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다. 일단 등록된 레코드는 변경할 수 없습니다. 서비스를 등록 취소한 후 변경 사항을 적용하여 다시 등록해야 합니다.
localAdapter 매개 변수는 서비스를 등록할 로컬 Bluetooth 어댑터를 결정합니다. localAdapter 가 null
인 경우 기본 블루투스 어댑터가 사용됩니다. 이 서비스 정보 개체가 로컬 어댑터를 통해 이미 등록되어 있고 다른 로컬 어댑터를 사용하여 이 함수를 호출하는 경우 이전 등록이 제거되고 새 어댑터를 사용하여 서비스가 다시 등록됩니다.
void QBluetoothServiceInfo::removeAttribute(quint16 attributeId)
QBluetoothServiceInfo 객체에서 attributeId 속성을 제거합니다.
서비스 정보가 이미 플랫폼 SDP 데이터베이스에 등록된 경우 registerService()를 다시 호출할 때까지 데이터베이스 항목이 업데이트되지 않습니다.
int QBluetoothServiceInfo::serverChannel() const
이 함수는 편의성 함수입니다. RFCOMM 프로토콜을 지원하는 서비스에 대한 서버 채널을 반환하고, 그렇지 않으면 -1을 반환합니다.
이 함수는 QBluetoothServiceInfo::attribute(QBluetootherServiceInfo::ProtocolDescriptorList)에서 반환한 QBluetoothServiceInfo::Sequence 에서 정보를 추출하는 것과 동일합니다.
quint8 QBluetoothServiceInfo::serviceAvailability() const
이것은 편의용 함수입니다. attribute(QBluetoothServiceInfo::ServiceAvailability).toUInt()를 호출하는 것과 동일합니다.
서비스의 가용성을 반환합니다.
setServiceAvailability() 및 attribute()도 참조하세요 .
QList<QBluetoothUuid> QBluetoothServiceInfo::serviceClassUuids() const
이 서비스가 준수하는 서비스 클래스를 설명하는 UUID 목록을 반환합니다.
이것은 편의용 함수입니다. 이는 attribute(QBluetoothServiceInfo::ServiceClassIds).value<QBluetoothServiceInfo::Sequence>()를 호출한 다음 QBluetoothUuid 항목을 반복하는 것과 동일합니다.
attribute()도 참조하세요 .
QString QBluetoothServiceInfo::serviceDescription() const
이것은 편의용 함수입니다. attribute(QBluetoothServiceInfo::ServiceDescription).toString()을 호출하는 것과 동일합니다.
기본 언어로 된 서비스 설명을 반환합니다.
setServiceDescription() 및 attribute()도 참조하세요 .
QString QBluetoothServiceInfo::serviceName() const
이것은 편의용 함수입니다. attribute(QBluetoothServiceInfo::ServiceName).toString()을 호출하는 것과 동일합니다.
기본 언어로 된 서비스 이름을 반환합니다.
setServiceName() 및 attribute()도 참조하세요 .
QString QBluetoothServiceInfo::serviceProvider() const
이것은 편의용 함수입니다. attribute(QBluetoothServiceInfo::ServiceProvider).toString()을 호출하는 것과 동일합니다.
기본 언어로 된 서비스 제공업체를 반환합니다.
setServiceProvider() 및 attribute()도 참조하세요 .
QBluetoothUuid QBluetoothServiceInfo::serviceUuid() const
이것은 편의용 함수입니다. attribute(QBluetoothServiceInfo::ServiceId).value<QBluetoothUuid>()를 호출하는 것과 동일합니다.
서비스의 사용자 정의 UUID를 반환합니다. 이 UUID는 null일 수 있습니다. Bluetooth SIG 표준에 기반한 UUID는 serviceClassUuids()를 통해 검색해야 합니다.
setServiceUuid() 및 attribute()도 참조하세요 .
void QBluetoothServiceInfo::setAttribute(quint16 attributeId, const QBluetoothServiceInfo::Alternative &value)
이것은 편의 기능입니다.
attributeId 으로 식별되는 속성을 value 으로 설정합니다.
서비스 정보가 플랫폼의 SDP 데이터베이스에 이미 등록된 경우 registerService()를 다시 호출할 때까지 데이터베이스 항목이 업데이트되지 않습니다.
attribute()도 참조하세요 .
void QBluetoothServiceInfo::setAttribute(quint16 attributeId, const QBluetoothServiceInfo::Sequence &value)
이것은 편의 기능입니다.
attributeId 으로 식별되는 속성을 value 으로 설정합니다.
서비스 정보가 이미 플랫폼의 SDP 데이터베이스에 등록된 경우 registerService()를 다시 호출할 때까지 데이터베이스 항목이 업데이트되지 않습니다.
void QBluetoothServiceInfo::setAttribute(quint16 attributeId, const QBluetoothUuid &value)
이것은 편의 기능입니다.
attributeId 으로 식별되는 속성을 value 으로 설정합니다.
서비스 정보가 이미 플랫폼의 SDP 데이터베이스에 등록된 경우 registerService()를 다시 호출할 때까지 데이터베이스 항목이 업데이트되지 않습니다.
void QBluetoothServiceInfo::setAttribute(quint16 attributeId, const QVariant &value)
attributeId 으로 식별되는 속성을 value 으로 설정합니다.
서비스 정보가 플랫폼의 SDP 데이터베이스에 이미 등록된 경우 registerService()를 다시 호출할 때까지 데이터베이스 항목이 업데이트되지 않습니다.
참고: 속성이 바이트 인코딩된 값을 기대하는 경우(예: Bluetooth HID 서비스) QByteArray 로 설정해야 합니다.
isRegistered() 및 registerService()도 참조하세요 .
void QBluetoothServiceInfo::setDevice(const QBluetoothDeviceInfo &device)
이 서비스를 제공하는 블루투스 장치를 device 로 설정합니다.
device()도 참조하세요 .
void QBluetoothServiceInfo::setServiceAvailability(quint8 availability)
이것은 편의 기능입니다. setAttribute (QBluetoothServiceInfo::ServiceAvailability, 가용성)을 호출하는 것과 동일합니다.
서비스 가용성을 availability 로 설정합니다.
serviceAvailability() 및 setAttribute()도 참조하세요 .
void QBluetoothServiceInfo::setServiceDescription(const QString &description)
이것은 편의 기능입니다. setAttribute (QBluetoothServiceInfo::ServiceDescription, 설명)을 호출하는 것과 동일합니다.
기본 언어의 서비스 설명을 description 로 설정합니다.
serviceDescription() 및 setAttribute()도 참조하세요 .
void QBluetoothServiceInfo::setServiceName(const QString &name)
이것은 편의 기능입니다. setAttribute (QBluetoothServiceInfo::ServiceName, 이름)을 호출하는 것과 동일합니다.
기본 언어의 서비스 이름을 name 로 설정합니다.
serviceName() 및 setAttribute()도 참조하세요 .
void QBluetoothServiceInfo::setServiceProvider(const QString &provider)
이것은 편의 기능입니다. setAttribute (QBluetoothServiceInfo::ServiceProvider, 공급자)를 호출하는 것과 동일합니다.
기본 언어의 서비스 제공업체를 provider 로 설정합니다.
serviceProvider() 및 setAttribute()도 참조하세요 .
void QBluetoothServiceInfo::setServiceUuid(const QBluetoothUuid &uuid)
이것은 편의 기능입니다. setAttribute (QBluetoothServiceInfo::ServiceId, uuid)를 호출하는 것과 동일합니다.
사용자 지정 서비스 UUID를 uuid 로 설정합니다. 이 함수는 표준화된 서비스 UUID를 설정하는 데 사용해서는 안 됩니다.
serviceUuid() 및 setAttribute()도 참조하세요 .
QBluetoothServiceInfo::Protocol QBluetoothServiceInfo::socketProtocol() const
QBluetoothServiceInfo 객체가 사용하는 프로토콜을 반환합니다.
bool QBluetoothServiceInfo::unregisterService()
플랫폼의 서비스 검색 프로토콜(SDP) 구현에서 이 서비스의 등록을 취소합니다. 이 후에는 다른 디바이스에서 서비스 검색을 통해 서비스를 더 이상 찾을 수 없습니다.
서비스가 성공적으로 등록 취소되면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.
QBluetoothServiceInfo &QBluetoothServiceInfo::operator=(const QBluetoothServiceInfo &other)
other 복사본을 만들어 이 QBluetoothServiceInfo 개체에 할당합니다. 두 복사본은 계속해서 동일한 서비스 및 등록 세부 정보를 공유합니다.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.