2021-02-21 06:03:44 +00:00
|
|
|
#pragma once
|
2022-03-09 08:01:43 +00:00
|
|
|
#include "ProtobufModule.h"
|
2023-12-02 20:47:52 +00:00
|
|
|
#if HAS_WIFI
|
|
|
|
#include "mesh/wifi/WiFiAPClient.h"
|
2023-02-02 20:05:58 +00:00
|
|
|
#endif
|
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
|
|
|
*/
|
2023-01-21 17:22:19 +00:00
|
|
|
class AdminModule : public ProtobufModule<meshtastic_AdminMessage>
|
2021-02-21 06:03:44 +00:00
|
|
|
{
|
2023-02-03 14:50:10 +00:00
|
|
|
public:
|
|
|
|
/** Constructor
|
|
|
|
* name is for debugging output
|
|
|
|
*/
|
|
|
|
AdminModule();
|
2021-02-21 06:03:44 +00:00
|
|
|
|
2023-02-03 14:50:10 +00:00
|
|
|
protected:
|
|
|
|
/** Called to handle a particular incoming message
|
2021-02-21 06:03:44 +00:00
|
|
|
|
2023-02-03 14:50:10 +00:00
|
|
|
@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
|
|
|
|
2023-02-03 14:50:10 +00:00
|
|
|
private:
|
|
|
|
bool hasOpenEditTransaction = false;
|
2022-11-21 01:50:45 +00:00
|
|
|
|
2023-02-03 14:50:10 +00:00
|
|
|
void saveChanges(int saveWhat, bool shouldReboot = true);
|
2023-05-22 12:00:20 +00:00
|
|
|
|
2023-02-03 14:50:10 +00:00
|
|
|
/**
|
|
|
|
* Getters
|
|
|
|
*/
|
2023-05-22 12:00:20 +00:00
|
|
|
void handleGetModuleConfigResponse(const meshtastic_MeshPacket &req, meshtastic_AdminMessage *p);
|
2023-02-03 14:50:10 +00:00
|
|
|
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);
|
|
|
|
void handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req);
|
2023-05-22 12:00:20 +00:00
|
|
|
void handleGetNodeRemoteHardwarePins(const meshtastic_MeshPacket &req);
|
2023-02-03 14:50:10 +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);
|
|
|
|
void handleSetChannel();
|
2023-02-04 21:11:36 +00:00
|
|
|
void handleSetHamMode(const meshtastic_HamParameters &req);
|
2023-02-03 14:50:10 +00:00
|
|
|
void reboot(int32_t seconds);
|
2021-02-21 06:03:44 +00:00
|
|
|
};
|
|
|
|
|
2023-12-02 20:47:52 +00:00
|
|
|
extern AdminModule *adminModule;
|