Add ourGroupInfo to NodeDB

This commit is contained in:
Jm Casler
2022-02-20 00:04:32 -08:00
parent e969e83037
commit 389a8f1401
5 changed files with 21 additions and 8 deletions

View File

@@ -2,9 +2,13 @@
#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")
{
@@ -14,7 +18,7 @@ GroupPlugin::GroupPlugin()
bool GroupPlugin::handleReceivedProtobuf(const MeshPacket &mp, GroupInfo *pptr)
{
auto p = *pptr;
//auto p = *pptr;
@@ -23,15 +27,17 @@ bool GroupPlugin::handleReceivedProtobuf(const MeshPacket &mp, GroupInfo *pptr)
MeshPacket *GroupPlugin::allocReply()
{
return allocDataProtobuf(p);
GroupInfo gi = GroupInfo_init_default; // Start with an empty structure
return allocDataProtobuf(gi);
}
int32_t GroupPlugin::runOnce()
{
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
//ourGroupInfo.group[0][1] = "a";
return 5000; // to save power only wake for our callback occasionally
}

View File

@@ -6,7 +6,7 @@
/**
* Position plugin for sending/receiving positions into the mesh
*/
class GroupPlugin : private concurrency::OSThread, public ProtobufPlugin<GroupInfo>
class GroupPlugin : public ProtobufPlugin<GroupInfo>, private concurrency::OSThread
{
public:
GroupPlugin();