The QBluetoothServiceInfo class enables access to the attributes of a Bluetooth service. 更多...
| 頭: | #include <QBluetoothServiceInfo> |
| qmake: | QT += bluetooth |
| Since: | Qt 5.2 |
| class | Alternative |
| class | Sequence |
| enum | AttributeId { ServiceRecordHandle, ServiceClassIds, ServiceRecordState, ServiceId, ..., 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 QVariant & value ) |
| void | setAttribute (quint16 attributeId , const QBluetoothUuid & value ) |
| void | setAttribute (quint16 attributeId , const QBluetoothServiceInfo::Sequence & value ) |
| void | setAttribute (quint16 attributeId , const QBluetoothServiceInfo::Alternative & value ) |
| void | setDevice (const QBluetoothDeviceInfo & device ) |
| void | setServiceAvailability (quint8 availability ) |
| void | setServiceDescription (const QString & 描述 ) |
| 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 ) |
| QSharedPointer<QBluetoothServiceInfoPrivate> | d_ptr |
The QBluetoothServiceInfo class enables access to the attributes of a Bluetooth service.
QBluetoothServiceInfo provides information about a service offered by a Bluetooth device. In addition it can be used to register new services on the local device. Note that such a registration only affects the Bluetooth SDP entries. Any server listening for incoming connections (e.g an RFCOMM server) must be started before registerService () is called. Deregistration must happen in the reverse order.
QBluetoothServiceInfo is not a value type in the traditional sense. All copies of the same service info object share the same data as they do not detach upon changing them. This ensures that two copies can (de)register the same Bluetooth service.
On iOS, this class cannot be used because the platform does not expose an API which may permit access to QBluetoothServiceInfo related features.
Bluetooth service attributes. Please check the Bluetooth Core Specification for a more detailed description of these attributes.
| 常量 | 值 | 描述 |
|---|---|---|
QBluetoothServiceInfo::ServiceRecordHandle
|
0x0000
|
Specifies a service record from which attributes can be retrieved. |
QBluetoothServiceInfo::ServiceClassIds
|
0x0001
|
UUIDs of service classes that the service conforms to. The most common service classes are defined in ( QBluetoothUuid::ServiceClassUuid ) |
QBluetoothServiceInfo::ServiceRecordState
|
0x0002
|
Attibute changes when any other service attribute is added, deleted or modified. |
QBluetoothServiceInfo::ServiceId
|
0x0003
|
UUID that uniquely identifies the service. |
QBluetoothServiceInfo::ProtocolDescriptorList
|
0x0004
|
List of protocols used by the service. The most common protocol Uuids are defined in QBluetoothUuid::ProtocolUuid |
QBluetoothServiceInfo::BrowseGroupList
|
0x0005
|
List of browse groups the service is in. |
QBluetoothServiceInfo::LanguageBaseAttributeIdList
|
0x0006
|
List of language base attribute IDs to support human-readable attributes. |
QBluetoothServiceInfo::ServiceInfoTimeToLive
|
0x0007
|
Number of seconds for which the service record is expected to remain valid and unchanged. |
QBluetoothServiceInfo::ServiceAvailability
|
0x0008
|
Value indicating the availability of the service. |
QBluetoothServiceInfo::BluetoothProfileDescriptorList
|
0x0009
|
List of profiles to which the service conforms. |
QBluetoothServiceInfo::DocumentationUrl
|
0x000A
|
URL that points to the documentation on the service.. |
QBluetoothServiceInfo::ClientExecutableUrl
|
0x000B
|
URL that refers to the location of an application that can be used to utilize the service. |
QBluetoothServiceInfo::IconUrl
|
0x000C
|
URL to the location of the icon representing the service. |
QBluetoothServiceInfo::AdditionalProtocolDescriptorList
|
0x000D
|
Additional protocols used by the service. This attribute extends
ProtocolDescriptorList
.
|
QBluetoothServiceInfo::PrimaryLanguageBase
|
0x0100
|
Base index for primary language text descriptors. |
QBluetoothServiceInfo::ServiceName
|
PrimaryLanguageBase + 0x0000
|
Name of the Bluetooth service in the primary language. |
QBluetoothServiceInfo::ServiceDescription
|
PrimaryLanguageBase + 0x0001
|
Description of the Bluetooth service in the primary language. |
QBluetoothServiceInfo::ServiceProvider
|
PrimaryLanguageBase + 0x0002
|
Name of the company / entity that provides the Bluetooth service primary language. |
注意: On Windows ServiceClassIds and ProtocolDescriptorList are automatically set to default values when a service is created. Manually setting values for these attributes will not work and might lead to unexpected results on this platform.
This enum describes the socket protocol used by the service.
| 常量 | 值 | 描述 |
|---|---|---|
QBluetoothServiceInfo::UnknownProtocol
|
0
|
The service uses an unknown socket protocol. |
QBluetoothServiceInfo::L2capProtocol
|
1
|
The service uses the L2CAP socket protocol. This protocol is not supported for direct socket connections on Android. |
QBluetoothServiceInfo::RfcommProtocol
|
2
|
The service uses the RFCOMM socket protocol. |
Construct a new invalid QBluetoothServiceInfo ;
Construct a new QBluetoothServiceInfo that is a copy of other .
The two copies continue to share the same underlying data which does not detach upon write.
銷毀 QBluetoothServiceInfo 對象。
Returns the value of the attribute attributeId .
另請參閱 setAttribute ().
返迴列錶化的所有屬性 ID QBluetoothServiceInfo 對象擁有。
返迴 true 若 QBluetoothServiceInfo 對象包含屬性 attributeId ,否則返迴 false。
Returns the address of the Bluetooth device that provides this service.
另請參閱 setDevice ().
返迴 true 若 QBluetoothServiceInfo 對象被認為是完整的,否則返迴 false。
完整 QBluetoothServiceInfo 對象包含 ProtocolDescriptorList 屬性。
Returns true if the service information is registered with the platform's Service Discovery Protocol (SDP) implementation, otherwise returns false.
返迴 true 若 QBluetoothServiceInfo object is valid, otherwise returns false.
無效 QBluetoothServiceInfo 對象將沒有屬性。
Returns the protocol parameters as a QBluetoothServiceInfo::Sequence for protocol protocol .
空 QBluetoothServiceInfo::Sequence 被返迴若 protocol 不支持。
This is a convenience function. Returns the protocol/service multiplexer for services which support the L2CAP protocol, otherwise returns -1.
This function is equivalent to extracting the information from QBluetoothServiceInfo::Sequence 返迴通過 QBluetoothServiceInfo::attribute ( QBluetoothServiceInfo::ProtocolDescriptorList ).
Registers this service with the platform's Service Discovery Protocol (SDP) implementation, making it findable by other devices when they perform service discovery. Returns true if the service is successfully registered, otherwise returns false. Once registered changes to the record cannot be made. The service must be unregistered and registered again with the changes.
The
localAdapter
parameter determines the local Bluetooth adapter under which the service should be registered. If
localAdapter
is
null
the default Bluetooth adapter will be used. If this service info object is already registered via a local adapter and this is function is called using a different local adapter, the previous registration is removed and the service reregistered using the new adapter.
移除屬性 attributeId 從 QBluetoothServiceInfo 對象。
If the service information is already registered with the platforms SDP database, the database entry will not be updated until registerService () was called again.
This is a convenience function. Returns the server channel for services which support the RFCOMM protocol, otherwise returns -1.
This function is equivalent to extracting the information from QBluetoothServiceInfo::Sequence 返迴通過 QBluetoothServiceInfo::attribute (QBluetootherServiceInfo::ProtocolDescriptorList).
這是方便函數。相當於調用 attribute( QBluetoothServiceInfo::ServiceAvailability ).toUInt().
Returns the availability of the service.
另請參閱 setServiceAvailability () 和 attribute ().
Returns a list of UUIDs describing the service classes that this service conforms to.
這是方便函數。相當於調用 attribute( QBluetoothServiceInfo::ServiceClassIds ).value< QBluetoothServiceInfo::Sequence >() and subsequently iterating over its QBluetoothUuid 條目。
另請參閱 attribute ().
這是方便函數。相當於調用 attribute( QBluetoothServiceInfo::ServiceDescription ).toString().
以首要語言返迴服務描述。
另請參閱 setServiceDescription () 和 attribute ().
這是方便函數。相當於調用 attribute( QBluetoothServiceInfo::ServiceName ).toString().
以首要語言返迴服務名稱。
另請參閱 setServiceName () 和 attribute ().
這是方便函數。相當於調用 attribute( QBluetoothServiceInfo::ServiceProvider ).toString().
以首要語言返迴服務提供者。
另請參閱 setServiceProvider () 和 attribute ().
這是方便函數。相當於調用 attribute( QBluetoothServiceInfo::ServiceId ).value< QBluetoothUuid >().
Returns the custom UUID of the service. This UUID may be null. UUIDs based on Bluetooth SIG standards should be retrieved via serviceClassUuids ().
另請參閱 setServiceUuid () 和 attribute ().
Sets the attribute identified by attributeId to value .
If the service information is already registered with the platform's SDP database, the database entry will not be updated until registerService () was called again.
注意: If an attribute expectes a byte-encoded value (e.g. Bluetooth HID services), it should be set as QByteArray .
另請參閱 attribute (), isRegistered (),和 registerService ().
這是方便函數。
Sets the attribute identified by attributeId to value .
If the service information is already registered with the platform's SDP database, the database entry will not be updated until registerService () was called again.
這是方便函數。
Sets the attribute identified by attributeId to value .
If the service information is already registered with the platform's SDP database, the database entry will not be updated until registerService () was called again.
這是方便函數。
Sets the attribute identified by attributeId to value .
If the service information is already registered with the platform's SDP database, the database entry will not be updated until registerService () was called again.
Sets the Bluetooth device that provides this service to device .
另請參閱 device ().
這是方便函數。相當於調用 setAttribute ( QBluetoothServiceInfo::ServiceAvailability , availability).
Sets the availabiltiy of the service to availability .
另請參閱 serviceAvailability () 和 setAttribute ().
這是方便函數。相當於調用 setAttribute ( QBluetoothServiceInfo::ServiceDescription , description).
Sets the service description in the primary language to 描述 .
另請參閱 serviceDescription () 和 setAttribute ().
這是方便函數。相當於調用 setAttribute ( QBluetoothServiceInfo::ServiceName , name).
Sets the service name in the primary language to name .
另請參閱 serviceName () 和 setAttribute ().
這是方便函數。相當於調用 setAttribute ( QBluetoothServiceInfo::ServiceProvider , provider).
Sets the service provider in the primary language to provider .
另請參閱 serviceProvider () 和 setAttribute ().
這是方便函數。相當於調用 setAttribute ( QBluetoothServiceInfo::ServiceId , uuid).
Sets the custom service UUID to uuid . This function should not be used to set a standardized service UUID.
另請參閱 serviceUuid () 和 setAttribute ().
Returns the protocol that the QBluetoothServiceInfo object uses.
Unregisters this service with the platform's Service Discovery Protocol (SDP) implementation. After this, the service will no longer be findable by other devices through service discovery.
Returns true if the service is successfully unregistered, otherwise returns false.
Makes a copy of the other 並將其賦值給此 QBluetoothServiceInfo object. The two copies continue to share the same service and registration details.