2021-02-21 06:03:44 +00:00
|
|
|
#pragma once
|
2022-03-09 08:01:43 +00:00
|
|
|
#include "ProtobufModule.h"
|
2021-02-21 06:03:44 +00:00
|
|
|
|
|
|
|
/**
|
2022-02-27 10:21:02 +00:00
|
|
|
* Routing module for router control messages
|
2021-02-21 06:03:44 +00:00
|
|
|
*/
|
2022-03-09 08:01:43 +00:00
|
|
|
class AdminModule : public ProtobufModule<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
|
|
|
|
*/
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *p) override;
|
2021-02-21 06:03:44 +00:00
|
|
|
|
|
|
|
private:
|
2022-11-21 01:50:45 +00:00
|
|
|
bool hasOpenEditTransaction = false;
|
|
|
|
|
|
|
|
void saveChanges(int saveWhat, bool shouldReboot = true);
|
2022-05-02 12:00:24 +00:00
|
|
|
/**
|
|
|
|
* Getters
|
|
|
|
*/
|
|
|
|
void handleGetOwner(const MeshPacket &req);
|
2022-05-03 12:16:50 +00:00
|
|
|
void handleGetConfig(const MeshPacket &req, uint32_t configType);
|
|
|
|
void handleGetModuleConfig(const MeshPacket &req, uint32_t configType);
|
2022-05-02 12:00:24 +00:00
|
|
|
void handleGetChannel(const MeshPacket &req, uint32_t channelIndex);
|
2022-08-08 12:19:04 +00:00
|
|
|
void handleGetDeviceMetadata(const MeshPacket &req);
|
2022-05-02 12:00:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Setters
|
|
|
|
*/
|
2021-02-21 06:03:44 +00:00
|
|
|
void handleSetOwner(const User &o);
|
2022-05-02 12:00:24 +00:00
|
|
|
void handleSetChannel(const Channel &cc);
|
2022-05-02 00:24:28 +00:00
|
|
|
void handleSetConfig(const Config &c);
|
2022-05-02 12:00:24 +00:00
|
|
|
void handleSetModuleConfig(const ModuleConfig &c);
|
|
|
|
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;
|