diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 4f434fa1f..5d533793d 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -140,11 +140,18 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info fromRadioScratch.which_payloadVariant = FromRadio_my_info_tag; fromRadioScratch.my_info = myNodeInfo; - state = STATE_SEND_NODEINFO; + state = STATE_SEND_GROUPS; service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon. break; + case STATE_SEND_GROUPS: + fromRadioScratch.which_payloadVariant = FromRadio_groups_tag; + fromRadioScratch.groups = ourGroupInfo; + state = STATE_SEND_NODEINFO; + + break; + case STATE_SEND_NODEINFO: { const NodeInfo *info = nodeInfoForPhone; nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index 5a4ca381d..684f683f8 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -24,6 +24,7 @@ class PhoneAPI STATE_SEND_NOTHING, // (Eventual) Initial state, don't send anything until the client starts asking for config // (disconnected) STATE_SEND_MY_INFO, // send our my info record + STATE_SEND_GROUPS, // STATE_SEND_RADIO, // in 1.2 we now send this as a regular mesh packet // STATE_SEND_OWNER, no need to send Owner specially, it is just part of the nodedb STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index e2d53fc50..f04b3f426 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -275,6 +275,7 @@ typedef struct _FromRadio { uint32_t config_complete_id; bool rebooted; MeshPacket packet; + GroupInfo groups; }; } FromRadio; @@ -459,6 +460,7 @@ extern "C" { #define FromRadio_config_complete_id_tag 8 #define FromRadio_rebooted_tag 9 #define FromRadio_packet_tag 11 +#define FromRadio_groups_tag 12 #define ToRadio_packet_tag 2 #define ToRadio_peer_info_tag 3 #define ToRadio_want_config_id_tag 100 @@ -603,13 +605,15 @@ X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,node_info,node_info), 4) \ X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,log_record,log_record), 7) \ X(a, STATIC, ONEOF, UINT32, (payloadVariant,config_complete_id,config_complete_id), 8) \ X(a, STATIC, ONEOF, BOOL, (payloadVariant,rebooted,rebooted), 9) \ -X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11) +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,groups,groups), 12) #define FromRadio_CALLBACK NULL #define FromRadio_DEFAULT NULL #define FromRadio_payloadVariant_my_info_MSGTYPE MyNodeInfo #define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo #define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord #define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket +#define FromRadio_payloadVariant_groups_MSGTYPE GroupInfo #define ToRadio_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 2) \ diff --git a/src/plugins/GroupPlugin.cpp b/src/plugins/GroupPlugin.cpp index 3e3f5df37..ce94dfaeb 100644 --- a/src/plugins/GroupPlugin.cpp +++ b/src/plugins/GroupPlugin.cpp @@ -37,7 +37,13 @@ int32_t GroupPlugin::runOnce() NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); - //ourGroupInfo.group[0][1] = "a"; + //ourGroupInfo.group[0] = "20"; + //ourGroupInfo.group_count; + sprintf(ourGroupInfo.group[0], "Group 0"); + sprintf(ourGroupInfo.group[1], "Group 1"); + sprintf(ourGroupInfo.group[2], "Group 2"); + sprintf(ourGroupInfo.group[3], "Group 3"); + sprintf(ourGroupInfo.group[4], "Group 4"); return 5000; // to save power only wake for our callback occasionally }