hologram-io / hologram-python

Hologram device-side Python SDK - Send messages to the cloud in just 3 lines of code!
https://hologram.io/
MIT License
89 stars 47 forks source link

Connection status is unique to each instance of the sdk #42

Open DomAmato opened 4 years ago

DomAmato commented 4 years ago

Describe the problem

If you were to create two instances of the HologramCloud object and connect with one of them one would show a status of CLOUD_CONNECTED and the other would be CLOUD_DISCONNECTED. While its a contrived example we should be smarter about monitoring the actual state. We also have unreachable states because nothing changes the status outside of the connect and disconnect functions and neither of them does anything with error handling

Expected behavior

If possible doing network.getConnectionStatus() should return the current connection status through a more involved process. Because some modems have a single serial connection querying them during a PPP session might not be possible be we could also check for an active PPP session and query the ppp0 interface to determine the status more reasonably.

Actual behavior

If you connect outside a script it will just return 0 because the status value is instanced

Steps to reproduce the behavior

Do sudo hologram connect run a script that tries to query the connection status

System information