2024-07-08 10:27:17 +08:00
|
|
|
#ifndef _ZJD_M_PROCESS_H_
|
|
|
|
#define _ZJD_M_PROCESS_H_
|
|
|
|
|
|
|
|
#include "public.h"
|
|
|
|
#include "ycbw.h"
|
|
|
|
#include "yxbw.h"
|
|
|
|
|
|
|
|
class CProcessItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int m_uid;
|
|
|
|
public:
|
|
|
|
CProcessItem();
|
|
|
|
virtual ~CProcessItem();
|
|
|
|
virtual void Attach(int uid, int sock = -1, DWORD peer_addr = 0, WORD peer_port = 0);
|
|
|
|
virtual void Release(void);
|
|
|
|
inline int GetUnitID(void) const
|
|
|
|
{
|
|
|
|
return m_uid;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
class CProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int m_nProcess;
|
|
|
|
private:
|
|
|
|
int m_nCurUnit;
|
|
|
|
int m_nOldUnit;
|
|
|
|
private:
|
|
|
|
BOOLEAN m_bUnitLoop;
|
|
|
|
pthread_t m_pid;
|
|
|
|
public:
|
|
|
|
BOOLEAN m_bRunFlag;
|
|
|
|
DWORD m_nRunTimeCount;
|
|
|
|
|
|
|
|
CProcessItem *m_pItems[PROCESS_UNIT_NUM];
|
|
|
|
public:
|
|
|
|
CProcess();
|
|
|
|
virtual ~CProcess();
|
|
|
|
|
|
|
|
BOOLEAN GetOption(void *pBuf, int size) const;
|
|
|
|
BOOLEAN GetUnitOption(int uid, void *pBuf, int size) const;
|
|
|
|
inline void FeedDog(void)
|
|
|
|
{
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return;
|
2024-12-30 17:20:28 +08:00
|
|
|
//config.processes[m_nProcess].softdog = 0;
|
|
|
|
config.processes[m_nProcess].real_softdog = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void FeedFTPDog(void)
|
|
|
|
{
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return;
|
|
|
|
//config.processes[m_nProcess].softdog = 0;
|
|
|
|
config.processes[m_nProcess].ftp_softdog = 0;
|
2024-07-08 10:27:17 +08:00
|
|
|
}
|
|
|
|
|
2024-10-15 14:10:59 +08:00
|
|
|
inline char* GetCurProcessName(void) const
|
2024-10-14 20:26:21 +08:00
|
|
|
{
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return NULL;
|
|
|
|
return config.processes[m_nProcess].name;
|
|
|
|
}
|
2024-12-04 13:48:25 +08:00
|
|
|
|
2024-10-15 14:10:59 +08:00
|
|
|
inline int GetCurID(void) const
|
|
|
|
{
|
|
|
|
return m_nProcess;
|
|
|
|
}
|
2024-10-14 20:26:21 +08:00
|
|
|
|
2024-07-08 10:27:17 +08:00
|
|
|
inline int GetCurOrder() const
|
|
|
|
{
|
|
|
|
int order;
|
|
|
|
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return -1;
|
|
|
|
if (m_nCurUnit < 0 || m_nCurUnit >= PROCESS_UNIT_NUM) return -1;
|
|
|
|
order = m_nCurUnit;
|
|
|
|
return order;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetOrderByUnitID(int uid) const;
|
|
|
|
|
|
|
|
inline int GetUnitID(int order) const
|
|
|
|
{
|
|
|
|
int uid;
|
|
|
|
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return -1;
|
|
|
|
if (order < 0 || order >= PROCESS_UNIT_NUM) return -1;
|
|
|
|
uid = config.processes[m_nProcess].units[order];
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
return uid;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetCurUnitID(void) const
|
|
|
|
{
|
|
|
|
int uid;
|
|
|
|
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return -1;
|
|
|
|
if (m_nCurUnit < 0 || m_nCurUnit >= PROCESS_UNIT_NUM) return -1;
|
|
|
|
uid = config.processes[m_nProcess].units[m_nCurUnit];
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
return uid;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline struUnit* GetCurUnit(void) const
|
|
|
|
{
|
|
|
|
int uid;
|
|
|
|
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return NULL;
|
|
|
|
if (m_nCurUnit < 0 || m_nCurUnit >= PROCESS_UNIT_NUM) return NULL;
|
|
|
|
uid = config.processes[m_nProcess].units[m_nCurUnit];
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return NULL;
|
|
|
|
if ((config.units[uid].state & 0x01) != TRUE) return NULL;
|
|
|
|
return &config.units[uid];
|
|
|
|
}
|
|
|
|
|
|
|
|
struUnit* GetNextUnit(void);
|
|
|
|
inline struUnit* GetUnitByOrder(int order)
|
|
|
|
{
|
|
|
|
int uid;
|
|
|
|
|
|
|
|
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return NULL;
|
|
|
|
if (order < 0 || order >= PROCESS_UNIT_NUM) return NULL;
|
|
|
|
uid = config.processes[m_nProcess].units[order];
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return NULL;
|
|
|
|
if ((config.units[uid].state & 0x01) != TRUE) return NULL;
|
|
|
|
m_nCurUnit = order;
|
|
|
|
return &config.units[uid];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BOOLEAN TestLoop(void)
|
|
|
|
{
|
|
|
|
if (m_bUnitLoop)
|
|
|
|
{
|
|
|
|
m_bUnitLoop = FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetUnitByAddr(BYTE* pAddr, int count) const;
|
|
|
|
BOOLEAN GetUnitAddr(int uid, BYTE* pAddr, int count) const;
|
|
|
|
|
|
|
|
inline void UnitFeedDog(int uid)
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
2024-12-30 17:20:28 +08:00
|
|
|
config.units[uid].real_softdog = 0;
|
|
|
|
}
|
|
|
|
inline void UnitFeedFTPDog(int uid)
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
config.units[uid].ftp_softdog = 0;
|
2024-07-08 10:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYXCount(int uid) const
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
return config.units[uid].yxcount;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYCCount(int uid) const
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
return config.units[uid].yccount;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYMCount(int uid) const
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
return config.units[uid].ymcount;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYKCount(int uid) const
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
return config.units[uid].ykcount;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYTCount(int uid) const
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
return config.units[uid].ytcount;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYXOrder(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (point < 0 || point >= pUnit->yxcount) return -1;
|
|
|
|
return pUnit->yxs[point].order;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYCOrder(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return -1;
|
|
|
|
return pUnit->ycs[point].order;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYMOrder(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (point < 0 || point >= pUnit->ymcount) return -1;
|
|
|
|
return pUnit->yms[point].order;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYKOrder(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (point < 0 || point >= pUnit->ykcount) return -1;
|
|
|
|
return pUnit->yks[point].order;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetUnitYTOrder(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (point < 0 || point >= pUnit->ytcount) return -1;
|
|
|
|
return pUnit->yts[point].order;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetUnitYXPointByParam(int uid, BYTE* pParam, int count) const;
|
|
|
|
int GetUnitYCPointByParam(int uid, BYTE* pParam, int count) const;
|
|
|
|
int GetUnitYMPointByParam(int uid, BYTE* pParam, int count) const;
|
|
|
|
int GetUnitYKPointByParam(int uid, BYTE* pParam, int count) const;
|
|
|
|
int GetUnitYTPointByParam(int uid, BYTE* pParam, int count) const;
|
|
|
|
|
|
|
|
inline BYTE* GetUnitYXParamByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return NULL;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->yxcount <= 0) return NULL;
|
|
|
|
if (point < 0 || point >= pUnit->yxcount) return NULL;
|
|
|
|
return pUnit->yxs[point].m_param;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BYTE* GetUnitYCParamByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return NULL;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->yccount <= 0) return NULL;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return NULL;
|
|
|
|
return pUnit->ycs[point].m_param;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BYTE* GetUnitYMParamByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return NULL;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->ymcount <= 0) return NULL;
|
|
|
|
if (point < 0 || point >= pUnit->ymcount) return NULL;
|
|
|
|
return pUnit->yms[point].m_param;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BYTE* GetUnitYKParamByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return NULL;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->ykcount <= 0) return NULL;
|
|
|
|
if (point < 0 || point >= pUnit->ykcount) return NULL;
|
|
|
|
return pUnit->yks[point].m_param;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BYTE* GetUnitYTParamByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return NULL;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->ytcount <= 0) return NULL;
|
|
|
|
if (point < 0 || point >= pUnit->ytcount) return NULL;
|
|
|
|
return pUnit->yts[point].m_param;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void SetUnitYX(int uid, int point, BYTE value, BOOLEAN bAddYXBW = TRUE, BYTE qds = 0)
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return;
|
|
|
|
if (point < 0 || point >= pUnit->yxcount) return;
|
|
|
|
udb = pUnit->yxs[point].order;
|
|
|
|
|
2024-08-09 08:50:19 +08:00
|
|
|
if (pUnit->yxs[point].invert) {
|
|
|
|
value = !value;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (udb < 0 || udb >= DATABASE_YX_NUM) { //遥信点号不在数据库定义范围内,只刷新单元数据
|
|
|
|
if (pUnit->yxs[point].value != value) { //update value
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->yxs[point].value = value;
|
|
|
|
pUnit->yxs[point].update_time = system32.timers;
|
|
|
|
pUnit->yxs[point].yxbw = TRUE;
|
2024-08-09 08:50:19 +08:00
|
|
|
if (bAddYXBW) {
|
2024-07-08 10:27:17 +08:00
|
|
|
yxbw.PushYXBW(system32.now, udb, value, qds, uid, point, YXBWT_AUTO);
|
|
|
|
}
|
|
|
|
}
|
2024-08-09 08:50:19 +08:00
|
|
|
} else if (database.yxs[udb].value != value) { //update value
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->yxs[point].value = value;
|
|
|
|
pUnit->yxs[point].yxbw = TRUE;
|
|
|
|
pUnit->yxs[point].update_time = system32.timers;
|
|
|
|
database.yxs[udb].value = value;
|
2024-08-09 08:50:19 +08:00
|
|
|
database.yxs[udb].bw_time = system32.timers; //设置刷新时间
|
|
|
|
database.yxs[udb].update_time = system32.timers; //设置刷新时间
|
2024-07-08 10:27:17 +08:00
|
|
|
database.yxs[udb].op_unit = uid;
|
|
|
|
database.yxs[udb].qds = qds;
|
2024-08-09 08:50:19 +08:00
|
|
|
if (bAddYXBW) {
|
2024-07-08 10:27:17 +08:00
|
|
|
yxbw.PushYXBW(system32.now, udb, value, qds, uid, point, YXBWT_AUTO);
|
|
|
|
}
|
2024-08-09 08:50:19 +08:00
|
|
|
} else {
|
|
|
|
if (pUnit->yxs[point].value != value) {
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->yxs[point].value = value;
|
|
|
|
pUnit->yxs[point].update_time = system32.timers;
|
|
|
|
//若数据库中的遥信位置是正确的则不额外产生变位信息
|
|
|
|
pUnit->yxs[point].yxbw = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pUnit->yxs[point].qds = qds;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BYTE GetUnitYX(int uid, int point) const
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
BOOLEAN value;
|
|
|
|
struUnit* pUnit;
|
|
|
|
struUnitYX* pYX;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return 0;
|
|
|
|
if (point < 0 || point >= pUnit->yxcount) return 0;
|
|
|
|
pYX = &pUnit->yxs[point];
|
|
|
|
udb = pYX->order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YX_NUM)
|
|
|
|
{
|
|
|
|
value = pYX->value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value = database.yxs[udb].value;
|
|
|
|
pYX->value = value;
|
|
|
|
pYX->update_time = database.yxs[udb].update_time;
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BYTE GetUnitYXQDS(int uid, int point) const
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
BYTE qds;
|
|
|
|
struUnit* pUnit;
|
|
|
|
struUnitYX* pYX;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return 0;
|
|
|
|
if (point < 0 || point >= pUnit->yxcount) return 0;
|
|
|
|
pYX = &pUnit->yxs[point];
|
|
|
|
udb = pYX->order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YX_NUM)
|
|
|
|
{
|
|
|
|
qds = pYX->qds; //((pYX->bl << 4) | (pYX->sb << 5) | (pYX->nt << 6) | (pYX->iv << 7));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
qds = database.yxs[udb].qds;//((database.yxs[udb].bl << 4) | (database.yxs[udb].sb << 5) | (database.yxs[udb].nt << 6) | (database.yxs[udb].iv << 7));
|
|
|
|
pYX->qds = qds;
|
|
|
|
}
|
|
|
|
return qds;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetUnitYXBW(int uid, int point, BYTE value, unionCP56Time& st, int type);
|
|
|
|
int GetUnitYXBW(int uid, BYTE& value, BYTE& qds) const;
|
|
|
|
int GetUnitYXBW(int uid, BYTE& value, BYTE& qds, int& type, unionCP56Time& st) const;
|
|
|
|
void ClearUnitYXBW(int uid);
|
|
|
|
|
|
|
|
void SetUnitSOE(int uid, int point, BOOLEAN value, unionCP56Time& st);
|
|
|
|
int GetUnitSOE(int uid, BYTE& value, BYTE& qds, unionCP56Time& st) const;
|
|
|
|
|
|
|
|
inline void SetUnitYC(int uid, int point, LONG value, BYTE qds = 0, BOOLEAN bAddYCBW = TRUE)
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return;
|
|
|
|
udb = pUnit->ycs[point].order;
|
|
|
|
|
2024-08-09 08:50:19 +08:00
|
|
|
if (udb < 0 || udb >= DATABASE_YC_NUM) { //遥测点号不在数据库定义范围内,只刷新本单元数据
|
|
|
|
if (pUnit->ycs[point].value != value) { //update value
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].value = value;
|
|
|
|
pUnit->ycs[point].update_time = system32.timers;
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
}
|
2024-08-09 08:50:19 +08:00
|
|
|
} else if (database.ycs[udb].value != value) { //update value
|
2024-09-24 15:59:22 +08:00
|
|
|
//此处增加越线判断
|
2024-10-29 12:52:52 +08:00
|
|
|
float coef = pUnit->ycs[point].coef;
|
|
|
|
float base = pUnit->ycs[point].base;
|
|
|
|
float fValue = (float)((float)value * coef + base);
|
2024-09-24 15:59:22 +08:00
|
|
|
if (pUnit->ycs[point].limit1Enable) {
|
2024-10-29 12:52:52 +08:00
|
|
|
if (fValue > pUnit->ycs[point].limit1High) { //越上限
|
|
|
|
if (!pUnit->ycs[point].ycbw) {
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
ycbw.PushYCBW(system32.now, udb, value, qds, uid, point, 1);
|
|
|
|
}
|
|
|
|
} else if (fValue < pUnit->ycs[point].limit1Low) { //越下限
|
|
|
|
if (!pUnit->ycs[point].ycbw) {
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
ycbw.PushYCBW(system32.now, udb, value, qds, uid, point, 2);
|
|
|
|
}
|
|
|
|
} else { //不越限
|
|
|
|
if (pUnit->ycs[point].ycbw) {
|
|
|
|
pUnit->ycs[point].ycbw = FALSE;
|
|
|
|
ycbw.PushYCBW(system32.now, udb, value, qds, uid, point, 5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//默认二级越限必须大于一级越限
|
|
|
|
if (pUnit->ycs[point].limit2Enable) {
|
|
|
|
if (fValue > pUnit->ycs[point].limit2High) { //越上限
|
|
|
|
if (!pUnit->ycs[point].ycbw) {
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
ycbw.PushYCBW(system32.now, udb, value, qds, uid, point, 3);
|
|
|
|
}
|
|
|
|
} else if (fValue < pUnit->ycs[point].limit2Low) { //越下限
|
|
|
|
if (!pUnit->ycs[point].ycbw) {
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
ycbw.PushYCBW(system32.now, udb, value, qds, uid, point, 4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-09-24 15:59:22 +08:00
|
|
|
}
|
2024-10-29 12:52:52 +08:00
|
|
|
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].value = value;
|
|
|
|
pUnit->ycs[point].update_time = system32.timers;
|
2024-10-29 12:52:52 +08:00
|
|
|
#if 0
|
2024-08-09 08:50:19 +08:00
|
|
|
if (pUnit->ycs[point].change_pos >= 0 && bAddYCBW) {
|
|
|
|
if (abs(pUnit->ycs[point].value - database.ycs[udb].value) >= pUnit->ycs[point].change_pos) { //40码值变化量认为是遥测变位
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
ycbw.PushYCBW(system32.now, udb, value, qds, uid, point, YCBWT_AUTO);
|
|
|
|
}
|
|
|
|
}
|
2024-10-29 12:52:52 +08:00
|
|
|
#endif
|
2024-07-08 10:27:17 +08:00
|
|
|
database.ycs[udb].value = value;
|
|
|
|
database.ycs[udb].op_unit = uid;
|
|
|
|
database.ycs[udb].update_time = system32.timers; //设置刷新时间
|
|
|
|
database.ycs[udb].qds = qds;
|
2024-08-09 08:50:19 +08:00
|
|
|
} else {
|
|
|
|
if (pUnit->ycs[point].value != value) {
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].value = value;
|
|
|
|
pUnit->ycs[point].update_time = system32.timers;
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pUnit->ycs[point].qds = qds;
|
|
|
|
}
|
|
|
|
inline void SetUnitYC(int uid, int point, float value, BYTE qds = 0, BOOLEAN bAddYCBW = TRUE)
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
LONG nvalue;
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return;
|
|
|
|
udb = pUnit->ycs[point].order;
|
2024-09-24 15:59:22 +08:00
|
|
|
nvalue = (LONG)(pUnit->ycs[point].factor * value);
|
2024-07-08 10:27:17 +08:00
|
|
|
|
2024-08-09 08:50:19 +08:00
|
|
|
if (udb < 0 || udb >= DATABASE_YC_NUM) { //遥测点号不在数据库定义范围内,只刷新本单元数据
|
|
|
|
if (pUnit->ycs[point].value != nvalue) { //update value
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].value = nvalue;
|
|
|
|
pUnit->ycs[point].update_time = system32.timers;
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
}
|
2024-08-09 08:50:19 +08:00
|
|
|
} else if (database.ycs[udb].value != nvalue) { //update value
|
2024-09-24 15:59:22 +08:00
|
|
|
//此处增加越线判断
|
|
|
|
if (pUnit->ycs[point].limit1Enable) {
|
|
|
|
|
|
|
|
}
|
|
|
|
if (pUnit->ycs[point].limit2Enable) {
|
|
|
|
|
|
|
|
}
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].value = nvalue;
|
|
|
|
pUnit->ycs[point].update_time = system32.timers;
|
2024-10-29 12:52:52 +08:00
|
|
|
#if 0
|
2024-08-09 08:50:19 +08:00
|
|
|
if (pUnit->ycs[point].change_pos >= 0 && bAddYCBW) {
|
|
|
|
if (abs(pUnit->ycs[point].value - database.ycs[udb].value) >= pUnit->ycs[point].change_pos) { //40码值变化量认为是遥测变位
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
ycbw.PushYCBW(system32.now, udb, nvalue, qds, uid, point, YCBWT_AUTO);
|
|
|
|
}
|
|
|
|
}
|
2024-10-29 12:52:52 +08:00
|
|
|
#endif
|
2024-07-08 10:27:17 +08:00
|
|
|
database.ycs[udb].value = nvalue;
|
|
|
|
database.ycs[udb].op_unit = uid;
|
|
|
|
database.ycs[udb].update_time = system32.timers; //设置刷新时间
|
|
|
|
database.ycs[udb].qds = qds;
|
2024-08-09 08:50:19 +08:00
|
|
|
} else {
|
|
|
|
if (pUnit->ycs[point].value != nvalue) {
|
2024-07-08 10:27:17 +08:00
|
|
|
pUnit->ycs[point].value = nvalue;
|
|
|
|
pUnit->ycs[point].update_time = system32.timers;
|
|
|
|
pUnit->ycs[point].ycbw = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pUnit->ycs[point].qds = qds;
|
|
|
|
}
|
|
|
|
|
2024-09-24 15:59:22 +08:00
|
|
|
void SetUnitYCBW(int uid, int point, LONG value, unionCP56Time& st, int type)
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
BYTE qds;
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return;
|
|
|
|
udb = pUnit->ycs[point].order;
|
|
|
|
qds = GetUnitYCQDS(uid, point);
|
|
|
|
ycbw.PushYCBW(st, udb, value, qds, uid, point, type);
|
|
|
|
}
|
|
|
|
void SetUnitYCBW(int uid, int point, float flVal, unionCP56Time& st, int type)
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
BYTE qds;
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return;
|
|
|
|
udb = pUnit->ycs[point].order;
|
|
|
|
qds = GetUnitYCQDS(uid, point);
|
|
|
|
LONG value = (LONG)(pUnit->ycs[point].factor * flVal);
|
|
|
|
ycbw.PushYCBW(st, udb, value, qds, uid, point, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-07-08 10:27:17 +08:00
|
|
|
inline LONG GetUnitYC(int uid, int order) const
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
LONG value;
|
|
|
|
struUnit* pUnit;
|
|
|
|
struUnitYC* pYC;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return 0;
|
|
|
|
if (order < 0 || order >= pUnit->yccount) return 0;
|
|
|
|
pYC = &pUnit->ycs[order];
|
|
|
|
udb = pYC->order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YC_NUM)
|
|
|
|
{
|
|
|
|
value = pYC->value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value = database.ycs[udb].value;
|
|
|
|
pYC->value = value;
|
|
|
|
pYC->update_time = database.ycs[udb].update_time;
|
|
|
|
pYC->qds = database.ycs[udb].qds;
|
|
|
|
}
|
2024-08-09 08:50:19 +08:00
|
|
|
if (pYC->factor > 1 && (pUnit->type & 0x0f) == 0x00)
|
2024-07-08 10:27:17 +08:00
|
|
|
{ //系数有效,且为转发单元
|
|
|
|
value /= pYC->factor;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BYTE GetUnitYCQDS(int uid, int order) const
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
BYTE qds;
|
|
|
|
struUnit* pUnit;
|
|
|
|
struUnitYC* pYC;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0xff;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return 0xff;
|
|
|
|
pYC = &pUnit->ycs[order];
|
|
|
|
udb = pYC->order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YC_NUM)
|
|
|
|
{
|
|
|
|
qds = pYC->qds;//((pYC->bl << 4) | (pYC->sb << 5) | (pYC->nt << 6) | (pYC->iv << 7) | pYC->ov);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
qds = database.ycs[udb].qds;//((database.ycs[udb].bl << 4) | (database.ycs[udb].sb << 5) | (database.ycs[udb].nt << 6) | (database.ycs[udb].iv << 7) | database.ycs[udb].ov);
|
|
|
|
pYC->qds = qds;
|
|
|
|
}
|
|
|
|
|
|
|
|
return qds;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline float GetUnitYCReal(int uid, int order) const
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
long value;
|
|
|
|
float coef;
|
|
|
|
float base;
|
|
|
|
struUnit* pUnit;
|
|
|
|
struUnitYC* pYC;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return 0;
|
|
|
|
if (order < 0 || order >= pUnit->yccount) return 0;
|
|
|
|
pYC = &pUnit->ycs[order];
|
|
|
|
udb = pYC->order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YC_NUM)
|
|
|
|
{
|
|
|
|
value = pYC->value;
|
|
|
|
coef = 1.0f;
|
|
|
|
base = 0.0f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value = database.ycs[udb].value;
|
|
|
|
coef = pYC->coef;
|
|
|
|
base = pYC->base;
|
|
|
|
pYC->value = value;
|
|
|
|
pYC->update_time = database.ycs[udb].update_time;
|
|
|
|
pYC->qds = database.ycs[udb].qds;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (float)((float)value * coef + base);
|
|
|
|
}
|
|
|
|
int GetUnitYCBW(int uid, LONG& value, BYTE& qds, int& type, unionCP56Time& st) const;
|
|
|
|
void ClearUnitYCBW(int uid);
|
|
|
|
float GetUnitYCRealFromValue(int uid, int point, long value) const;
|
|
|
|
float GetUnitYCCoef(int uid, int point) const;
|
|
|
|
float GetUnitYCBase(int uid, int order) const;
|
|
|
|
inline void ClearUnitYCBW(int uid, int point)
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return;
|
|
|
|
|
|
|
|
if (TRUE == pUnit->ycs[point].ycbw)
|
|
|
|
{
|
|
|
|
pUnit->ycs[point].ycbw = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BOOLEAN IsUnitYCBW(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return FALSE;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return FALSE;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return FALSE;
|
|
|
|
return pUnit->ycs[point].ycbw;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QLONG GetProcessIRNByPid(int pid) const
|
|
|
|
{
|
|
|
|
if (pid < 0 || pid >= PROCESSES_NUM) return -1;
|
|
|
|
return config.processes[pid].irn;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QLONG GetUnitIRNByUid(int uid) const
|
|
|
|
{
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
return config.units[uid].irn;
|
|
|
|
}
|
|
|
|
int GetProcessIDByIRN(QLONG IRN) const;
|
|
|
|
int GetUnitYXPointByIRN(int uid, QLONG IRN) const;
|
|
|
|
int GetUnitYCPointByIRN(int uid, QLONG IRN) const;
|
|
|
|
int GetUnitYMPointByIRN(int uid, QLONG IRN) const;
|
|
|
|
int GetUnitYKPointByIRN(int uid, QLONG IRN) const;
|
|
|
|
int GetUnitYTPointByIRN(int uid, QLONG IRN) const;
|
|
|
|
inline QLONG GetUnitYXIRNByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->yxcount <= 0) return -1;
|
|
|
|
if (point < 0 || point >= pUnit->yxcount) return -1;
|
|
|
|
return pUnit->yxs[point].irn;
|
|
|
|
}
|
|
|
|
inline QLONG GetUnitYCIRNByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->yccount <= 0) return -1;
|
|
|
|
if (point < 0 || point >= pUnit->yccount) return -1;
|
|
|
|
return pUnit->ycs[point].irn;
|
|
|
|
}
|
|
|
|
inline QLONG GetUnitYMIRNByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->ymcount <= 0) return -1;
|
|
|
|
if (point < 0 || point >= pUnit->ymcount) return -1;
|
|
|
|
return pUnit->yms[point].irn;
|
|
|
|
}
|
|
|
|
inline QLONG GetUnitYKIRNByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->ykcount <= 0) return -1;
|
|
|
|
if (point < 0 || point >= pUnit->ykcount) return -1;
|
|
|
|
return pUnit->yks[point].irn;
|
|
|
|
}
|
|
|
|
inline QLONG GetUnitYTIRNByPoint(int uid, int point) const
|
|
|
|
{
|
|
|
|
struUnit* pUnit;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return -1;
|
|
|
|
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if (pUnit->ytcount <= 0) return -1;
|
|
|
|
if (point < 0 || point >= pUnit->ytcount) return -1;
|
|
|
|
return pUnit->yts[point].irn;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void SetUnitYM(int uid, int order, DWORD value)
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return;
|
|
|
|
if (order < 0 || order >= pUnit->ymcount) return;
|
|
|
|
pUnit->yms[order].value = value;
|
|
|
|
pUnit->yms[order].update_time = system32.timers;
|
|
|
|
udb = pUnit->yms[order].order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YM_NUM) return;
|
|
|
|
database.yms[udb].value = value;
|
|
|
|
database.yms[udb].update_time = system32.timers; //设置刷新时间
|
|
|
|
database.yms[udb].op_unit = uid;
|
2024-08-09 08:50:19 +08:00
|
|
|
}
|
|
|
|
|
2024-07-08 10:27:17 +08:00
|
|
|
inline DWORD GetUnitYM(int uid, int order) const
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
struUnit* pUnit;
|
|
|
|
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return 0;
|
|
|
|
if (order < 0 || order >= pUnit->ymcount) return 0;
|
|
|
|
udb = pUnit->yms[order].order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YM_NUM) return 0;
|
|
|
|
pUnit->yms[order].value = database.yms[udb].value;
|
|
|
|
pUnit->yms[order].update_time = database.yms[udb].update_time;
|
|
|
|
return database.yms[udb].value;
|
2024-08-09 08:50:19 +08:00
|
|
|
}
|
|
|
|
|
2024-07-08 10:27:17 +08:00
|
|
|
void SetUnitYMQDS(int uid, int point, BYTE qds);
|
|
|
|
BYTE GetUnitYMQDS(int uid, int point) const;
|
|
|
|
inline float GetUnitYMReal(int uid, int order) const
|
|
|
|
{
|
|
|
|
int udb;
|
|
|
|
long value;
|
|
|
|
float coef;
|
|
|
|
float base;
|
|
|
|
struUnit* pUnit;
|
|
|
|
struUnitYM* pYM;
|
|
|
|
if (uid < 0 || uid >= UNIT_NUM) return 0;
|
|
|
|
pUnit = &config.units[uid];
|
|
|
|
if ((pUnit->state & 0x01) != TRUE) return 0;
|
|
|
|
if (order < 0 || order >= pUnit->ymcount) return 0;
|
|
|
|
pYM = &pUnit->yms[order];
|
|
|
|
udb = pYM->order;
|
|
|
|
if (udb < 0 || udb >= DATABASE_YM_NUM)
|
|
|
|
{
|
|
|
|
value = pYM->value;
|
|
|
|
coef = 1.0f;
|
|
|
|
base = 0.0f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value = (long)database.yms[udb].value;
|
|
|
|
pYM->update_time = database.yms[udb].update_time;
|
|
|
|
coef = pYM->coef;
|
|
|
|
base = pYM->base;
|
|
|
|
pYM->value = value;
|
|
|
|
}
|
|
|
|
return (float)(value * coef + base);
|
|
|
|
};
|
|
|
|
float GetUnitYMRealFromValue(int uid, int point, DWORD value) const;
|
|
|
|
float GetUnitYMCoef(int uid, int order) const;
|
|
|
|
float GetUnitYMBase(int uid, int order) const;
|
|
|
|
|
|
|
|
virtual BOOLEAN GetUnitYK(int uid, BOOLEAN bAsSalve = TRUE);
|
|
|
|
virtual BOOLEAN GetUnitYK(int uid, int& point, BYTE& value, BYTE& act, BYTE& result, BOOLEAN bAsSlave = TRUE);
|
|
|
|
virtual void SetUnitYK(int uid, int point, BYTE value, BYTE act, BYTE result, BOOLEAN bAsSlave = TRUE);
|
|
|
|
|
|
|
|
virtual BOOLEAN GetUnitYT(int uid, BOOLEAN bAsSlave = TRUE);
|
|
|
|
virtual BOOLEAN GetUnitYT(int uid, int& point, DWORD& value, BYTE& act, BYTE& result, BOOLEAN bAsSlave = TRUE);
|
|
|
|
virtual void SetUnitYT(int uid, int point, DWORD value, BYTE act, BYTE result, BOOLEAN bAsSlave = TRUE);
|
|
|
|
|
|
|
|
virtual BOOLEAN FetchUnitYX(int order);
|
|
|
|
virtual BOOLEAN FetchUnitYC(int order);
|
|
|
|
virtual BOOLEAN FetchUnitYM(int order);
|
|
|
|
|
|
|
|
void DisplayRxData(BYTE* pBuf, int count, BOOLEAN bCheck, int uid = -1, BOOLEAN bPackage = TRUE);
|
|
|
|
void DisplayTxData(BYTE* pBuf, int count, BOOLEAN bCheck, int uid = -1, BOOLEAN bPackage = TRUE);
|
|
|
|
|
|
|
|
BYTE GetCRC8(BYTE* pBuf, int count);
|
|
|
|
WORD GetCRC16(BYTE* pBuf, int count);
|
|
|
|
BYTE GetCheckSum8(BYTE* pBuf, int count);
|
|
|
|
WORD GetCheckSum16(BYTE* pBuf, int count);
|
|
|
|
BYTE GetCheckLRC(BYTE* pBuf, int count);
|
|
|
|
BYTE GetLRC1(const BYTE* pBuf, int count);
|
|
|
|
|
|
|
|
inline int GetID(void) const
|
|
|
|
{
|
|
|
|
return m_nProcess;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline BOOLEAN IsSlave(void) const
|
|
|
|
{
|
|
|
|
return (config.processes[m_nProcess].mode == PROCESS_MODE_SLAVE);
|
|
|
|
};
|
|
|
|
inline BOOLEAN IsMaster(void) const
|
|
|
|
{
|
|
|
|
return (config.processes[m_nProcess].mode == PROCESS_MODE_MASTER);
|
|
|
|
};
|
|
|
|
inline BOOLEAN IsDuplex(void) const
|
|
|
|
{
|
|
|
|
return (config.processes[m_nProcess].mode == PROCESS_MODE_DUPLEX);
|
|
|
|
};
|
|
|
|
inline BOOLEAN IsAcceptTime(void) const
|
|
|
|
{
|
|
|
|
return config.processes[m_nProcess].time_accept;
|
|
|
|
};
|
|
|
|
inline int SetTimeGap(void) const
|
|
|
|
{
|
|
|
|
int gap = config.processes[m_nProcess].time_gap;
|
|
|
|
gap = gap * TIME_BASE;
|
|
|
|
return gap;
|
|
|
|
};
|
|
|
|
inline int GetSetTimeGap(void) const
|
|
|
|
{
|
|
|
|
return config.processes[m_nProcess].time_gap;
|
|
|
|
};
|
|
|
|
inline int PollGap(void) const
|
|
|
|
{
|
|
|
|
return config.processes[m_nProcess].poll_gap;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual BOOLEAN OnPreCreate(int id);
|
|
|
|
virtual BOOLEAN Create(int id);
|
|
|
|
virtual BOOLEAN OnCreated(int id);
|
|
|
|
virtual void Destroy(void);
|
|
|
|
|
|
|
|
virtual BOOLEAN Run(void);
|
|
|
|
virtual BOOLEAN OnTimer(void);
|
|
|
|
|
|
|
|
virtual int OnPackageReceived(BYTE* pBuf, int count, int uid = -1);
|
|
|
|
|
|
|
|
virtual CProcessItem* CreateItem(int ord);
|
|
|
|
virtual void DestroyItem(int ord, BOOLEAN bDeleted = FALSE);
|
|
|
|
inline virtual CProcessItem* GetItem(int ord) const
|
|
|
|
{
|
|
|
|
if (ord < 0 || ord >= PROCESS_UNIT_NUM)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return m_pItems[ord];
|
|
|
|
};
|
|
|
|
inline virtual CProcessItem* GetCurItem(void) const
|
|
|
|
{
|
|
|
|
return GetItem(GetCurOrder());
|
|
|
|
};
|
|
|
|
inline virtual CProcessItem* GetNextItem(void)
|
|
|
|
{
|
|
|
|
GetNextUnit();
|
|
|
|
return GetCurItem();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //_ZJD_M_PROCESS_H_
|