Check board connected state and (clean) disconnect
How can I check the connection status of the board in python? The MetaWear class has a _on_disconnect() function but it has no code inside.
I would like to detect when a board gets disconnected and why, that is, difference between calling disconnect() and other reasons (out-of-range or battery depleted).
Also, when I disconnect and reconnect again, the subscribed handlers are still there. Which is the preferrred way to cleanly disconnect? Do i have to call mbl_mw_metawearboard_tear_down before disconnect()?
This discussion has been closed.
Comments
No, if you free the memory first, then you can no longer issue commands with that object.
Freeing memory is discussed in the documentation.
https://mbientlab.com/cppdocs/latest/mblmwmetawearboard.html#freeing-memory
You can reset the board with "mbl_mw_debug_reset".
http://mbientlab.com/docs/metawear/cpp/0/debug_8h.html#a7c08136c14e58170fe5c1cd8d43a26f1
mbl_mw_debug_reset
thenmbl_mw_metawearboard_free
. When you want to connect to the board again, create another MetaWear object.