clariusdev / solum

APIs for OEMs to Create Standalone Applications
https://www.clarius.com
BSD 3-Clause "New" or "Revised" License
16 stars 10 forks source link

Clarification and Consistency in Connection and Reconnection Behavior of solumConnect #44

Closed danilogr closed 4 months ago

danilogr commented 1 year ago

Describe the bug I have observed some inconsistent behavior in how solumConnect manages connections and reconnections to the ultrasound probe.

When it comes to connecting to an ultrasound probe, calling solumConnect starts a connection from solum to the probe. If the probe is not immediately available, solum invokes the connection status callback twice, once with the state ProbeDisconnected and then with the state ConnectionFailed with a timeout message.

After that, I would expect that I have to call solumConnect to try again; however, that is not the case. Solum will keep trying to reconnect for an unknown number of times until it connects to the probe (or until i call solumDisconnect).

Unfortunately, the behavior changes if Solum connects to the probe and then the probe disconnects due to wifi issues or due to the probe being powered off. Solum never tries to reconnect.

As an OEM developer, it would be really helpful to have a clear understanding of Solum's state machine for managing reconnections. One solution is to never try to reconnect, and only invoke the connection status callback once thereby delegating the reconnection mechanism to the OEM developer. Another solution is to expose its internal state. For example, having a method such as isReconnecting() to tell developers if Solum will try to reconnect.

I understand that these requests require changes to the SDK, so, for now, I seek clarification on the following:

Thank you!

Environment:

clariusk commented 1 year ago

Good point - thanks for bringing this up. upon initial connection, solum (and the Clarius App) attempts multiple reconnects delayed by 3 second increments, this is to account for potential of delay in joining the probe's Wi-Fi network, or not being on the router, etc.

After an initial connection is made, there are no more attempts reconnect until a disconnect/connect call is made again. It's not always known immediately from the internal socket layer in the O/S if a connection is broken because of Wi-Fi issues or a network loss, hence we do not re-attempt a connection because of this.