don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
950 stars 607 forks source link

How to create GATT server with CTS (Current Time Service) to broadcast this time from smartphone to the BLE device ? #858

Open Sebartus opened 3 years ago

Sebartus commented 3 years ago

I am using this plugin to read data from BLE broadcast frame:

ble.scan([], 30, function(device) {

           decode: "advertising": /* ArrayBuffer or map */

}, function(failure){       

});

then I decode: "advertising": / ArrayBuffer or map / where part of decoded data is time in Epoch Time standard ( it is stored in that broadcast frame in Manufacturer Data with other data ). That time supports CTS. The application on the mobile phone ( android & ios ) should provide the CST (Current Time Service) characteristics but how to achieve it with this plugin ?

Thank you for any help or suggestions.

peitschie commented 2 years ago

Hello @Sebartus

Unfortunately, this plugin doesn't provide the capability to define a service and characteristic, as would be necessary to support the proper CTS workflow.

I have no real plans to add the feature, as it's doesn't seem straightforward to make this work properly cross-platform. If you do end up getting an implementation working, I'd certainly be interested in a PR to this effect 🙂