• And what exactly is the difficult part? looks like just bit shifting values you care for to right positions - basically a one liner for the power state, something like


    GATT is little endian so no further conversion needed for the value itself. Then putting it to byte array like Gordon mentioned.

    The reason might be saving power, every byte sent/received takes some power. also bit shifting is really basic thing not really so difficult. And also when implemented in C you can define bitfield directly as part of structure so bits go to right places automatically.

    Also the first Flags byte makes most of it optional so just reporting the level is two bytes
    new Uint8Array([1<<1,level]) and that's it.

    btw I'd probably remove "indicate: true," unless the specs make this required - indications need acknowledgement from the client for every notification sent, just plain notifications should be good enough for battery reporting. well unless that flag means that client can optionally subscribe to indications but also only for plain notifications. Not sure how it works.


Avatar for fanoush @fanoush started