1
Vote

cannot retrieve Bluetooth Rssi value (always –2147483648 value)

description

Hello everybody,

I'm trying to get the RSSI value of several remote devices connected by bluetooth.

I installed the 32feet.NET "PM> Install-Package 32feet.NET" and i used the BluetoothDeviceInfo class to get remote Bluetooth information (DeviceName, Mac Address, Rssi ...), see below:



public class Device
{
public string DeviceName { get; set; }
public bool Authenticated { get; set; }
public bool Connected { get; set; }
public ushort Nap { get; set; }
public uint Sap { get; set; }
public DateTime LastSeen { get; set; }
public DateTime LastUsed { get; set; }
public bool Remembered { get; set; }
public string MacAddrress { get; set; }
public int rssi { get; set; }

public Device(BluetoothDeviceInfo device_info)
{

    this.Authenticated = device_info.Authenticated;
    this.Connected = device_info.Connected;
    this.DeviceName = device_info.DeviceName;
    this.LastSeen = device_info.LastSeen;
    this.LastUsed = device_info.LastUsed;
    this.Nap = device_info.DeviceAddress.Nap;
    this.Sap = device_info.DeviceAddress.Sap;
    this.Remembered = device_info.Remembered;
    this.MacAddrress = device_info.DeviceAddress.ToString();
    this.rssi = device_info.Rssi;

}
All information are well retrieved except Rssi value, I get always the min value of int (–2147483648). after investigation i realize that there are some restrictions to use the library. Below the note of Rssi parameter in the library:

//
    // Résumé :
    //     Returns the signal strength for the Bluetooth connection with the peer device.
    //     Supports only on some platforms.
    //
    // Notes :
    //     Thus there are multiple reasons which this property can return the error
    //     value (i.e. System.Int32.MinValue).
    //     On an unsupported platform, e.g. MSFT+Win32, or MSFT+CE/WM on an older version.
    //     See below.  The remote device is not turned-on or in range. See below.  On
    //     Widcomm, there is no connection to the remote device. See below.
    //     Platform support:
    //     Does not work on Win32 with the Microsoft Bluetooth stack.  That platform
    //     provide no support for RSSI, please contact Microsoft to complain.  Works
    //     on Windows Mobile 5.0, Windows Embedded CE 6.0, or later versions.  Works
    //     on Widcomm, both platforms.  We will not try to connect, see below.
    //     Finally, to get an RSSI value Bluetooth requires an open connection to the
    //     peer device.  On Widcomm we will not attempt to connect, so the caller must
    //     ensure that there's a connection -- perhaps it could call InTheHand.Net.Sockets.BluetoothDeviceInfo.GetServiceRecords(System.Guid)
    //     just before accessing this property.  On CE/WM if there is no active connection,
    //     then we will attempt to create one. This of course can be slow, and will
    //     be slow if the remote device is not in range.  (Bluetooth 2.1 supports getting
    //     the RSSI value at discovery time which might provide the solution for many
    //     cases. However only the MSFT+Win32 stack specifically supports v2.1, and
    //     of course it doesn't support RSSI at all!)
    //     Note that the Bluetooth specification doesn't require that the radio hardware
    //     provides any great precision in its RSSI readings.  The spec says for instance,
    //     in v2.1 Volume 2 Part E ("HCI") Section 7.5.4: “Note: how accurate the dB
    //     values will be depends on the Bluetooth hardware.  The only requirements
    //     for the hardware are that the Bluetooth device is able to tell whether the
    //     RSSI is inside, above or below the Golden Device Power Range.”
I tested the application under windows 7 64 and windows 8 64 with active connection, i have got always (–2147483648) value despite the platforms seems to be supported!!!

comments