Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 3212

TBluetoothLE not working properly

$
0
0

I'm trying to connect to a RN4871 bluetooth low energy (BLE) module from Microchip on different platforms, it works best on iOS, but I'm really struggeling on Windows and Android:

Lets start with Windows:

(1)

Just creating a blank FMX application, dropping an TBluetoothLE component, enabling it and call BluetoothLE1->DiscoverDevices(5000); would cause the application to crash after closing.

(2)

if you have enabled the bluetooth module and then disable it...

BliuetoothLE1->Enable=false;

Will cause "Invalid pointer operation", trying to enable it again after that causes another error.

(3)

Generally very unstable, you have to restart the program or remove/insert the BLE USB dongle on the computer several times to make it discover devices.

Android problems:

(1)

Writing data longer than 20 bytes (I think)  fails on Android but works on Windows and iOS.

(2)

You must sometimes open/close the app several times, otherwise you cannot Discover services.

General problems:

(1)

Searching for a service seems to only work if you call the DiscoverServices() from another thread.

(2)

Looking for s specific service when discover devices is not working properly, for example I would like to search for the UART Service on the RN4871 Bluetooth module like this:

const TBluetoothUUID UART_SERVICE = StringToGUID("{49535343-FE7D-4AE5-8FA9-9FAFD205E455}");
GUID Services[1];
Services[0] = UART_SERVICE;
BluetoothLE1->DiscoverDevices(5000, &Services[0], 0);

However looking for a Heartrate service like {0000180D-0000-1000-8000-00805F9B34FB} is working.

Could this be caused by that the UART Service doesn't have a name?, see below:

Discovered services on a RN4871 bluetooth module from Microchip

(0) "GAP"
(1) "GATT"
(2) "DEVICE INFORMATION"
(3) ""

GAP : {00001800-0000-1000-8000-00805F9B34FB}
--> Device Name : {00002A00-0000-1000-8000-00805F9B34FB}
--> Appearance : {00002A01-0000-1000-8000-00805F9B34FB}
GATT : {00001801-0000-1000-8000-00805F9B34FB}
--> Service Changed : {00002A05-0000-1000-8000-00805F9B34FB}
--> Client Characteristic Configuration : {00002902-0000-1000-8000-00805F9B34FB}
DEVICE INFORMATION : {0000180A-0000-1000-8000-00805F9B34FB}
--> Manufacturer Name String : {00002A29-0000-1000-8000-00805F9B34FB}
--> Model Number String : {00002A24-0000-1000-8000-00805F9B34FB}
--> Serial Number String : {00002A25-0000-1000-8000-00805F9B34FB}
--> Hardware Revision String : {00002A27-0000-1000-8000-00805F9B34FB}
--> Firmware Revision String : {00002A26-0000-1000-8000-00805F9B34FB}
--> Software Revision String : {00002A28-0000-1000-8000-00805F9B34FB}
--> System ID : {00002A23-0000-1000-8000-00805F9B34FB}
--> IEEE 11073-20601 Regulatory : {00002A2A-0000-1000-8000-00805F9B34FB}
: {49535343-FE7D-4AE5-8FA9-9FAFD205E455}
--> : {49535343-1E4D-4BD9-BA61-23C647249616}
--> Client Characteristic Configuration : {00002902-0000-1000-8000-00805F9B34FB}
--> : {49535343-8841-43F4-A8D4-ECBE34729BB3}
--> : {49535343-4C8A-39B3-2F49-511CFF073B7E}
--> Client Characteristic Configuration : {00002902-0000-1000-8000-00805F9B34FB}

 


Viewing all articles
Browse latest Browse all 3212

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>