Getting product information remotely using Bluetooth device identification profile
Article Metadata
Code Example
Tested with
Compatibility
Article
Contents |
Overview
This article provides information about the Bluetooth device identification profile for additional information above and beyond the Bluetooth Class of Device. Device identification profile is dependent on, and an extension of, the behaviors defined by the Service Discovery Protocol (SDP). There is a complete Symbian C++ example that can be used to test and check the remote device information.
Detailed Description
Device identification information for the device is exported in terms of an explicit SDP record on the device. This is called the device identification service record, and is identified by a unique UUID – this UUID is called PNPInformation and it is part of the Bluetooth assigned numbers. This SDP record can be queried by remote devices and it contains additional information about the device. The additional information includes Specification ID, Vendor ID, Product ID, Version, etc. Device manufacturers include this information in their devices. Nokia supports the device identification profile from S60 5th edition onwards, including some S60 3rd Edition, Feature Pack 2 devices as well.
How to find device information
Symbian C++ provides an API for getting SDP records.
A service search returns the record handles of services that are of a specified class or classes (identified by UUID numbers). We create a CSdpSearchPattern object to specify the service classes to search for and create a CSdpAttrIdMatchList object in which to specify the attributes to be retrieved.
iSdpSearchPattern = CSdpSearchPattern::NewL();
iSdpSearchPattern->AddL(0x1200);
For more information, see the Service discovery page at www.bluetooth.org (registration required).
iMatchList = CSdpAttrIdMatchList::NewL();
iMatchList->AddL(TAttrRange(0x0200, 0x0205));
...
iAgent->SetRecordFilterL(*iSdpSearchPattern);
iAgent->NextRecordRequestL();
void CSdpPropertySearcher::AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID,CSdpAttrValue* aAttrValue)
{
switch (aAttrID)
{
case 0x200:
val=aAttrValue->Uint();
iAttrBuffer.AppendFormat(_L("\r\nSpec ID: 0x%04x\r\n"),val);
break;
case 0x201:
val=aAttrValue->Uint();
iAttrBuffer.AppendFormat(_L("\r\nVendor ID: 0x%04x\r\n"),val);
break;
case 0x202:
val=aAttrValue->Uint();
iAttrBuffer.AppendFormat(_L("\r\nProduct ID: 0x%04x\r\n"),val);
break;
case 0x203:
val=aAttrValue->Uint();
iAttrBuffer.AppendFormat(_L("\r\nVersion ID: 0x%04x\r\n"),val);
break;
case 0x204:
case 0x205:
{
iAttrBuffer.AppendFormat(_L("\r\n 0x204 to 0x205\r\n"));
}
break;
...
Complete Example
We can check if the remote device supports DI profile by running this example. This example can be run on any Nokia S60 3rd to 5th edition device. If the remote device supports ID profile, this example will show the attributes (version, manufacturer, model, etc.) of this record. If the remote device does not support this profile, it will not show any records. File:BTIdProfile.zip


(no comments yet)