Files
firmware/src/modules/AdminModule.h

47 lines
1.3 KiB
C
Raw Normal View History

2021-02-21 14:03:44 +08:00
#pragma once
#include "ProtobufModule.h"
2021-02-21 14:03:44 +08:00
/**
2022-11-25 20:32:43 +01:00
* Admin module for admin messages
2021-02-21 14:03:44 +08:00
*/
class AdminModule : public ProtobufModule<AdminMessage>
2021-02-21 14:03:44 +08:00
{
public:
/** Constructor
* name is for debugging output
*/
2022-02-27 02:21:02 -08:00
AdminModule();
2021-02-21 14:03:44 +08: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
*/
2022-01-24 17:24:40 +00:00
virtual bool handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *p) override;
2021-02-21 14:03:44 +08:00
private:
bool hasOpenEditTransaction = false;
void saveChanges(int saveWhat, bool shouldReboot = true);
2022-05-02 22:00:24 +10:00
/**
* Getters
*/
void handleGetOwner(const MeshPacket &req);
2022-05-03 22:16:50 +10:00
void handleGetConfig(const MeshPacket &req, uint32_t configType);
void handleGetModuleConfig(const MeshPacket &req, uint32_t configType);
2022-05-02 22:00:24 +10:00
void handleGetChannel(const MeshPacket &req, uint32_t channelIndex);
void handleGetDeviceMetadata(const MeshPacket &req);
2022-05-02 22:00:24 +10:00
/**
* Setters
*/
2021-02-21 14:03:44 +08:00
void handleSetOwner(const User &o);
2022-05-02 22:00:24 +10:00
void handleSetChannel(const Channel &cc);
2022-05-02 10:24:28 +10:00
void handleSetConfig(const Config &c);
2022-05-02 22:00:24 +10:00
void handleSetModuleConfig(const ModuleConfig &c);
void handleSetChannel();
2022-10-19 19:19:04 -05:00
void reboot(int32_t seconds);
2021-02-21 14:03:44 +08:00
};
2022-02-27 02:21:02 -08:00
extern AdminModule *adminModule;