GATT characteristics and flags HM-10

2019-03-05 01:56发布

问题:

I am trying to send bike power data from Arduino to a sports watch with HM-10 BLE using a GATT profiles. I managed to set right values for UUID, CHAR, and notifications. And I can pair my devices. But when I am starting a new exercise the watch can't find power meter.

I don't know how I can send data to the master. I think I need to use some kind of flag before I can send the actual value.

Here is the documentation that I am trying to understand: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.cycling_power_measurement.xml

There is said that flag is 16bits. And in my project, all the bits are zero since I need to send only the measurement value.

can I just set it as:

byte flag = 0xFFFF; int valueToSend = y;

And then use BTserial to send these values.

BTserial.write(flag); BTserial.write(valueToSend);

If someone could point me in the right direction that would be great. I have not found any example code done by HM-10 only with CurieBLE and I think I can't use that syntax directly. Thanks