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