So we are creating a peripheral with a characteristic meant to keep the central synced with the state of our peripheral. The peripheral is running all the time, could be ON/OFF/DISABLED/FAULT. Whenever the state changes (which isnt that often), we update the characteristic with a call to sd_ble_gatts_hvx (which actually returns nonzero if not connected). We have the properties set to notify.
I think this is incorrect if we want the central to know the value immediately after connection, and if it hasn't changed on the peripheral in a while. Off the top of my head, maybe we want the characteristic to also have the "read" property set, and the central do an explict "Read" right after connection? Or is this done implicitly by BLE or the SoftDevice somehow, an event with the value generated for us?
Also on the peripheral side is keeping the characteristic up to date with sd_ble_gatts_hvx all the time when not connected the right thing to do? This does seem to fail when we are not connected. Or right after connect should we do an update, which will notify the central? (So it doesn't need a "Read") Or is this also done implicitly somehow if we configure it correctly?
Sorry, these are big questions. I'm just suddenly realizing that this data item is quite different (rare updates) than the data streams I've created before.