firmware/src/modules/AdminModule.h

47 lines
1.4 KiB
C
Raw Normal View History

2021-02-21 06:03:44 +00:00
#pragma once
#include "ProtobufModule.h"
2021-02-21 06:03:44 +00:00
/**
2022-11-25 19:32:43 +00:00
* Admin module for admin messages
2021-02-21 06:03:44 +00:00
*/
class AdminModule : public ProtobufModule<meshtastic_AdminMessage>
2021-02-21 06:03:44 +00:00
{
public:
/** Constructor
* name is for debugging output
*/
2022-02-27 10:21:02 +00:00
AdminModule();
2021-02-21 06:03:44 +00:00
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 meshtastic_MeshPacket &mp, meshtastic_AdminMessage *p) override;
2021-02-21 06:03:44 +00:00
private:
bool hasOpenEditTransaction = false;
void saveChanges(int saveWhat, bool shouldReboot = true);
2022-05-02 12:00:24 +00:00
/**
* Getters
*/
void handleGetOwner(const meshtastic_MeshPacket &req);
void handleGetConfig(const meshtastic_MeshPacket &req, uint32_t configType);
void handleGetModuleConfig(const meshtastic_MeshPacket &req, uint32_t configType);
void handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex);
void handleGetDeviceMetadata(const meshtastic_MeshPacket &req);
2022-05-02 12:00:24 +00:00
/**
* Setters
*/
void handleSetOwner(const meshtastic_User &o);
void handleSetChannel(const meshtastic_Channel &cc);
void handleSetConfig(const meshtastic_Config &c);
void handleSetModuleConfig(const meshtastic_ModuleConfig &c);
2022-05-02 12:00:24 +00:00
void handleSetChannel();
2022-10-20 00:19:04 +00:00
void reboot(int32_t seconds);
2021-02-21 06:03:44 +00:00
};
2022-02-27 10:21:02 +00:00
extern AdminModule *adminModule;