-
-
Notifications
You must be signed in to change notification settings - Fork 213
Peer Device Information
As seen above, the Bluetooth discovery operation returns an array of type BluetoothDeviceInfo; as well as providing the Bluetooth Device Address this class also provides access to the device’s name, its class-of-device bits (ClassOfDevice), its SDP service records (GetServiceRecords), the RSSI measurement (RSSI), the time the device was last connected to (LastUsed), whether it was remembered from a previous discovery/bonding process (Remembered), and whether it is authenticated (Authenticated) etc.
This property is not supported on desktop Windows with the Microsoft stack since there is no native API for it. It is supported on WM with the Microsoft stack (though only on the WM6 platform, devices known to support it include the HTC Trinity and the Symbol MC35). It is generally supported on the other stacks (is supported on Widcomm, BlueSoleil, Bluetopia).
The Bluetooth commands used for the Rssi and ClassOfDevice properties require an open connection to the target device, although the CoD value is also read at discovery time and if is possible to get the RSSI value at discovery in later Bluetooth versions but no stack supports that as far as we know. For most platforms we don't automatically form a connection when the Rssi and ClassOfDevice properties are used, so they will fail if there's no open connection. On MSFT+WM (Microsoft stack on Windows Mobile/CE) we will internally attempt to form a (ACL) connection to allow the native API to work, thus if the device is not in range the property will take a long time to return.
To manually form a connection before using the RSSI property see Testing if a device is in range.
Note finally that firstly the RSSI measurement is not very precise, and secondly that devices can transmit at diffferent power level, so for instance a far away Class 1 device using a high power level could seem 'nearer' than a Class 3 device.
There is also a LastSeen property which reports the value provided by desktop Windows — the value seems broken however, always just being the time of the discovery operation. However, we set the value correctly on WM/CE with the Microsoft stack, and on the other stacks.
The SDP lookup operation GetServiceRecords can be used to find the details of the services running on a peer device — the SdpBrowserDesktop/-Device samples programs can be used to inspect the records on devices in range. See below for more information on using SDP records.
See Connecting to Bluetooth services for information.
Short version: You probably don't want to use this property.
The InstalledServices property does not list all the services a peer device supports, but instead reports those that the local machine is configured to use — on desktop Windows, those that are ticked on the Services page of the Bluetooth Device property sheets. This property is currently not supported on the other stacks/platforms.
Reference: BluetoothDeviceInfo class Rssi property etc
32feet.NET - Personal Area Networking for .NET
In The Hand Ltd