Bluetooth signal strength

Does anyone know how to properly track the signal strength of a Bluetooth connection in C #?

I thought using a WMI request, but could not trace the WMI class encapsulating the connection.

The idea is that when I leave my car with my mobile phone in my pocket, the bluetooth signal is weakened and my car is blocked and they will not let me in.

+6
c # bluetooth wmi
source share
1 answer

The Link Manager Protocol (LMP) running on the Bluetooth device monitors channel setup and setup. All this is done by two devices exchanging Protocol Data Units (PDUs). The RSSI functional and software features are provided at the LMP level, which allows you to manage RSSI data. It allows you to read the RSSI level and control the output power of the TX RF (LMP power commands) LMP to control and receive status information.

So, what you are really looking for is defined in LMP using the MS Bluetooth stack. The MS HC Stack HCI interface already supports functions below ie

HCI_READHCIPARAMETERS
HCI_STARTHARDWARE
HCI_STOPHARDWARE
HCI_SETCALLBACK
HCI_OPENCONNECTION
HCI_READPACKET
HCI_WRITEPACKET
HCI_CLOSECONNECTION

I believe microsoft can implement the HCI_Read_RSSI function, but they did not.

To get RSSI data, you will need to use LMP to get the necessary information.

Psuedocode example for reading RSSI data

// Read HCI Parameters #include <windows.h> #include <windev.h> #include <bt_buffer.h> #include <bt_hcip.h> #include <bt_os.h> #include <bt_debug.h> #include <svsutil.hxx> #include <bt_tdbg.h> unsigned short hci_subversion, lmp_subversion, manufacturer; unsigned char hci_version, lmp_version, lmp_features[8]; if (BthReadLocalVersion (&hci_version, &hci_subversion, &lmp_version, &lmp_subversion, &manufacturer, lmp_features) != ERROR_SUCCESS) { SetUnloadedState (); return 0; } WCHAR szLine[MAX_PATH] unsigned char *pf = lmp_features; if ((*pf) & 0x02) { wsprintf (szLine, L" RSSI"); } 

This will ONLY work with Microsoft bluetooth glass. This is also C ++ code. I got this from an exchange of experts (I know) at the bottom of the page. http://www.experts-exchange.com/Programming/Wireless_Programming/Bluetooth/Q_21267430.html

There is no specific function that will do this for you.

There is also this library that can help you, I did not completely look at the documentation, but I heard about it. http://inthehand.com/content/32feet.aspx

Kind person!

+5
source share

All Articles