From b6d7eadea3287424b375d7f8bca8a033cbf9c5d8 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Thu, 24 Feb 2022 20:05:27 -0800 Subject: [PATCH] Remove chat groups --- src/mesh/PhoneAPI.cpp | 12 +------ src/plugins/GroupPlugin.cpp | 68 ------------------------------------- src/plugins/GroupPlugin.h | 29 ---------------- src/plugins/Plugins.cpp | 4 +-- 4 files changed, 2 insertions(+), 111 deletions(-) delete mode 100644 src/plugins/GroupPlugin.cpp delete mode 100644 src/plugins/GroupPlugin.h diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 72e02cfa2..ca794036f 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -140,16 +140,9 @@ 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_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; + service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon. break; case STATE_SEND_NODEINFO: { @@ -228,9 +221,6 @@ bool PhoneAPI::available() case STATE_SEND_MY_INFO: return true; - case STATE_SEND_GROUPS: - return true; - case STATE_SEND_NODEINFO: if (!nodeInfoForPhone) nodeInfoForPhone = nodeDB.readNextInfo(); diff --git a/src/plugins/GroupPlugin.cpp b/src/plugins/GroupPlugin.cpp deleted file mode 100644 index 243ad1610..000000000 --- a/src/plugins/GroupPlugin.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "GroupPlugin.h" -#include "MeshService.h" -#include "Router.h" -#include "configuration.h" -#include "NodeDB.h" - - -GroupPlugin *groupPlugin; - - - -GroupPlugin::GroupPlugin() - : ProtobufPlugin("group", PortNum_GROUP_APP, GroupInfo_fields), concurrency::OSThread("GroupPlugin") -{ - - strcpy(ourGroupInfo.group[0], "Avocado"); - strcpy(ourGroupInfo.group[1], "Backberries"); - strcpy(ourGroupInfo.group[2], "Cantaloupe"); - strcpy(ourGroupInfo.group[3], "Durian"); - strcpy(ourGroupInfo.group[4], "Elderberry"); - strcpy(ourGroupInfo.group[5], "Fig"); - strcpy(ourGroupInfo.group[6], "Guava"); - strcpy(ourGroupInfo.group[7], "Honeydew"); - strcpy(ourGroupInfo.group[8], "Jackfruit"); - strcpy(ourGroupInfo.group[9], "Kiwifruit"); - -} - -bool GroupPlugin::handleReceivedProtobuf(const MeshPacket &mp, GroupInfo *pptr) -{ - //auto p = *pptr; - - - - return false; // Let others look at this message also if they want -} - -MeshPacket *GroupPlugin::allocReply() -{ - GroupInfo gi = GroupInfo_init_default; // Start with an empty structure - - return allocDataProtobuf(gi); -} - -int32_t GroupPlugin::runOnce() -{ - NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); - - - DEBUG_MSG("Group 0=%s\n", ourGroupInfo.group[0]); - DEBUG_MSG("Group 1=%s\n", ourGroupInfo.group[1]); - DEBUG_MSG("Group 2=%s\n", ourGroupInfo.group[2]); - DEBUG_MSG("Group 3=%s\n", ourGroupInfo.group[3]); - DEBUG_MSG("Group 4=%s\n", ourGroupInfo.group[4]); - DEBUG_MSG("Group 5=%s\n", ourGroupInfo.group[5]); - DEBUG_MSG("Group 6=%s\n", ourGroupInfo.group[6]); - DEBUG_MSG("Group 7=%s\n", ourGroupInfo.group[7]); - DEBUG_MSG("Group 8=%s\n", ourGroupInfo.group[8]); - DEBUG_MSG("Group 9=%s\n", ourGroupInfo.group[9]); - DEBUG_MSG("Group 10=%s\n", ourGroupInfo.group[10]); - DEBUG_MSG("Group 11=%s\n", ourGroupInfo.group[11]); - - - - DEBUG_MSG("group plugin runOnce()\n"); - - return 50000; // to save power only wake for our callback occasionally -} diff --git a/src/plugins/GroupPlugin.h b/src/plugins/GroupPlugin.h deleted file mode 100644 index f456234b0..000000000 --- a/src/plugins/GroupPlugin.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include "GroupPlugin.h" -#include "ProtobufPlugin.h" -#include "concurrency/OSThread.h" - -/** - * Position plugin for sending/receiving positions into the mesh - */ -class GroupPlugin : public ProtobufPlugin, private concurrency::OSThread -{ - public: - GroupPlugin(); - - protected: - /** Called to handle a particular incoming message - - @return true if you've guaranteed you've handled this message and no other handlers should be considered for it - */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, GroupInfo *p) override; - - /** Messages can be received that have the want_response bit set. If set, this callback will be invoked - * so that subclasses can (optionally) send a response back to the original sender. */ - virtual MeshPacket *allocReply() override; - - /** Does our periodic broadcast */ - virtual int32_t runOnce() override; -}; - -extern GroupPlugin *groupPlugin; diff --git a/src/plugins/Plugins.cpp b/src/plugins/Plugins.cpp index 3cf66a170..c979ce9da 100644 --- a/src/plugins/Plugins.cpp +++ b/src/plugins/Plugins.cpp @@ -4,7 +4,6 @@ #include "plugins/AdminPlugin.h" #include "plugins/CannedMessagePlugin.h" #include "plugins/ExternalNotificationPlugin.h" -#include "plugins/GroupPlugin.h" #include "plugins/NodeInfoPlugin.h" #include "plugins/PositionPlugin.h" #include "plugins/RemoteHardwarePlugin.h" @@ -30,8 +29,7 @@ void setupPlugins() nodeInfoPlugin = new NodeInfoPlugin(); positionPlugin = new PositionPlugin(); textMessagePlugin = new TextMessagePlugin(); - groupPlugin = new GroupPlugin(); - + // Note: if the rest of meshtastic doesn't need to explicitly use your plugin, you do not need to assign the instance // to a global variable.