| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796 |
- // UpsKeHua.cpp: implementation of the CUpsKeHua class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "UpsKeHua.h"
- #include "CommProcess.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CUpsKeHua::CUpsKeHua(
- char szPath[MAX_PATH], // 程序所在路径
- char szIniName[MAX_PATH], // 配置文件名称
- int nCommPort, // 串行端口
- int nAddr, // 设备地址
- int nRate, // 波特率
- int nDataBit, // 数据位
- int nStopBit, // 停止位
- int nParity, // 校验位
- int nInterval // 时间间隔
- )
- {
- #if IS_USE_READMSG_CS
- InitializeCriticalSection( &m_csReadMsg ); //初始化一个临界资源对象
- #endif
- MTVERIFY( m_hSemComm = CreateEvent( NULL, TRUE, TRUE, 0 ) ); //CreateEvent()创建或打开一个命名的或无名的事件对象
- memset(m_szKeHua_Q1Msg, 0, sizeof(m_szKeHua_Q1Msg));
- memset(m_szKeHua_G1Msg, 0, sizeof(m_szKeHua_G1Msg));
- memset(m_szKeHua_G2Msg, 0, sizeof(m_szKeHua_G2Msg));
- memset(m_szKeHua_G3Msg, 0, sizeof(m_szKeHua_G3Msg));
- memset(m_szKeHua_GFMsg, 0, sizeof(m_szKeHua_GFMsg));
- m_devOnline = TRUE;
- m_dwOnlineTick = 0;
- }
- CUpsKeHua::~CUpsKeHua()
- {
- #if IS_USE_READMSG_CS
- DeleteCriticalSection( &m_csReadMsg );
- #endif
- MTVERIFY( CloseHandle( m_hSemComm ) );
- CloseComm();
- }
- BOOL CUpsKeHua::UpsKeHuaOpenComm(int nCommPort, int nAddr, int nRate, int nDataBit, int nStopBit, int nParity, int nInterval)
- {
- BOOL bResult = FALSE;
- bResult = OpenComm( nCommPort, nAddr, nRate, nDataBit, nStopBit, nParity, nInterval );
- return bResult;
- }
- // 发送读取设备参数请求
- int CUpsKeHua::SendReadRequest(
- char szPath[MAX_PATH], // 程序所在路径
- char szIniName[MAX_PATH], // 配置文件名称
- int nCommPort, // 串行端口
- int nAddr, // 设备地址
- char szCmd[MAX_CMD], // 请求命令
- char szMsg[VAR_MSG], // 响应的值
- int nReversed1, // 预留整形参数1接口
- int nReversed2, // 预留整形参数2接口
- int nReversed3, // 预留整形参数3接口
- int nReversed4, // 预留整形参数4接口
- int nReversed5, // 预留整形参数5接口
- float fReversed1, // 预留float参数1接口
- float fReversed2, // 预留float参数2接口
- float fReversed3, // 预留float参数3接口
- char szReversed1[MAX_RESERVED1], // 预留字符数组参数1接口
- char szReversed2[MAX_RESERVED2], // 预留字符数组参数2接口
- char szReversed3[MAX_RESERVED3], // 预留字符数组参数3接口
- char szReversed4[MAX_RESERVED4], // 预留字符数组参数4接口
- char szReversed5[MAX_RESERVED5] // 预留字符数组参数5接口
- )
- {
- int nIndex = 0, nLen = 0;
- char szSendMsg[UPS_KEHUA_SEND_MSG] = {0};
- char szType[TYPE_LENGTH] = {0};
- GetFromIni(szPath, szIniName, szCmd, szSendMsg, nIndex, nLen, szType);
- CCommProcess *pComm = FindComm(nCommPort);
- if( pComm == NULL ) return -1;
- int nRet = -1;
- if( strlen(m_szKeHua_Q1Msg) == 0 ||
- strlen(m_szKeHua_G1Msg) == 0 ||
- strlen(m_szKeHua_G3Msg) == 0 ||
- strlen(m_szKeHua_GFMsg) == 0 ||
- strlen(m_szKeHua_G2Msg) == 0 ||
- strcmp(szCmd, "cmd-1") == 0 ||
- strcmp(szCmd, "cmd-14") == 0 ||
- strcmp(szCmd, "cmd-20") == 0 ||
- strcmp(szCmd, "cmd-32") == 0 ||
- strcmp(szCmd, "cmd-34") == 0
- )
- {
- int nRet = GetDeviceParam( pComm, szSendMsg, szCmd, szMsg, nIndex, nLen, szType );
- if( nRet != 0 )
- {
- return nRet;
- }
- }
- if( GetTickCount() - m_dwOnlineTick > 60 *1000 && m_dwOnlineTick > 0 )
- {
- m_devOnline = FALSE;
- }
- else if( GetTickCount() - m_dwOnlineTick < 60 *1000 && m_dwOnlineTick > 0 )
- {
- m_devOnline = TRUE;
- }
- if( m_devOnline == FALSE )
- {
- return -1;
- }
- nRet = GetKeHuaQ1VarMsg(szCmd, szMsg, nIndex, nLen, szType);
- nRet = GetKeHuaG1VarMsg(szCmd, szMsg, nIndex, nLen, szType);
-
- nRet = GetKeHuaG3VarMsg(szCmd, szMsg, nIndex, nLen, szType);
- nRet = GetKeHuaGFVarMsg(szCmd, szMsg, nIndex, nLen, szType);
- nRet = GetKeHuaG2VarMsg(szCmd, szMsg, nIndex, nLen, szType);
-
- return nRet;
- }
- int CUpsKeHua::RequestStatus(
- CCommProcess *pComm, //串口对象指针
- char chSendMsg[UPS_KEHUA_SEND_MSG] //发送Buffer
- )
- {
- #if DEBUG_UPS_KEHUA_U
- if( WaitForSingleObject( m_hSemComm, 0 ) == WAIT_OBJECT_0 ) // 有信号才写串口
- {
- int nDataLen = (int)strlen(chSendMsg);
- ResetEvent( m_hSemComm );
- int nResult = pComm->Write((unsigned char *)chSendMsg, nDataLen);
- if( nResult == nDataLen )
- {
- }
- else
- {
- SetEvent( m_hSemComm );
- return ERR_CODE_KEHUA_COM_WRITE_DATA;
- }
- }
- else
- {
- return ERR_CODE_KEHUA_COM_BUSY;
- }
- #endif
- return 0;
- }
- int CUpsKeHua::ResponseStatus(
- CCommProcess *pComm, //串口对象指针
- char szCmd[MAX_CMD], // 命令
- char szMsg[VAR_MSG], // 接收Buffer
- int &nIndex, // 变量索引,针对接收Buffer而言
- int &nLen, // 变量长度
- char szType[TYPE_LENGTH] // 变量数据类型
- )
- {
- #if DEBUG_UPS_KEHUA_U
- int nReceiveLen = 0;
- int nProcessLen = 0;
- int nReadLen = 0;
- RESPONSE_STRUCT structResponse;
- memset( &structResponse, 0, sizeof(RESPONSE_STRUCT) );
-
- nReceiveLen = sizeof(RESPONSE_STRUCT);
- char *pBuffer = new char[ nReceiveLen ];
- memset(pBuffer, 0, nLen);
- nReadLen = pComm->Read((BYTE *)pBuffer, nReceiveLen);
- if( nReadLen <= 0)
- {
- // 串口没有读到数据
- TRACE("串口没有读到数据!\r\n");
- SetEvent( m_hSemComm );
- if( pBuffer != NULL)
- {
- delete[] pBuffer;
- pBuffer = NULL;
- }
- return ERR_CODE_COM_READ_NO_DATA;
- }
- SetKeHuaG1VarMsg(szCmd, pBuffer);
- SetKeHuaG2VarMsg(szCmd, pBuffer);
- SetKeHuaG3VarMsg(szCmd, pBuffer);
- SetKeHuaQ1VarMsg(szCmd, pBuffer);
- SetKeHuaGFVarMsg(szCmd, pBuffer);
- m_dwOnlineTick = GetTickCount();
- // 设置串口等待事件为有信号
- SetEvent( m_hSemComm );
- if( pBuffer != NULL)
- {
- delete[] pBuffer;
- pBuffer = NULL;
- }
- #else
- SimulationCommData();
- #endif
- return 0;
- }
- int CUpsKeHua::GetDeviceParam(
- CCommProcess *pComm, //串口对象指针
- char szSendMsg[UPS_KEHUA_SEND_MSG], //发送Buffer
- char szCmd[MAX_CMD], // 命令
- char szMsg[VAR_MSG], // 接收Buffer
- int &nIndex, // 变量索引,针对接收Buffer而言
- int &nLen, // 变量长度
- char szType[TYPE_LENGTH]) // 变量数据类型
- {
- int nRet = -1;
- nRet = RequestStatus(pComm, szSendMsg);
- if( nRet != 0 )
- {
- return nRet; // 串口忙
- }
- nRet = ResponseStatus(pComm, szCmd, szMsg, nIndex, nLen, szType);
- return nRet;
- }
- //读取配置文件
- int CUpsKeHua::GetFromIni(
- char szPath[MAX_PATH], //服务器程序所在目录
- char szIniName[MAX_PATH], //配置文件名
- char szCmd[MAX_CMD], //命令
- char szUpsKeHuaSendMsg[UPS_KEHUA_SEND_MSG], //发送Buffer
- int &nIndex,
- int &nLen,
- char szType[TYPE_LENGTH]
- )
- {
- CHAR szFile[MAX_PATH + 1] = "";
- wsprintf(szFile, "%s\\config\\%s", szPath, szIniName);
-
-
- GetPrivateProfileString(szCmd, "SendCmd", "", szUpsKeHuaSendMsg, sizeof(szUpsKeHuaSendMsg), szFile);
- szUpsKeHuaSendMsg[strlen(szUpsKeHuaSendMsg)] = 0x0D;
- nIndex = GetPrivateProfileInt(szCmd, "Index", 0, szFile);
- nLen = GetPrivateProfileInt(szCmd, "Len", 0, szFile);
- return 0;
- }
- int CUpsKeHua::GetKeHuaQ1VarMsg(
- char szCmd[MAX_CMD], // 命令
- char szMsg[VAR_MSG], // 接收Buffer
- int &nIndex, // 变量索引,针对接收Buffer而言
- int &nLen, // 变量长度
- char szType[TYPE_LENGTH] // 变量数据类型
- )
- {
- int nRet = -1;
- if( strcmp(szCmd, "cmd-1") == 0 ||
- strcmp(szCmd, "cmd-2") == 0 ||
- strcmp(szCmd, "cmd-3") == 0 ||
- strcmp(szCmd, "cmd-4") == 0 ||
- strcmp(szCmd, "cmd-5") == 0 ||
- strcmp(szCmd, "cmd-6") == 0 ||
- strcmp(szCmd, "cmd-7") == 0 ||
- strcmp(szCmd, "cmd-8") == 0 ||
- strcmp(szCmd, "cmd-9") == 0 ||
- strcmp(szCmd, "cmd-10") == 0 ||
- strcmp(szCmd, "cmd-11") == 0 ||
- strcmp(szCmd, "cmd-12") == 0 ||
- strcmp(szCmd, "cmd-13") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(szMsg, m_szKeHua_Q1Msg + nIndex, nLen);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- int CUpsKeHua::GetKeHuaG1VarMsg(
- char szCmd[MAX_CMD], // 命令
- char szMsg[VAR_MSG], // 接收Buffer
- int &nIndex, // 变量索引,针对接收Buffer而言
- int &nLen, // 变量长度
- char szType[TYPE_LENGTH] // 变量数据类型
- )
- {
- int nRet = 0;
- if( strcmp(szCmd, "cmd-1") == 0 ||
- strcmp(szCmd, "cmd-2") == 0 ||
- strcmp(szCmd, "cmd-3") == 0 ||
- strcmp(szCmd, "cmd-4") == 0 ||
- strcmp(szCmd, "cmd-5") == 0 ||
- strcmp(szCmd, "cmd-6") == 0 ||
- strcmp(szCmd, "cmd-7") == 0 ||
- strcmp(szCmd, "cmd-8") == 0 ||
- strcmp(szCmd, "cmd-9") == 0 ||
- strcmp(szCmd, "cmd-10") == 0 ||
- strcmp(szCmd, "cmd-11") == 0 ||
- strcmp(szCmd, "cmd-12") == 0 ||
- strcmp(szCmd, "cmd-13") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(szMsg, m_szKeHua_Q1Msg + nIndex, nLen);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- int CUpsKeHua::GetKeHuaG2VarMsg(
- char szCmd[MAX_CMD], // 命令
- char szMsg[VAR_MSG], // 接收Buffer
- int &nIndex, // 变量索引,针对接收Buffer而言
- int &nLen, // 变量长度
- char szType[TYPE_LENGTH] // 变量数据类型
- )
- {
- int nRet = -1;
- if( strcmp(szCmd, "cmd-1") == 0 ||
- strcmp(szCmd, "cmd-2") == 0 ||
- strcmp(szCmd, "cmd-3") == 0 ||
- strcmp(szCmd, "cmd-4") == 0 ||
- strcmp(szCmd, "cmd-5") == 0 ||
- strcmp(szCmd, "cmd-6") == 0 ||
- strcmp(szCmd, "cmd-7") == 0 ||
- strcmp(szCmd, "cmd-8") == 0 ||
- strcmp(szCmd, "cmd-9") == 0 ||
- strcmp(szCmd, "cmd-10") == 0 ||
- strcmp(szCmd, "cmd-11") == 0 ||
- strcmp(szCmd, "cmd-12") == 0 ||
- strcmp(szCmd, "cmd-13") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(szMsg, m_szKeHua_Q1Msg + nIndex, nLen);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- int CUpsKeHua::GetKeHuaG3VarMsg(
- char szCmd[MAX_CMD], // 命令
- char szMsg[VAR_MSG], // 接收Buffer
- int &nIndex, // 变量索引,针对接收Buffer而言
- int &nLen, // 变量长度
- char szType[TYPE_LENGTH] // 变量数据类型
- )
- {
- int nRet = -1;
- if( strcmp(szCmd, "cmd-1") == 0 ||
- strcmp(szCmd, "cmd-2") == 0 ||
- strcmp(szCmd, "cmd-3") == 0 ||
- strcmp(szCmd, "cmd-4") == 0 ||
- strcmp(szCmd, "cmd-5") == 0 ||
- strcmp(szCmd, "cmd-6") == 0 ||
- strcmp(szCmd, "cmd-7") == 0 ||
- strcmp(szCmd, "cmd-8") == 0 ||
- strcmp(szCmd, "cmd-9") == 0 ||
- strcmp(szCmd, "cmd-10") == 0 ||
- strcmp(szCmd, "cmd-11") == 0 ||
- strcmp(szCmd, "cmd-12") == 0 ||
- strcmp(szCmd, "cmd-13") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(szMsg, m_szKeHua_Q1Msg + nIndex, nLen);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- int CUpsKeHua::GetKeHuaGFVarMsg(
- char szCmd[MAX_CMD], // 命令
- char szMsg[VAR_MSG], // 接收Buffer
- int &nIndex, // 变量索引,针对接收Buffer而言
- int &nLen, // 变量长度
- char szType[TYPE_LENGTH] // 变量数据类型
- )
- {
- int nRet = -1;
- if( strcmp(szCmd, "cmd-1") == 0 ||
- strcmp(szCmd, "cmd-2") == 0 ||
- strcmp(szCmd, "cmd-3") == 0 ||
- strcmp(szCmd, "cmd-4") == 0 ||
- strcmp(szCmd, "cmd-5") == 0 ||
- strcmp(szCmd, "cmd-6") == 0 ||
- strcmp(szCmd, "cmd-7") == 0 ||
- strcmp(szCmd, "cmd-8") == 0 ||
- strcmp(szCmd, "cmd-9") == 0 ||
- strcmp(szCmd, "cmd-10") == 0 ||
- strcmp(szCmd, "cmd-11") == 0 ||
- strcmp(szCmd, "cmd-12") == 0 ||
- strcmp(szCmd, "cmd-13") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(szMsg, m_szKeHua_Q1Msg + nIndex, nLen);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- void CUpsKeHua::SetKeHuaQ1VarMsg( char szCmd[MAX_CMD], char *pBuffer)
- {
- if( strcmp(szCmd, "cmd-1") == 0 ||
- strcmp(szCmd, "cmd-2") == 0 ||
- strcmp(szCmd, "cmd-3") == 0 ||
- strcmp(szCmd, "cmd-4") == 0 ||
- strcmp(szCmd, "cmd-5") == 0 ||
- strcmp(szCmd, "cmd-6") == 0 ||
- strcmp(szCmd, "cmd-7") == 0 ||
- strcmp(szCmd, "cmd-8") == 0 ||
- strcmp(szCmd, "cmd-9") == 0 ||
- strcmp(szCmd, "cmd-10") == 0 ||
- strcmp(szCmd, "cmd-11") == 0 ||
- strcmp(szCmd, "cmd-12") == 0 ||
- strcmp(szCmd, "cmd-13") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(m_szKeHua_Q1Msg, pBuffer, sizeof(m_szKeHua_Q1Msg));
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- void CUpsKeHua::SetKeHuaG1VarMsg( char szCmd[MAX_CMD], char *pBuffer)
- {
- if( strcmp(szCmd, "cmd-14") == 0 ||
- strcmp(szCmd, "cmd-15") == 0 ||
- strcmp(szCmd, "cmd-16") == 0 ||
- strcmp(szCmd, "cmd-17") == 0 ||
- strcmp(szCmd, "cmd-18") == 0 ||
- strcmp(szCmd, "cmd-19") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(m_szKeHua_G1Msg, pBuffer, sizeof(m_szKeHua_G1Msg));
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- void CUpsKeHua::SetKeHuaG2VarMsg( char szCmd[MAX_CMD], char *pBuffer)
- {
- if( strcmp(szCmd, "cmd-34") == 0 ||
- strcmp(szCmd, "cmd-35") == 0 ||
- strcmp(szCmd, "cmd-36") == 0 ||
- strcmp(szCmd, "cmd-37") == 0 ||
- strcmp(szCmd, "cmd-38") == 0 ||
- strcmp(szCmd, "cmd-39") == 0 ||
- strcmp(szCmd, "cmd-40") == 0 ||
- strcmp(szCmd, "cmd-41") == 0 ||
- strcmp(szCmd, "cmd-42") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(m_szKeHua_G2Msg, pBuffer, sizeof(m_szKeHua_G2Msg));
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- void CUpsKeHua::SetKeHuaG3VarMsg( char szCmd[MAX_CMD], char *pBuffer)
- {
- if( strcmp(szCmd, "cmd-20") == 0 ||
- strcmp(szCmd, "cmd-21") == 0 ||
- strcmp(szCmd, "cmd-22") == 0 ||
- strcmp(szCmd, "cmd-23") == 0 ||
- strcmp(szCmd, "cmd-24") == 0 ||
- strcmp(szCmd, "cmd-25") == 0 ||
- strcmp(szCmd, "cmd-26") == 0 ||
- strcmp(szCmd, "cmd-27") == 0 ||
- strcmp(szCmd, "cmd-28") == 0 ||
- strcmp(szCmd, "cmd-29") == 0 ||
- strcmp(szCmd, "cmd-30") == 0 ||
- strcmp(szCmd, "cmd-31") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(m_szKeHua_G3Msg, pBuffer, sizeof(m_szKeHua_G3Msg));
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- void CUpsKeHua::SetKeHuaGFVarMsg( char szCmd[MAX_CMD], char *pBuffer)
- {
- if( strcmp(szCmd, "cmd-32") == 0 ||
- strcmp(szCmd, "cmd-33") == 0
- )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(m_szKeHua_GFMsg, pBuffer, sizeof(m_szKeHua_GFMsg));
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- void CUpsKeHua::SimulationCommData(void)
- {
- //28 30 30 30 2E 30 20 30 30 30 2E 30 20 32 32 30 (000.0 000.0 220
- //2E 30 20 30 30 30 20 30 30 2E 30 20 32 2E 31 33 .0 000 00.0 2.13
- //20 32 32 2E 30 20 31 30 30 31 30 30 30 30 0D 22.0 10010000.
-
- m_szKeHua_Q1Msg[0] = 0x28;
- m_szKeHua_Q1Msg[1] = 0x30;
- m_szKeHua_Q1Msg[2] = 0x30;
- m_szKeHua_Q1Msg[3] = 0x30;
- m_szKeHua_Q1Msg[4] = 0x2E;
- m_szKeHua_Q1Msg[5] = 0x30;
- m_szKeHua_Q1Msg[6] = 0x20;
- m_szKeHua_Q1Msg[7] = 0x30;
- m_szKeHua_Q1Msg[8] = 0x30;
- m_szKeHua_Q1Msg[9] = 0x30;
- m_szKeHua_Q1Msg[10] = 0x2E;
- m_szKeHua_Q1Msg[11] = 0x30;
- m_szKeHua_Q1Msg[12] = 0x20;
- m_szKeHua_Q1Msg[13] = 0x32;
- m_szKeHua_Q1Msg[14] = 0x32;
- m_szKeHua_Q1Msg[15] = 0x30;
- m_szKeHua_Q1Msg[16] = 0x2E;
- m_szKeHua_Q1Msg[17] = 0x30;
- m_szKeHua_Q1Msg[18] = 0x20;
- m_szKeHua_Q1Msg[19] = 0x30;
- m_szKeHua_Q1Msg[20] = 0x30;
- m_szKeHua_Q1Msg[21] = 0x30;
- m_szKeHua_Q1Msg[22] = 0x20;
- m_szKeHua_Q1Msg[23] = 0x30;
- m_szKeHua_Q1Msg[24] = 0x30;
- m_szKeHua_Q1Msg[25] = 0x2E;
- m_szKeHua_Q1Msg[26] = 0x30;
- m_szKeHua_Q1Msg[27] = 0x20;
- m_szKeHua_Q1Msg[28] = 0x32;
- m_szKeHua_Q1Msg[29] = 0x2E;
- m_szKeHua_Q1Msg[30] = 0x31;
- m_szKeHua_Q1Msg[31] = 0x33;
- m_szKeHua_Q1Msg[32] = 0x20;
- m_szKeHua_Q1Msg[33] = 0x32;
- m_szKeHua_Q1Msg[34] = 0x32;
- m_szKeHua_Q1Msg[35] = 0x2E;
- m_szKeHua_Q1Msg[36] = 0x30;
- m_szKeHua_Q1Msg[37] = 0x20;
- m_szKeHua_Q1Msg[38] = 0x31;
- m_szKeHua_Q1Msg[39] = 0x30;
- m_szKeHua_Q1Msg[40] = 0x30;
- m_szKeHua_Q1Msg[41] = 0x31;
- m_szKeHua_Q1Msg[42] = 0x30;
- m_szKeHua_Q1Msg[43] = 0x30;
- m_szKeHua_Q1Msg[44] = 0x30;
- m_szKeHua_Q1Msg[45] = 0x30;
- m_szKeHua_Q1Msg[46] = 0x0D;
- //21 33 37 31 20 30 36 38 20 34 33 33 31 20 30 30 !371 068 4331 00
- //32 2E 35 20 2B 30 30 2E 30 20 30 30 2E 30 20 30 2.5 +00.0 00.0 0
- //30 2E 30 20 34 39 2E 39 0D 0.0 49.9.
- m_szKeHua_G1Msg[0] = 0x21;
- m_szKeHua_G1Msg[1] = 0x33;
- m_szKeHua_G1Msg[2] = 0x37;
- m_szKeHua_G1Msg[3] = 0x31;
- m_szKeHua_G1Msg[4] = 0x20;
- m_szKeHua_G1Msg[5] = 0x20;
- m_szKeHua_G1Msg[6] = 0x36;
- m_szKeHua_G1Msg[7] = 0x38;
- m_szKeHua_G1Msg[8] = 0x20;
- m_szKeHua_G1Msg[9] = 0x34;
- m_szKeHua_G1Msg[10] = 0x33;
- m_szKeHua_G1Msg[11] = 0x33;
- m_szKeHua_G1Msg[12] = 0x31;
- m_szKeHua_G1Msg[13] = 0x20;
- m_szKeHua_G1Msg[14] = 0x30;
- m_szKeHua_G1Msg[15] = 0x30;
- m_szKeHua_G1Msg[16] = 0x32;
- m_szKeHua_G1Msg[17] = 0x2E;
- m_szKeHua_G1Msg[18] = 0x35;
- m_szKeHua_G1Msg[19] = 0x20;
- m_szKeHua_G1Msg[20] = 0x2B;
- m_szKeHua_G1Msg[21] = 0x30;
- m_szKeHua_G1Msg[22] = 0x30;
- m_szKeHua_G1Msg[23] = 0x2E;
- m_szKeHua_G1Msg[24] = 0x30;
- m_szKeHua_G1Msg[25] = 0x20;
- m_szKeHua_G1Msg[26] = 0x30;
- m_szKeHua_G1Msg[27] = 0x30;
- m_szKeHua_G1Msg[28] = 0x2E;
- m_szKeHua_G1Msg[29] = 0x30;
- m_szKeHua_G1Msg[30] = 0x20;
- m_szKeHua_G1Msg[31] = 0x30;
- m_szKeHua_G1Msg[32] = 0x30;
- m_szKeHua_G1Msg[33] = 0x2E;
- m_szKeHua_G1Msg[34] = 0x30;
- m_szKeHua_G1Msg[35] = 0x20;
- m_szKeHua_G1Msg[36] = 0x34;
- m_szKeHua_G1Msg[37] = 0x39;
- m_szKeHua_G1Msg[38] = 0x2E;
- m_szKeHua_G1Msg[39] = 0x39;
- m_szKeHua_G1Msg[40] = 0x0D;
- //21 30 31 30 30 30 31 30 30 20 30 30 30 31 31 30 !01000100 000110
- //31 31 20 30 30 30 30 30 30 30 30 0D 11 00000000.
- m_szKeHua_G2Msg[0] = 0x21;
- m_szKeHua_G2Msg[1] = 0x30;
- m_szKeHua_G2Msg[2] = 0x31;
- m_szKeHua_G2Msg[3] = 0x30;
- m_szKeHua_G2Msg[4] = 0x30;
- m_szKeHua_G2Msg[5] = 0x30;
- m_szKeHua_G2Msg[6] = 0x31;
- m_szKeHua_G2Msg[7] = 0x30;
- m_szKeHua_G2Msg[8] = 0x30;
- m_szKeHua_G2Msg[9] = 0x20;
- m_szKeHua_G2Msg[10] = 0x30;
- m_szKeHua_G2Msg[11] = 0x30;
- m_szKeHua_G2Msg[12] = 0x30;
- m_szKeHua_G2Msg[13] = 0x31;
- m_szKeHua_G2Msg[14] = 0x31;
- m_szKeHua_G2Msg[15] = 0x30;
- m_szKeHua_G2Msg[16] = 0x31;
- m_szKeHua_G2Msg[17] = 0x31;
- m_szKeHua_G2Msg[18] = 0x20;
- m_szKeHua_G2Msg[19] = 0x30;
- m_szKeHua_G2Msg[20] = 0x30;
- m_szKeHua_G2Msg[21] = 0x30;
- m_szKeHua_G2Msg[22] = 0x30;
- m_szKeHua_G2Msg[23] = 0x30;
- m_szKeHua_G2Msg[24] = 0x30;
- m_szKeHua_G2Msg[25] = 0x30;
- m_szKeHua_G2Msg[26] = 0x30;
- m_szKeHua_G2Msg[27] = 0x0D;
- //21 30 30 30 2E 30 2F 30 30 30 2E 30 2F 30 30 30 !000.0/000.0/000
- //2E 30 20 30 30 32 2E 34 2F 30 30 32 2E 37 2F 30 .0 002.4/002.7/0
-
- m_szKeHua_G3Msg[0] = 0x21;
- m_szKeHua_G3Msg[1] = 0x30;
- m_szKeHua_G3Msg[2] = 0x30;
- m_szKeHua_G3Msg[3] = 0x30;
- m_szKeHua_G3Msg[4] = 0x2E;
- m_szKeHua_G3Msg[5] = 0x30;
- m_szKeHua_G3Msg[6] = 0x2F;
- m_szKeHua_G3Msg[7] = 0x30;
- m_szKeHua_G3Msg[8] = 0x30;
- m_szKeHua_G3Msg[9] = 0x30;
- m_szKeHua_G3Msg[10] = 0x2E;
- m_szKeHua_G3Msg[11] = 0x30;
- m_szKeHua_G3Msg[12] = 0x2F;
- m_szKeHua_G3Msg[13] = 0x30;
- m_szKeHua_G3Msg[14] = 0x30;
- m_szKeHua_G3Msg[15] = 0x30;
- m_szKeHua_G3Msg[16] = 0x2E;
- m_szKeHua_G3Msg[17] = 0x30;
- m_szKeHua_G3Msg[18] = 0x20;
- m_szKeHua_G3Msg[19] = 0x30;
- m_szKeHua_G3Msg[20] = 0x30;
- m_szKeHua_G3Msg[21] = 0x32;
- m_szKeHua_G3Msg[22] = 0x2E;
- m_szKeHua_G3Msg[23] = 0x34;
- m_szKeHua_G3Msg[24] = 0x2F;
- m_szKeHua_G3Msg[25] = 0x30;
- m_szKeHua_G3Msg[26] = 0x30;
- m_szKeHua_G3Msg[27] = 0x32;
- m_szKeHua_G3Msg[28] = 0x2E;
- m_szKeHua_G3Msg[29] = 0x37;
- m_szKeHua_G3Msg[30] = 0x2F;
- m_szKeHua_G3Msg[31] = 0x30;
- //30 32 2E 37 20 32 32 30 2E 30 2F 32 32 30 2E 30 02.7 220.0/220.0
- //2F 32 32 30 2E 30 20 30 30 30 2E 30 2F 30 30 30 /220.0 000.0/000
- //2E 30 2F 30 30 30 2E 30 0D .0/000.0.
- m_szKeHua_G3Msg[32] = 0x30;
- m_szKeHua_G3Msg[33] = 0x32;
- m_szKeHua_G3Msg[34] = 0x2E;
- m_szKeHua_G3Msg[35] = 0x37;
- m_szKeHua_G3Msg[36] = 0x20;
- m_szKeHua_G3Msg[37] = 0x32;
- m_szKeHua_G3Msg[38] = 0x32;
- m_szKeHua_G3Msg[39] = 0x30;
- m_szKeHua_G3Msg[40] = 0x2E;
- m_szKeHua_G3Msg[41] = 0x30;
- m_szKeHua_G3Msg[42] = 0x2F;
- m_szKeHua_G3Msg[43] = 0x32;
- m_szKeHua_G3Msg[44] = 0x32;
- m_szKeHua_G3Msg[45] = 0x30;
- m_szKeHua_G3Msg[46] = 0x2E;
- m_szKeHua_G3Msg[47] = 0x30;
- m_szKeHua_G3Msg[48] = 0x2F;
- m_szKeHua_G3Msg[49] = 0x32;
- m_szKeHua_G3Msg[50] = 0x32;
- m_szKeHua_G3Msg[51] = 0x30;
- m_szKeHua_G3Msg[52] = 0x2E;
- m_szKeHua_G3Msg[53] = 0x30;
- m_szKeHua_G3Msg[54] = 0x20;
- m_szKeHua_G3Msg[55] = 0x30;
- m_szKeHua_G3Msg[56] = 0x30;
- m_szKeHua_G3Msg[57] = 0x30;
- m_szKeHua_G3Msg[58] = 0x2E;
- m_szKeHua_G3Msg[59] = 0x30;
- m_szKeHua_G3Msg[60] = 0x2F;
- m_szKeHua_G3Msg[61] = 0x30;
- m_szKeHua_G3Msg[62] = 0x30;
- m_szKeHua_G3Msg[63] = 0x30;
- m_szKeHua_G3Msg[64] = 0x2E;
- m_szKeHua_G3Msg[65] = 0x30;
- m_szKeHua_G3Msg[66] = 0x2F;
- m_szKeHua_G3Msg[67] = 0x30;
- m_szKeHua_G3Msg[68] = 0x30;
- m_szKeHua_G3Msg[69] = 0x30;
- m_szKeHua_G3Msg[70] = 0x2E;
- m_szKeHua_G3Msg[71] = 0x30;
- m_szKeHua_G3Msg[72] = 0x0D;
- }
|