Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QBluetoothSdpRecord Class Reference
[QtBluetoothModule]

The QBluetoothSdpRecord class represents a bluetooth SDP record. More...

    #include <QBluetoothSdpRecord>

Public Functions

Static Public Members


Detailed Description

The QBluetoothSdpRecord class represents a bluetooth SDP record.

Each Bluetooth record is composed of zero or more attributes. Each attribute contains exactly one value. To group several values, sequences or alternatives are used. Each attribute has a unique 16 bit identifier associated with it. The mapping between SDP basic types and the types used by the QBluetoothSdpRecord implementation are given below:

SDP TypeQt Type
UINT8quint8
INT8qint8
UINT16quint16
INT16qint16
UINT32quint32
INT32qint32
UINT64quint64
INT64qint64
UINT128quint128
INT128qint128
BOOLbool
AlternateQBluetoothSdpAlternative
SequenceQBluetoothSdpSequence
UUID16, UUID32, UUID128QBluetoothSdpUuid
URLQUrl
TEXTQString
TEXT (binary data)QByteArray

The attributes are stored as QVariants.

For example, the following code retrieves the value of the ServiceClassIDList attribute:

    QBluetoothSdpRecord record = ...
    quint16 UUID_SERVICE_CLASS_ID_LIST = 0x0001;     // as defined in Bluetooth specification
    QBluetoothSdpSequence serviceClassIdList = record.attribute(UUID_SERVICE_CLASS_ID_LIST).value<QBluetoothSdpSequence>();
    for (int i=0; i<serviceClassIdList.count(); i++)
         qDebug() << "Service class ID:" << serviceClassIdList[i];

Typically a QBluetoothSdpRecord is populated by:

See also QVariant, QBluetoothSdpSequence, and QBluetoothSdpAlternative.


Member Function Documentation

QBluetoothSdpRecord::QBluetoothSdpRecord ()

Construct a new empty SDP Service record.

QBluetoothSdpRecord::QBluetoothSdpRecord ( const QBluetoothSdpRecord & other )

Construct a SDP service record, copying contents from other.

QBluetoothSdpRecord::~QBluetoothSdpRecord ()

Deconstruct a SDP Service record.

bool QBluetoothSdpRecord::addAttribute ( quint16 id, const QVariant & attr )

Tries to add an attribute attr with id id to the service. Returns false if the attribute already exists.

See also attributeIds(), removeAttribute(), attribute(), and clearAttributes().

QVariant QBluetoothSdpRecord::attribute ( quint16 id, bool * ok = NULL ) const

Returns the attribute with id id from the service. If the attribute is not found, a null QSDPAttribute is returned. For extra error information, you can pass in the ok flag, which specifies whether an error occurred, or an actual NULL attribute was returned.

See also attributeIds(), addAttribute(), removeAttribute(), and clearAttributes().

QList<quint16> QBluetoothSdpRecord::attributeIds () const

Returns a list of all attribute identifiers this service contains.

See also addAttribute(), removeAttribute(), attribute(), and clearAttributes().

QList<QBluetoothSdpUuid> QBluetoothSdpRecord::browseGroups () const

Returns a list of unique identifiers of all browse groups this service is a part of.

See also setBrowseGroups().

void QBluetoothSdpRecord::clearAttributes ()

Clears all attributes.

See also attributeIds(), addAttribute(), removeAttribute(), and attribute().

QUrl QBluetoothSdpRecord::docUrl () const

Returns the Doc URL attribute.

See also setDocUrl().

QUrl QBluetoothSdpRecord::execUrl () const

Returns the Exec URL attribute.

See also setExecUrl().

QBluetoothSdpRecord QBluetoothSdpRecord::fromData ( const QByteArray & data )   [static]

Returns a SDP service record generated from the contents of data.

Returns a null service record if the contents of data cannot be parsed.

QBluetoothSdpRecord QBluetoothSdpRecord::fromDevice ( QIODevice * device )   [static]

Returns a SDP service record generated from the contents of device.

Returns a null service record if the contents of device cannot be parsed.

QBluetoothSdpUuid QBluetoothSdpRecord::group () const

Returns the group id attribute.

See also setGroup().

QUrl QBluetoothSdpRecord::iconUrl () const

Returns the Icon URL attribute.

See also setIconUrl().

QBluetoothSdpUuid QBluetoothSdpRecord::id () const

Returns the ServiceID attribute - default value 0x0000. Whilst not mandatory the service on the SDP Server can be uniquely identified using this uuid.

See also setId().

bool QBluetoothSdpRecord::isInstance ( QBluetooth::SDPProfile profile ) const

This method can be used to find out whether a SDP record is an implementation of a particular service class, given by profile parameter.

This method returns true if the service class matches, false otherwise.

bool QBluetoothSdpRecord::isInstance ( const QBluetoothSdpUuid & serviceUuid ) const

This is an overloaded member function, provided for convenience.

This method can be used to find out whether a SDP record is an implementation of a particular service class, given by serviceUuid parameter.

This method returns true if the service class matches, false otherwise.

bool QBluetoothSdpRecord::isNull () const

Returns true if this SDP service record has no attributes.

QString QBluetoothSdpRecord::providerName () const

Returns the provider name attribute.

See also setProviderName().

quint32 QBluetoothSdpRecord::recordHandle () const

Returns a server specific record handle.

See also setRecordHandle().

bool QBluetoothSdpRecord::removeAttribute ( quint16 id )

Removes the attribute with the specified id id from the service record. Returns true on success. If the attribute is not found, nothing is done and false is returned.

See also attributeIds(), addAttribute(), attribute(), and clearAttributes().

int QBluetoothSdpRecord::rfcommChannel ( const QBluetoothSdpRecord & service )   [static]

For a family of services that work over the RFCOMM protocol, this method returns the RFCOMM channel the service is running on. The service parameter specifies the service record to search.

Returns the channel number on success, -1 if no channel number was found.

QString QBluetoothSdpRecord::serviceDescription () const

Returns the service description attribute.

See also setServiceDescription().

QString QBluetoothSdpRecord::serviceName () const

Returns the service name attribute.

See also setServiceName().

void QBluetoothSdpRecord::setBrowseGroups ( const QList<QBluetoothSdpUuid> & groups )

Sets a list of unique identifiers of all browse groups this service is a part of to groups.

See also browseGroups().

void QBluetoothSdpRecord::setDocUrl ( const QUrl & docUrl )

Sets the Doc URL attribute to docUrl.

See also docUrl().

void QBluetoothSdpRecord::setExecUrl ( const QUrl & execUrl )

Sets the Exec URL attribute to execUrl.

See also execUrl().

void QBluetoothSdpRecord::setGroup ( const QBluetoothSdpUuid & group )

Sets the GroupID attribute to group. All services which belong to a Group Service Class will require this attribute. All other services can be a part of one or more groups. This is set through the browse group list attribute.

See also group().

void QBluetoothSdpRecord::setIconUrl ( const QUrl & iconUrl )

Sets the Icon URL attribute to iconUrl.

See also iconUrl().

void QBluetoothSdpRecord::setId ( const QBluetoothSdpUuid & id )

Sets the ServiceID attribute to id. The id argument should be unique identifier of the service.

See also id().

void QBluetoothSdpRecord::setProviderName ( const QString & providerName )

Sets the provider name attribute to providerName

See also providerName().

void QBluetoothSdpRecord::setRecordHandle ( quint32 handle )

Sets a server specific record handle to handle.

See also recordHandle().

void QBluetoothSdpRecord::setServiceDescription ( const QString & serviceDesc )

Sets the service description attribute to serviceDesc.

See also serviceDescription().

void QBluetoothSdpRecord::setServiceName ( const QString & serviceName )

Sets the service name attribute to serviceName.

See also serviceName().

QBluetoothSdpRecord & QBluetoothSdpRecord::operator= ( const QBluetoothSdpRecord & other )

Assign the contents of other to the current SDP service record.

bool QBluetoothSdpRecord::operator== ( const QBluetoothSdpRecord & other ) const

Returns whether other is equal to this SDP service record.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3