Retrieving Stored Bluetooth Device Data
10/16/2008
This topic describes how to retrieve detailed information about a paired device from the system registry using the Bluetooth Pairing Service API.
About Device Attributes
After a Bluetooth–enabled device has paired successfully to Windows Embedded CE, information about the paired device is available in the Windows Embedded CE system registry.
Each paired device has a corresponding registry entry under [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\BTPairSvc\Devices]. This registry key contains sub–keys for each Bluetooth profile supported, and a sub–key named \Attributes which contains device attributes.
Note
When the Windows Embedded CE system is cold booted, the registry will be cleaned and the paired device list will be empty.
The following is a list of device attributes available under the \Attributes sub–key:
Sub–key | Value | Description |
---|---|---|
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\RingtoneOption] |
DWORD |
Indicates whether ring-tone option is present for notification of incoming calls. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\AccessOrder_HFP] |
DWORD |
Indicates order in which paired phones are accessed for Hands-Free Profile (HFP). |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\SupportsATCOPS] |
DWORD |
Indicates whether device supports AT+COPS command, which is used to indicate whether the phone is connected to a network, or to change the GSM network. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\ListCurrCalls] |
DWORD |
Indicates list of current calls. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\HFPSMSSupport] |
DWORD |
Indicates whether device supports Hands-Free Profile (HFP) Short Message Service (SMS). |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\HFPPBSupport] |
DWORD |
Indicates whether device supports Hands-Free Profile (HFP) Phone Book (PB). |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\CHLDFeatures] |
DWORD |
Indicates CHLD features. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\Manuf] |
String |
Indicates manufacturer of the paired device. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\Model] |
String |
Indicates model of the paired device. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\BatteryCINDIndex] |
DWORD |
AT+CIND command that indicates cell-indicator status for "battery". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\CallheldCINDIndex] |
DWORD |
AT+CIND command that indicates cell-indicator status for "callheld". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\SignalCINDIndex] |
DWORD |
AT+CIND command that indicates cell-indicator status for "signal". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\Call_StatusCINDIndex] |
DWORD |
AT+CIND command that indicates cell-indicator status for "call_status". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\RoamCINDIndex] |
DWORD |
AT+CIND command that indicates cell-indicator status for "roaming". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\CallSetupCINDIndex] |
DWORD |
AT+CIND commands indicates cell-indicator status for "callsetup". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\ServiceCINDIndex] |
DWORD |
AT+CIND command indicates cell-indicator status for "service". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\CallCINDIndex] |
DWORD |
AT+CIND command indicates cell-indicator status for "call". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\CINDCount] |
DWORD |
AT+CIND command indicates cell-indicator status for "count". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\CINDData] |
BLOB |
AT+CIND command indicates cell-indicator status for "data". |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\BRSFeatures] |
DWORD |
Indicates Broadband Radio Service (BRS) features. BRS provides high-speed and high-capacity broadband service. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\IsHFP10] |
DWORD |
Indicates support for HFP 1.0 spec. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\PhoneCAP] |
BLOB |
Indicates phone capabilities. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\ContactAdded] |
DWORD |
Indicates whether a new contact has been added. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\Exclusive] |
DWORD |
Indicates exclusive attribute value. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\AccessOrder_BTAV] |
DWORD |
Indicates order in which paired devices are accessed for Bluetooth Audio/Video. |
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn \BTPairSvc\Devices\<UniqueDeviceID>\Attributes\AccessOrder_PAIR] |
DWORD |
Indicates order in which paired devices are accessed. |
Retrieving Device Attributes
To retrieve device attribute values stored in the registry, you can use the GetBTDeviceAttribute functions.
Attributes can be retrieved or set in the form of a DWORD, a BYTE array (BLOB), or a WCHAR.
The functions that retrieve device attributes are GetBTDeviceAttributeDWORD, GetBTDeviceAttributeBLOB, and GetBTDeviceAttributeWCHAR. The functions that set device attributes are SetBTDeviceAttributeDWORD, SetBTDeviceAttributeBLOB, and SetBTDeviceAttributeWCHAR.
For example, the following code example gets the value for the Manufacturer sub–key belonging to a Bluetooth–enabled device which has already been discovered and paired to:
TCHAR szPhoneType[1000] = {0};
DWORD dwPhoneTypeLen = 1000;
dwResult = GetBTDeviceAttributeWCHAR(csDeviceInfo.m_btAddr,
L"Manuf",
szPhoneType,
&dwPhoneTypeLen
);
Another type of device attribute exists that is general to the Bluetooth Pairing Service. For example, the BTPAIR_ATTRNAME_ACCESSORDER attribute (defined in btpairapi.h) indicates the independent access order for each device type. One of the GetBTDeviceAttribute functions can be used to read or write this value.
For example:
BTDeviceAttributeDWORD(arPairedDevices[ nNdx ]->m_diDeviceInfo.m_btAddr,
BTPAIR_ATTRNAME_ACCESSORDER,
arPairedDevices[ nNdx ]->m_dwAccessOrderCur
);