How can I implement a custom characteristic which displays the value in range of -100 ... 0 ... 100 %?

Hello,

I've tried to implement a custom service with a custom chacteristic, that shows the values per notification in the MCP (Master Control Panel) in percentage.

I played around with the ble_gatts_char_pf_t structure, provide the unit with the value proposed here:

0x27AD percentage org.bluetooth.unit.percentage

but without luck.

.format = BLE_GATT_CPF_FORMAT_SINT8;

.exponent = 1; // ???

.unit = 0x27AD

.name_space = BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN; // tried also: BLE_GATT_CPF_NAMESPACE_BTSIG

Is there any example, which shows, how to setup this structure properly?

It should finally works like the battery level (which is handled in bas.c).

I can see the changeing values during received notifications in MCP, but only as hex value.

Where did I go wrong here?

Thnaks in advance.

Regards Thomas