unify activity detection in PhoneAPI, turn off BLE API while serial API in use

This commit is contained in:
geeksville
2020-06-08 16:06:59 -07:00
parent 4919129bbc
commit 7473a6c27a
8 changed files with 53 additions and 50 deletions

View File

@@ -50,6 +50,11 @@ class PhoneAPI
/// Use to ensure that clients don't get confused about old messages from the radio
uint32_t config_nonce = 0;
/** the last msec we heard from the client on the other side of this link */
uint32_t lastContactMsec = 0;
bool isConnected = false;
public:
PhoneAPI();
@@ -85,6 +90,12 @@ class PhoneAPI
/// Our fromradio packet while it is being assembled
FromRadio fromRadioScratch;
/// Hookable to find out when connection changes
virtual void onConnectionChanged(bool connected) {}
/// If we haven't heard from the other side in a while then say not connected
void checkConnectionTimeout();
/**
* Subclasses can use this as a hook to provide custom notifications for their transport (i.e. bluetooth notifies)
*/