No Read Request for Battery Service at BC 127

Hi,
I have integrate to the GATT Database the

Battery Service

db_gen_lib.add_primary_service(“180F”);
batterylevel = create_string_buffer(’\x32\x00’, 2)
db_gen_lib.add_characteristic(“2a19”, read|notify, sizeof(batterylevel)-1,batterylevel, TRUE)

I can read the Value 0x32 with a BLE Scanner, but I get no ReadRequest over the serial Protocol. If I notify a value from the BC127 GATT Server, than I get the right value at the BLE Scanner. This behavior I see also at follow Bluetooth Sig Service. (Device Name, TxPower, LinkLoss, Device Information)

Is that normal, that I can change this value, only if I write the complete DataBase ? or is that a bug ?

It is because you are specifying a value. In the documentation it states that if you specify a value then that will always be returned for a read request and no notification will happen. If instead you make the call like this it will then create read request notifications.

db_gen_lib.add_characteristic(“2a19”, read|notify, 0, NULL, TRUE)

Thanks for this information, can you provide me this documentation ?

https://source.sierrawireless.com/resources/airprime/tools/bc127-melody-ble-db-gen/#sthash.OSnDVJOj.dpbs

The db gen tool is located here in a zip. The zip also contains a pdf document titled Application Note: Melody BLE db gen - Rev C. In this document it states on page 3 under section “2. Characteristic declaration:”

“If the value of the characteristic is set, BLE_READ notifications won’t be received and Melody will automatically reply to a read request with the value.”

The example given has a line like this where a fixed value is specified and no read request notifications will be generated. The device will automatically reply on your behalf, no response required from you, and no notice given.

device_name = create_string_buffer(“Melody 6”);

add_characteristic(“2A00”, read, sizeof(device_name)-1, device_name, FALSE);