add event fun
This commit is contained in:
@@ -30,7 +30,7 @@ class Front;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//单条补招结构
|
||||
//单条补招时间结构
|
||||
class RecallInfo
|
||||
{
|
||||
public:
|
||||
@@ -38,10 +38,37 @@ public:
|
||||
long long endtime; //结束时间
|
||||
};
|
||||
|
||||
//日志补招结构类
|
||||
//测点记录的补招结构
|
||||
class RecallMonitor
|
||||
{
|
||||
public:
|
||||
int recall_status; //补招状态 0-未补招 1-补招中 2-补招完成 3-补招失败
|
||||
std::string StartTime; //数据补招起始时间
|
||||
std::string EndTime; //数据补招结束时间
|
||||
std::string STEADY; //补招历史统计数据标识 0-不补招;1-补招
|
||||
std::string VOLTAGE; //补招暂态事件标识 0-不补招;1-补招
|
||||
};
|
||||
|
||||
enum class RecallStatus {
|
||||
NOT_STARTED = 0, // 未补招
|
||||
RUNNING = 1, // 补招中
|
||||
DONE = 2, // 补招完成
|
||||
FAILED = 3 // 补招失败
|
||||
};
|
||||
|
||||
// 本轮要下发的一条任务(每个终端最多一条)
|
||||
struct RecallTask {
|
||||
std::string dev_id;
|
||||
std::string start_time;
|
||||
std::string end_time;
|
||||
std::string monitor_index;
|
||||
};
|
||||
|
||||
//日志补招结构类,当前不使用
|
||||
class JournalRecall
|
||||
{
|
||||
public:
|
||||
std::string DevID; //装置号
|
||||
std::string MonitorID; //线路监测点号
|
||||
std::string StartTime; //数据补招起始时间
|
||||
std::string EndTime; //数据补招结束时间
|
||||
@@ -84,7 +111,7 @@ class ledger_monitor
|
||||
{
|
||||
public:
|
||||
std::string monitor_id; //监测点id
|
||||
std::string terminal_id; //监测点
|
||||
std::string terminal_id; //监测点的终端id
|
||||
std::string monitor_name; //监测点名
|
||||
std::string logical_device_seq; //监测点序号
|
||||
std::string voltage_level; //监测点电压等级
|
||||
@@ -99,6 +126,9 @@ public:
|
||||
//暂态事件
|
||||
qvvr_event qvvrevent;
|
||||
|
||||
//补招列表
|
||||
std::list<RecallMonitor> recall_list;
|
||||
|
||||
//定值list
|
||||
std::list<float> set_values;
|
||||
std::vector<DZ_TAB_STRUCT> dz_info_list; //定值信息列表
|
||||
@@ -511,7 +541,7 @@ void check_and_backup_qvvr_files();
|
||||
//业务超时检查
|
||||
void check_device_busy_timeout();
|
||||
|
||||
//业务响应
|
||||
//业务上报
|
||||
void send_reply_to_cloud(int reply_code, const std::string& dev_id, int type);
|
||||
|
||||
//查guid
|
||||
@@ -538,6 +568,18 @@ void SendFileWeb(const std::string& strUrl, const std::string& localpath, const
|
||||
//状态翻转
|
||||
void connect_status_update(const std::string& id, int status);
|
||||
|
||||
//业务停止
|
||||
void clear_terminal_runtime_state(const std::string& id);
|
||||
|
||||
//业务响应
|
||||
void on_device_response_minimal(int response_code,
|
||||
const std::string& id,
|
||||
unsigned char cid,
|
||||
int device_state_int);
|
||||
|
||||
//处理补招的任务
|
||||
void check_recall_event();
|
||||
|
||||
//小工具
|
||||
inline std::string trim_cstr(const char* s, size_t n) {
|
||||
if (!s) return {};
|
||||
@@ -570,7 +612,12 @@ enum class ResponseCode : int {
|
||||
TIMEOUT = 406, // 请求超出了等待时间
|
||||
INTERNAL_ERROR = 500 // 其他错误
|
||||
};
|
||||
static inline bool is_ok(int rc) { return rc == static_cast<int>(ResponseCode::OK); }
|
||||
|
||||
static bool parse_datetime_tm(const std::string& s, std::tm& out) {
|
||||
std::memset(&out, 0, sizeof(out));
|
||||
return strptime(s.c_str(), "%Y-%m-%d %H:%M:%S", &out) != nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user