sample-apps-for-matter-android icon indicating copy to clipboard operation
sample-apps-for-matter-android copied to clipboard

Monitoring device connection state changes

Open edWin-m opened this issue 1 year ago • 1 comments

@pierredelisle Besides manually updating the device's online status based on whether we can successfully exchange the deviceId/nodeId for the connectedDevicePointer via getConnectedDevicePointer(nodeId: Long), Is there another way to monitor the device connection state that can pass as the device's online status in the App?
For instance, by subscribing to state change messages that can be received when the device has established/re-established a connection with the controller or has lost that connection.

edWin-m avatar Mar 27 '23 08:03 edWin-m

Being able to properly detect that a device is offline is something I looked at briefly in the past, but I could not find an appropriate API in the Matter SDK to do so.

More specifically: When we subscribe, we specify MaxIntervalCeling (currently set at 60 seconds).

What I'd like to do is: if we I don’t receive a Report Data within 3 (configurable) x MaxIntervalCeiling: mark the device offline.

Issue though is that there does not seem to be a way to set a callback for these reports at MaxIntervalCeiling. These reports are sent at MaxIntervalCeiling when there was no state change, and the callbacks I know of are only invoked when attributes data change.

If anyone has any idea, please chip in!

pierredelisle avatar Apr 09 '23 01:04 pierredelisle