From 169d85d0fa2a1506c2f106da14a36f84b8ae2685 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 22 Apr 2020 15:13:05 -0700 Subject: [PATCH] handle the new set_owner and set_radio messages --- src/PhoneAPI.cpp | 16 ++++++++++++++++ src/PhoneAPI.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/PhoneAPI.cpp b/src/PhoneAPI.cpp index 66524b2cf..18a05228e 100644 --- a/src/PhoneAPI.cpp +++ b/src/PhoneAPI.cpp @@ -28,6 +28,22 @@ void PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength) service.handleToRadio(p); break; } + case ToRadio_want_config_id_tag: + config_nonce = toRadioScratch.variant.want_config_id; + DEBUG_MSG("Client wants config, nonce=%u\n", config_nonce); + state = STATE_SEND_MY_NODEINFO; + break; + + case ToRadio_set_owner_tag: + DEBUG_MSG("Client is setting owner\n"); + handleSetOwner(toRadioScratch.variant.set_owner); + break; + + case ToRadio_set_radio_tag: + DEBUG_MSG("Client is setting radio\n"); + handleSetRadio(toRadioScratch.variant.set_radio); + break; + default: DEBUG_MSG("Error: unexpected ToRadio variant\n"); break; diff --git a/src/PhoneAPI.h b/src/PhoneAPI.h index d8c129cce..3439730fa 100644 --- a/src/PhoneAPI.h +++ b/src/PhoneAPI.h @@ -41,6 +41,9 @@ class PhoneAPI ToRadio toRadioScratch; // this is a static scratch object, any data must be copied elsewhere before returning + /// Use to ensure that clients don't get confused about old messages from the radio + uint32_t config_nonce = 0; + public: PhoneAPI();