send dynamic probed GPS status to the phone

1.2-legacy
geeksville 2020-03-18 13:29:22 -07:00
rodzic 33437b5246
commit 79ce7d929c
2 zmienionych plików z 14 dodań i 1 usunięć

Wyświetl plik

@ -13,6 +13,8 @@
#include "PowerFSM.h" #include "PowerFSM.h"
#include "CallbackCharacteristic.h" #include "CallbackCharacteristic.h"
#include "GPS.h"
// This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in proccess at once // This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in proccess at once
static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)]; static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)];
@ -93,6 +95,7 @@ public:
} }
}; };
// wrap our protobuf version with something that forces the service to reload the config // wrap our protobuf version with something that forces the service to reload the config
class RadioCharacteristic : public ProtobufCharacteristic class RadioCharacteristic : public ProtobufCharacteristic
{ {
@ -102,6 +105,16 @@ public:
{ {
} }
void onRead(BLECharacteristic *c)
{
DEBUG_MSG("Reading radio config\n");
// update gps connection state
devicestate.has_radio = gps.isConnected;
BLEKeepAliveCallbacks::onRead(c);
}
void onWrite(BLECharacteristic *c) void onWrite(BLECharacteristic *c)
{ {
ProtobufCharacteristic::onWrite(c); ProtobufCharacteristic::onWrite(c);

Wyświetl plik

@ -52,7 +52,7 @@ void NodeDB::init()
devicestate.has_my_node = true; devicestate.has_my_node = true;
devicestate.has_radio = true; devicestate.has_radio = true;
devicestate.has_owner = true; devicestate.has_owner = true;
devicestate.has_radio = true; devicestate.has_radio = false;
devicestate.radio.has_channel_settings = true; devicestate.radio.has_channel_settings = true;
devicestate.radio.has_preferences = true; devicestate.radio.has_preferences = true;
devicestate.node_db_count = 0; devicestate.node_db_count = 0;