You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iec104/include/HTIEC104.h

99 lines
2.7 KiB
C

/****************************************************************************
** File name : HTIEC104.h
** Description : define 104 struct
** Create date : 2018.09.01
** Auther by : Liuyx
** Version info : V1.0.01
** Copyright (C) 2002-2018 xi'an huatek, Inc Co., Ltd
** Update record:
** DATE AUTHER DESC
** -------------------------------------------------------------------------
** 2018.09.01 Liuyx first build
****************************************************************************/
#ifndef __HT_IEC104_H
#define __HT_IEC104_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define CMD_START_HEAD 0x68
// 激活命令
#define CMD_STARTDT 0x04
#define CMD_STOPDT 0x10
#define CMD_TESTFR 0x40
// 确认命令
#define CMD_STARTC 0x08
#define CMD_STOPC 0x20
#define CMD_TESTC 0x80
//总召指令
#define CMD_CTL_64H 0x64 // type=总召激活
#define MIN_APDU_LENGTH 6 // min lengtg = 6byte, APCI
#define MAX_ASDU_LENGTH 249
#define YX_STAT_OPEND 0 // 开关状态: 0--开闸
#define YX_STAT_CLOSE 1 // 开关状态: 1--合闸
// 心跳
#define CMD_ACTIVE_PACKAGE "\x68\x04\x40\x00\x00\x00"
class CIEC104
{
public:
CIEC104() ;
~CIEC104() ;
private:
protected:
};
void IEC104EnvFree();
void IEC104EnvLoad();
void UpdateLastTime();
void *thread_listen_proc(void *arg);
void *thread_client_proc(void *arg);
void *thread_warn_proc(void *arg);
void * thread_pingce_proc(void * arg);
void *thread_recv_proc(void *arg) ;
void *thread_active_proc(void *arg);
void *thread_parser_proc(void *arg);
void *thread_Timer_proc(void *arg);
void *thread_cache_proc(void *arg) ; // 同步内存数据线程
//void *thread_setdb_proc(void *arg); // 数据入库线程
//void *thread_getdata_proc(void *arg);
void *thread_origin_proc(void *arg); // 原始数据入库现场
void *thread_origin_proc_new(void *arg); // 原始数据入库现场
void *thread_busi_data_proc(void* arg);
void *thread_gis_hold_proc(void * arg);
// 刷新机组的工作状态,1发电、2抽水、3空闲
unsigned char getDevWorkState(ST_IECPOINT_TABLE &stIec);
unsigned char getDevFaultState(ST_IECPOINT_TABLE &stIec);
//
////// 获取BYQ设备对应关系及阈值
//bool bGetByqCacheRelation(unsigned char *pszSersorid, ST_BYQ_CACHE *pstData);
////
////// 获取GIS设备对应关系及阈值
//bool bGetGisCacheRelation(unsigned char *pszSersorid, ST_GIS_CACHE *pstData);
////
////// 获取BLQ设备对应关系及阈值
//bool bGetBlqCacheRelation(unsigned char *pszSersorid, ST_BLQ_CACHE *pstData);
bool bSetBYQPointValueByAddr(const char *pszEqmCode, float value);
#ifdef __cplusplus
}
#endif
#endif // end