Files
microser/json/mms_json_inter.h
2025-03-11 21:07:17 +08:00

143 lines
5.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file: $RCSfile: mms_json_inter.h,v $
* @brief: $IEC 61850 Protocol
*
* @version: $Revision: 1.5 $
* @date: $Date: 2018/12/25 13:31:25 $
* @author: $Author: lizhongming $
* @state: $State: Exp $
*
* @latest: $Id: mms_json_inter.h,v 1.5 2018/12/25 13:31:25 lizhongming Exp $
*
*/
#ifndef MMS_JSON_INTER_92327hyhy0923r_H
#define MMS_JSON_INTER_92327hyhy0923r_H
#ifdef __cplusplus
#include <QString>
#include <QList>
#include <QMutex>
#include <QMap>
#define STAT_DATA_BASE_NODE_ID 100 //稳态、统计数据
#define THREE_SECS_DATA_BASE_NODE_ID 200 // 三秒数据、实时数据
#define SOE_COMTRADE_BASE_NODE_ID 300 // soe 录波
#define HIS_DATA_BASE_NODE_ID 400 //历史、补招
class json_block_data //json拼接参数类
{
public:
int monitorId; //监测点ID
int func_type; //对应(#define宏定义中100 — 400)功能选项
int flag; //剔除标记1不剔除0剔除默认剔除 ——————问下王巍此参数如何从线路装置处获取2018-11-21 19:32:38
long long time; //时间戳(毫秒)
double voltage_level; //CZY 2023-08-23 电压等级(翻译后的double类型)
QString mp_id; //char型监测点
QString dev_type;//设备类型
QMap<QString, double> mms_str_map; //数据值(61850数据属性名, 数据值)
/*
json_block_data() //仅调试使用! zl 2018-11-22 09:03:30 ----调试测试初值!
{
monitorId = 7501; //监测点ID
partitionSize = 3; //kafka发送分区个数
func_type = 100; //对应(#define宏定义中100 — 400)功能选项
data_type = 1; //数据类型
flag = 0; //剔除标记
time = 1546099200000; //时间戳(毫秒) 例2018-12-30??00:00:00
//connectLineCount = 1; //已连接线路数
//triggerLineCount = 1; //已触发线路数
mms_str_map.insert("MMXU4$MX$PhVDev$phsA$cVal$mag$f", 123.4567890); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsAHar[0]$ang$f", 200.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsAHar[47]$ang$f", 300.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsAHar[48]$ang$f", 300.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MMXU4$MX$PhVDev$phsB$cVal$mag$f", 123.4567890); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsBHar[0]$ang$f", 200.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsBar[47]$ang$f", 300.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsBar[48]$ang$f", 300.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MMXU4$MX$PhVDev$phsC$cVal$mag$f", 123.4567890); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsCHar[0]$ang$f", 200.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsCHar[47]$ang$f", 300.1234567); //仅调试使用! zl 2018-11-22 10:46:15
mms_str_map.insert("MHAI2$MX$HRPhV$phsCHar[48]$ang$f", 300.1234567); //仅调试使用! zl 2018-11-22 10:46:15
}
*/
};
class Ckafka_data_t //kafka发送数据结构类
{
public:
int monitor_id; //监测点ID
QString strTopic; //kafka发送topic
QString strText; //kafka发送的json字符串
QString mp_id; //char类型id
};
class oss_data_t //oss推送发送数据结构类 zw 2023-9-22 新增
{
public:
QString filename; //云保存路径
QString savename; //本地保存路径
QString data; //保存的数据
//日志通用参数
QString log_name; //终端id或监测点id
QString id; //终端id或监测点id
QString time; //时间
//match_log
int base_mat_num;
int adv_mat_num;
int base_act_num;
int adv_act_num;
//reason_log
int list_num;
};
//extern QMutex kafka_data_list_mutex;
//extern QList<kafka_data_t> kafka_data_list;
/* 使用示例代码:
Ckafka_data_t data;
data.patition_id = 0;
data.strText = QString("{a=1,b=2}");
kafka_data_list_mutex.lock();
kafka_data_list.append(data);
kafka_data_list_mutex.unlock();
*/
int transfer_json_block_data(char v_wiring_type[], json_block_data* data);//lnk2024-8-16添加参数
//int transfer_json_block_data(json_block_data *data);
void errorlog_pgsql(char* id, QString time, QString filename);
QString errorlog_num_pgsql(QString monitorId, QString datatime, QString filename, int count);
QString errorlog_datamatch_pgsql(QString id, QString time, int BASE_MAT_NUM, int ADV_MAT_NUM, int BASE_ACT_NUM, int ADV_ACT_NUM, QString filename);
#endif /* __cplusplus */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int transfer_json_qvvr_data(unsigned int func_type,int monitor_id,double mag,double dur,long long start_tm,long long end_tm,int dis_kind, char* uuid_cfg, char* uuid_dat, char* mp_id, char* Qvvr_rptname, char* devtype);
void processGGIO_start_data_end(char* mp_id, char* fullname, double v,long long time,char* devtype,int monitor_id);
//void errorlog_num(CDataValue* pDataValue, double value, int monitorId, double UL, int maxcount);
//void errorlog_num_json(int monitorId);
void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* TMNL_FACTORY, char* FILE_NAME, int year, int month, int day, int hour, int minute, int second);//zw修改 新增调用函数
void Set_xml_nodeinfo();//zw修改
char* Get_xmlpath(char* devtype);
char* Get_IED(char* devtype);
char* Get_LDevice(char* devtype);
void errorlog_json(char* id, char* ip, int port, int type, char* error_type, char* ERROR_DES, char* ERROR_PARAM);
void SoeRptSql(char* id, int state, char* rpt);
void connectlog_pgsql(char* id,char* datetime,int status);
#ifdef __cplusplus
}
#endif
#endif //MMS_JSON_INTER_92327hyhy0923r_H