240717班级,工业化控制系统,煤矿相关行业,昆仑系统
gong
2024-11-07 181a105d2f9688e50d75e7137f1ac6d276558325
common.h
@@ -51,6 +51,10 @@
   //警报管理
   WARNING_REQ, // 警报请求
   WARNING_RES, // 警报响应
    DATA_REQ,  // 数据请求
    DATA_RES,  // 数据响应
    THRESHOLD_REQ, //阈值请求
    THRESHOLD_RES, //阈值响应
   //生产计划管理
@@ -321,7 +325,7 @@
struct MDReq//修改请求
{
   Head head;
   DevicesInfo info;
   MDReq() {
      head.type = MD_REQ;
      head.len = sizeof(MDReq);
@@ -351,6 +355,7 @@
{
   Head head;
   int status;
   DevicesInfo info[0];
   QDRes() {
      head.type = QD_RES;
      head.len = sizeof(QDRes);
@@ -574,14 +579,34 @@
};
//警报管理
struct warningInfo {
    char device_name[32];//设备名称
    char des[32];//警报描述
    char time[32];//警报时间
    float warningdata;//警报数据
    char type[16];//警报类型
    char status[16];//警报状态
};
struct dataInfo {
    char device_name[32];
    char type[16];//环境数据类型
    float data;
    char time[32];//上传数据时间
};
struct threshInfo {
    char device_name[32];
    char type[16];//环境类型
    float min;//最小阈值
    float max;//最大阈值
    char time[32];//阈值修改时间
};
// 警报请求结构体  
struct WarningReq {
   Head head;
   float oxygenWarning;
   float carbonWarning;
   float tempWarning;
   float humidityWarning;
    warningInfo info[0];
   WarningReq() {
      head.type = WARNING_REQ;
@@ -589,36 +614,64 @@
   }
};
//数据请求结构体
struct DataReq {
    Head head;
    dataInfo Info[0];
struct DataThreshold {
   //阈值
   float oxygenThreshold;
   float carbonThreshold;
   float tempThreshold;
   float humidityThreshold;
    DataReq() {
        head.type = DATA_REQ;
        head.len = sizeof(DataReq);
    }
};
struct Data {
   float oxygen;   // 氧气浓度
   float carbon;   // 一氧化碳浓度
   float temp;     // 温度
   float humidity; // 湿度
//阈值请求结构体
struct ThresholdReq {
    Head head;
    threshInfo threInfo[0];
    ThresholdReq() {
        head.type = THRESHOLD_REQ;
        head.len = sizeof(ThresholdReq);
    }
};
// 警报响应结构体  
struct WarningRes {
   Head head;
   int status;         // 响应状态(比如 0 表示成功,1 表示失败等)
   const char* message; // 响应消息描述
    int status;// 响应状态
    warningInfo warninginfo[0];
   WarningRes(int stat, const char* msg) {
    WarningRes() {
      head.type = WARNING_RES;
      head.len = sizeof(WarningRes);
      status = stat;
      message = msg;
   }
};
struct DataRes {
    Head head;
    int status;// 响应状态
    dataInfo datainfo[0];
    DataRes() {
        head.type = DATA_RES;
        head.len = sizeof(DataRes);
    }
};
struct ThresholdRes {
    Head head;
    int status;// 响应状态
    threshInfo threInfo[0];
    ThresholdRes() {
        head.type = THRESHOLD_RES;
        head.len = sizeof(ThresholdRes);
    }
};
//生产计划管理
struct PdplanInfo
{