#ifndef LOCAL_SERVER_HPP_
#define LOCAL_SERVER_HPP_
#include <iostream>
#include <string>

enum MQTTCommand {
    kHWStatus = 7,
    kRebootSystem = 10,
    kTiming = 12,
    kModifyProperty = 20,
    kTimeZone = 22,
    kMqttBrokerCfg = 23, // 配置broker
    kNetworkCfg = 25,
    kGetTransducerInfo = 26,
    kSetTransducerInfo = 41,
    kDeleteTransducerInfo = 27,
    kExecuteShellScript = 50, // 升级网关与传感器
    kModifyTestPointId = 51,
    kModifyTransducerLoose = 53
};

enum WebCommand {
    kLoginUpdateAccount = 1,     // 登录与更新密码
    kWebTiming = 2,              // 校时
    kWebHWStatus = 7,            // 获取硬件状态
    kWebRebootSystem = 8,        // 重启
    kGetFeatureData = 9,         // 获取特征数据
    kGetHistoryFeatureData = 10, // 获取历史特征数据
    kWebModifyProperty = 20,     // 修改网关属性
    kWebTimeZone = 22,
    kWebMqttBrokerCfg = 23, // 配置broker, 用户名与密码
    kWebNetworkCfg = 25,
    kWebGetTransducerInfo = 26,
    kWebDeleteTransducerInfo = 27,
    kUpdateTransducerName = 28,
    kGetTimeDomainWave = 29,
    kGetFreqDomainWave = 30,
    kConfigZigbee = 31,
    kGetEnvolop = 40,
    kModifyTransducerConfig = 41, // 修改传感器配置
    kWebUpgrade = 42,             // 上传传感器固件，网关固件，网关软件，传感器配置
    kGetAllVersionInfo = 50,
    kUpdateInstallPosition = 51, // 修改网关安装位置
    kWifiOperation = 52,
    kUpdateFreqBandEnergyConfig = 53, // 更新频带能量
    kBackupGatewayInfo = 54,          // 备份网关与传感器信息
    kVelocityTimeDomain = 55,
    kVelocityFreqDomain = 56,
    kEnableZigbeePower = 57,
    kSchedulingConfiguration = 58,
    kLostRecords = 59,
    kTransducerUpgrade = 60,
    kWaveRecords = 61,
    kWaveReceive = 62,
    kWaveSend = 63,
    kFeatureSend = 64,
    kFeatureWaveCount = 65,
    KSensorLoose = 66,
    KDebugSensor = 67,          // 调试传感器
    KWaveRule = 68,             // 波形规则配置
    KTrigerWaveUpload = 69,     // 触发波形上传
    KProcessLog = 70,           // 获取应用程序运行日志
    KSystemLog = 71,            // 获取系统日志

     //CMT TCP 
    kGateWayVersion = 80,
    kSensorInfo = 81,
    kSensorWave = 82,
    KDownloadConfig = 83,
    KUploadConfig = 84,
    KUpgadeGateway = 85,
    KUpgradeSensor = 86,
    KEigenvalue = 87,
    KUpgradeSensorStop = 88
};
enum GatewayType{
	kGWTDW2700 = 1,
	
	kGWTDG101 = 10,
	kGWTDG102 = 11
};
class LocalServer {
public:
    LocalServer();
    virtual ~LocalServer();
    static void HandleFromServer(const char *pData, int pLen, const char *topic);
    static std::string HandleCgi_cmd(std::string &pData);
    static void HandleTcp_cmd(const char* recvData,char* send_data,uint8_t& rescmd,int& reslength,int recvbody_length = 0);
};

#endif // LOCAL_SERVER_HPP_
