Implement getOwner

This commit is contained in:
Sacha Weatherstone 2022-03-10 09:14:56 +11:00
parent 8a7a6e9a5d
commit f33cd4081e
No known key found for this signature in database
GPG Key ID: 7AB2D7E206124B31
2 changed files with 18 additions and 0 deletions

View File

@ -61,6 +61,18 @@ void AdminModule::handleGetRadio(const MeshPacket &req)
}
}
void AdminModule::handleGetOwner(const MeshPacket &req)
{
if (req.decoded.want_response) {
// We create the reply here
AdminMessage r = AdminMessage_init_default;
r.get_owner_response = owner;
r.which_variant = AdminMessage_get_owner_response_tag;
myReply = allocDataProtobuf(r);
}
}
bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
{
// if handled == false, then let others look at this message also if they want
@ -101,6 +113,11 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
handleGetRadio(mp);
break;
case AdminMessage_get_owner_request_tag:
DEBUG_MSG("Client is getting owner\n");
handleGetOwner(mp);
break;
case AdminMessage_reboot_seconds_tag: {
int32_t s = r->reboot_seconds;
DEBUG_MSG("Rebooting in %d seconds\n", s);

View File

@ -26,6 +26,7 @@ class AdminModule : public ProtobufModule<AdminMessage>
void handleGetChannel(const MeshPacket &req, uint32_t channelIndex);
void handleGetRadio(const MeshPacket &req);
void handleGetOwner(const MeshPacket &req);
};
extern AdminModule *adminModule;