| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037 |
- #include "StdAfx.h"
- #include ".\pb9315.h"
- #include "StdAfx.h"
- #include "CommProcess.h"
- #include ".\cms.h"
- CPB9315::CPB9315(
- 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 ) ); //创建或打开一个命名的或无名的事件对象;
- memset(m_sz_33Msg, 0, sizeof(m_sz_33Msg));
- memset(m_sz_34Msg, 0, sizeof(m_sz_34Msg));
- memset(m_sz_35Msg, 0, sizeof(m_sz_35Msg));
- memset(m_szTemp, 0, sizeof(m_szTemp));
- memset(szProcessData, 0, sizeof(szProcessData));
- m_devOnline= TRUE;
- m_dwOnlineTick = 0;
- m_bRun = FALSE;
- }
- CPB9315::~CPB9315()
- {
- #if IS_USE_READMSG_CS
- DeleteCriticalSection( &m_csReadMsg );
- #endif
- MTVERIFY( CloseHandle( m_hSemComm ) );
- CloseComm();
- }
- BOOL CPB9315::PB9315OpenComm(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 );
- LOG4C((LOG_NOTICE,"OpenComm Sucess"));
- return bResult;
- }
- int CPB9315::Authorization(CCommProcess *pComm)
- {
- int nRet = 0;
- /************************************************************************/
- /* SendMsg */
- /************************************************************************/
- BYTE SendPart[7] = {0};
- SendPart[0] = 0xAB;
- SendPart[1] = 0x04;
- SendPart[2] = 0xCF;
- SendPart[3] = 0x69;
- SendPart[4] = 0xE8;
- SendPart[5] = 0xD5;
- SendPart[6] = 0x5C;
- //WaitForSingObject();等待有信号;
- if( WaitForSingleObject( m_hSemComm, 0 ) == WAIT_OBJECT_0 ) {
- //ResetEvent()设置无信号状态
- ResetEvent( m_hSemComm );
- int nResult = pComm->Write(SendPart, 7);
- if( nResult != 7 ) {
- //SetEvent设置有信号;
- SetEvent( m_hSemComm );
- //返回 错误值;
- return EER_CODE_PB9315_COM_REGNUM;
- }
- }
- else{
- //如果m_hSemCom无信号,返回错误;
- return ERR_CODE_PB9315_COM_BUSY;
- }
- /************************************************************************/
- /* readfile ; */
- /************************************************************************/
- //int nRecvLen = 0;
- //BYTE pBuffer[270];
- //memset(pBuffer, 0, 270);
- //nRecvLen = pComm->Read(pBuffer,270);
- SetEvent( m_hSemComm );
- LOG4C((LOG_NOTICE,"Authorization Sucess"));
- return 0;
- }
- int CPB9315::OnlyRequested(CCommProcess *pComm)
- {
- int nRet = 0;
- /************************************************************************/
- /* SendMsg */
- /************************************************************************/
- BYTE SendPart[4] = {0};
- SendPart[0] = 0xAB;
- SendPart[1] = 0x01;
- SendPart[2] = 0xA0;
- SendPart[3] = 0xB4;
- //WaitForSingObject();等待有信号;
- if( WaitForSingleObject( m_hSemComm, 0 ) == WAIT_OBJECT_0 ) {
- //ResetEvent()设置无信号状态
- ResetEvent( m_hSemComm );
- int nResult = pComm->Write(SendPart, 4);
- if( nResult != 4 ) {
- //SetEvent设置有信号;
- SetEvent( m_hSemComm );
- //返回 错误值;
- return EER_CODE_PB9315_COM_REGNUM;
- }
- }
- else{
- //如果m_hSemCom无信号,返回错误;
- return ERR_CODE_PB9315_COM_BUSY;
- }
- /************************************************************************/
- /* readfile ; */
- /************************************************************************/
- //int nRecvLen = 0;
- //BYTE pBuffer[270];
- //memset(pBuffer, 0, 270);
- //nRecvLen = pComm->Read(pBuffer,270);
- SetEvent( m_hSemComm );
- LOG4C((LOG_NOTICE,"OnlyRequested Sucess"));
- return 0;
- }
- int CPB9315::ReadSetingData(CCommProcess *pComm)
- {
- int nRet = 0;
- /************************************************************************/
- /* SendMsg */
- /************************************************************************/
- BYTE SendPart[4] = {0};
- SendPart[0] = 0xAB;
- SendPart[1] = 0x01;
- SendPart[2] = 0x31;
- SendPart[3] = 0x23;
- //WaitForSingObject();等待有信号;
- if( WaitForSingleObject( m_hSemComm, 0 ) == WAIT_OBJECT_0 ) {
- //ResetEvent()设置无信号状态
- ResetEvent( m_hSemComm );
- int nResult = pComm->Write(SendPart, 4);
- if( nResult != 4 ) {
- //SetEvent设置有信号;
- SetEvent( m_hSemComm );
- //返回 错误值;
- return EER_CODE_PB9315_COM_REGNUM;
- }
- }
- else{
- //如果m_hSemCom无信号,返回错误;
- return ERR_CODE_PB9315_COM_BUSY;
- }
- /************************************************************************/
- /* readfile ; */
- /************************************************************************/
- int nRecvLen = 0;
- BYTE pBuffer[270];
- memset(pBuffer, 0, 270);
- nRecvLen = pComm->Read(pBuffer,270);
- SetEvent( m_hSemComm );
- LOG4C((LOG_NOTICE,"ReadSetingData Sucess"));
- return 0;
- }
- // 发送读取设备参数请求;
- int CPB9315::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;
- BYTE IniSendCMD = 0;
- char szType[TYPE_LENGTH] = {0};
- char szScreen[MAX_CMD] = {0};
- int StartBit = 0;
- int EndBit = 0;
- GetPB9315IniInfo(szPath, szIniName, szCmd, IniSendCMD, szType, nIndex, nLen, StartBit, EndBit);
- CCommProcess *pComm = FindComm(nCommPort);
- if (!m_bRun)
- {
- Authorization(pComm);
- OnlyRequested(pComm);
-
- ReadSetingData(pComm);
- LOG4C((LOG_NOTICE,"Sucess Authorization"));
- m_bRun = TRUE;
- }
- if( pComm == NULL ) return -1;
- int nRet = -1;
- if(
- (strlen(m_sz_33Msg) == 0 &&
- (
- strcmp(szCmd, "cmd-1") == 0 || strcmp(szCmd, "cmd-2") == 0 || strcmp(szCmd, "cmd-3") == 0 ||
- strcmp(szCmd, "cmd-4") == 0 || strcmp(szCmd, "cmd-6") == 0 || strcmp(szCmd, "cmd-5") == 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 || strcmp(szCmd, "cmd-14") == 0
- )) ||
- (strlen(m_sz_34Msg) == 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 || 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 || strcmp(szCmd, "cmd-32") == 0 || strcmp(szCmd, "cmd-33") == 0 ||
- 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 ||
- strcmp(szCmd, "cmd-43") == 0 || strcmp(szCmd, "cmd-44") == 0 || strcmp(szCmd, "cmd-45") == 0 ||
- strcmp(szCmd, "cmd-46") == 0 || strcmp(szCmd, "cmd-47") == 0 || strcmp(szCmd, "cmd-48") == 0 ||
- strcmp(szCmd, "cmd-49") == 0 || strcmp(szCmd, "cmd-50") == 0 || strcmp(szCmd, "cmd-51") == 0 ||
- strcmp(szCmd, "cmd-52") == 0 || strcmp(szCmd, "cmd-53") == 0 ))
- ||
- (strlen(m_sz_35Msg) == 0 &&
- (
- strcmp(szCmd, "cmd-54") == 0 ||strcmp(szCmd, "cmd-55") == 0 || strcmp(szCmd, "cmd-56") == 0 || strcmp(szCmd, "cmd-57") == 0 ||
- strcmp(szCmd, "cmd-58") == 0 || strcmp(szCmd, "cmd-59") == 0 || strcmp(szCmd, "cmd-60") == 0 ||
- strcmp(szCmd, "cmd-61") == 0 || strcmp(szCmd, "cmd-62") == 0 || strcmp(szCmd, "cmd-63") == 0 ||
- strcmp(szCmd, "cmd-64") == 0 || strcmp(szCmd, "cmd-65") == 0 || strcmp(szCmd, "cmd-66") == 0 ||
- strcmp(szCmd, "cmd-67") == 0 || strcmp(szCmd, "cmd-68") == 0 || strcmp(szCmd, "cmd-69") == 0 ||
- strcmp(szCmd, "cmd-60") == 0 || strcmp(szCmd, "cmd-61") == 0 || strcmp(szCmd, "cmd-62") == 0 ||
- strcmp(szCmd, "cmd-63") == 0 || strcmp(szCmd, "cmd-64") == 0 || strcmp(szCmd, "cmd-65") == 0 ||
- strcmp(szCmd, "cmd-66") == 0 || strcmp(szCmd, "cmd-67") == 0 || strcmp(szCmd, "cmd-68") == 0 ||
- strcmp(szCmd, "cmd-69") == 0 || strcmp(szCmd, "cmd-70") == 0 || strcmp(szCmd, "cmd-71") == 0 ||
- strcmp(szCmd, "cmd-72") == 0 || strcmp(szCmd, "cmd-73") == 0 || strcmp(szCmd, "cmd-74") == 0 ||
- strcmp(szCmd, "cmd-75") == 0 || strcmp(szCmd, "cmd-76") == 0 || strcmp(szCmd, "cmd-77") == 0 ||
- strcmp(szCmd, "cmd-78") == 0 || strcmp(szCmd, "cmd-79") == 0 || strcmp(szCmd, "cmd-80") == 0 ||
- strcmp(szCmd, "cmd-81") == 0 || strcmp(szCmd, "cmd-82") == 0 || strcmp(szCmd, "cmd-83") == 0 ||
- strcmp(szCmd, "cmd-84") == 0 || strcmp(szCmd, "cmd-85") == 0 || strcmp(szCmd, "cmd-86") == 0 ||
- strcmp(szCmd, "cmd-87") == 0 || strcmp(szCmd, "cmd-88") == 0 || strcmp(szCmd, "cmd-89") == 0 ||
- strcmp(szCmd, "cmd-90") == 0 || strcmp(szCmd, "cmd-91") == 0 || strcmp(szCmd, "cmd-92") == 0 ||
- strcmp(szCmd, "cmd-93") == 0 || strcmp(szCmd, "cmd-94") == 0 || strcmp(szCmd, "cmd-95") == 0))
- ||
- strcmp(szCmd, "cmd-1") == 0 || strcmp(szCmd, "cmd-15") == 0 ||
- strcmp(szCmd, "cmd-54") == 0
- )
- {
- nRet = GetDeviceParam(pComm, IniSendCMD, 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;
- }
- LOG4C((LOG_NOTICE,"Begin GetData"));
- nRet = Get33VarMsg( szCmd, szMsg, nIndex, nLen, szType, StartBit, EndBit);
- nRet = Get34VarMsg( szCmd, szMsg, nIndex, nLen, szType, StartBit, EndBit);
- nRet = Get35VarMsg( szCmd, szMsg, nIndex, nLen, szType, StartBit, EndBit);
- LOG4C((LOG_NOTICE,"nRet = %d,cmd = %s,值 = %s",nRet,szCmd,szMsg));
- return nRet;
- }
- int CPB9315::GetDeviceParam(
- CCommProcess *pComm,
- BYTE &IniSendCMD,
- char szCmd[MAX_CMD],
- char szMsg[VAR_MSG],
- int &nIndex,
- int &nLen,
- char szType[TYPE_LENGTH])
- {
- int nRet = -1;
- nRet = RequestReadStatus(szCmd, pComm, IniSendCMD);
- if( nRet != 0 )
- {
- return nRet;
- }
- nRet = ResponseReadStatus(pComm, szCmd, szMsg, nIndex, nLen, szType);
- return nRet;
- }
- int CPB9315::RequestReadStatus(char szCmd[MAX_CMD], CCommProcess *pComm, BYTE &IniSendCMD)
- {
- int nRet = -1;
- #if DEBUG_PB9315
- BYTE byArray[5];
- //ZeroMemory(&byArray,5);
- memset(byArray,0,5);
- byArray[0] = 0xAB;
- byArray[1] = 0x01;
- byArray[2] = IniSendCMD; // 命令;
- byArray[3] = GetEndCheck((char *)byArray,3); // 校验;
- LOG4C((LOG_NOTICE,"Begin WriteFile"));
- if( WaitForSingleObject( m_hSemComm, 0 ) == WAIT_OBJECT_0 ) { // 有信号才写串口;
- ResetEvent( m_hSemComm );
- int nResult = pComm->Write(byArray, 4);
- if( nResult == 4 ){
- }
- else{
- LOG4C((LOG_NOTICE,"EER_CODE_PB9315_COM_WRITE_DATA"));
- SetEvent( m_hSemComm );
- return EER_CODE_PB9315_COM_WRITE_DATA;
- }
- }
- else{
- LOG4C((LOG_NOTICE,"ERR_CODE_PB9315_COM_BUSY"));
- return ERR_CODE_PB9315_COM_BUSY;
- }
- #endif
- return 0;
- }
- int CPB9315::ResponseReadStatus(
- CCommProcess *pComm,
- char szCmd[MAX_CMD],
- char szMsg[VAR_MSG],
- int &nIndex,
- int &nLen,
- char szType[TYPE_LENGTH]
- )
- {
- #if DEBUG_PB9315
- int nRecvLen = 0;
- char *pBuffer = new char[270];
- memset(pBuffer, 0, 270);
- nRecvLen = pComm->Read((BYTE *)pBuffer,270);
- if( nRecvLen <= 0)
- {
- SetEvent( m_hSemComm );
- if( pBuffer != NULL)
- {
- delete[] pBuffer;
- pBuffer = NULL;
- }
- return ERR_CODE_PB9315_COM_READ_NO_DATA;
- }
- LOG4C((LOG_NOTICE,"Begin SetData"));
- Set33VarMsg( szCmd, pBuffer);
- Set34VarMsg( szCmd, pBuffer);
- Set35VarMsg( szCmd, pBuffer);
- LOG4C((LOG_NOTICE,"Sucess SetData"));
- m_dwOnlineTick = GetTickCount();
- SetEvent( m_hSemComm );
- if( pBuffer != NULL)
- {
- delete[] pBuffer;
- pBuffer = NULL;
- }
- #else
- SimulationCommData();
- #endif
- return 0;
- }
- void CPB9315::Set33VarMsg( 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-6") == 0 || strcmp(szCmd, "cmd-5") == 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 || strcmp(szCmd, "cmd-14") == 0 )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(m_sz_33Msg, pBuffer + 4, sizeof(m_sz_33Msg));
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- void CPB9315::Set34VarMsg( char szCmd[MAX_CMD], char *pBuffer)
- {
- if( 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 || 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 || strcmp(szCmd, "cmd-32") == 0 || strcmp(szCmd, "cmd-33") == 0 ||
- 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 ||
- strcmp(szCmd, "cmd-43") == 0 || strcmp(szCmd, "cmd-44") == 0 || strcmp(szCmd, "cmd-45") == 0 ||
- strcmp(szCmd, "cmd-46") == 0 || strcmp(szCmd, "cmd-47") == 0 || strcmp(szCmd, "cmd-48") == 0 ||
- strcmp(szCmd, "cmd-49") == 0 || strcmp(szCmd, "cmd-50") == 0 || strcmp(szCmd, "cmd-51") == 0 ||
- strcmp(szCmd, "cmd-52") == 0 || strcmp(szCmd, "cmd-53") == 0 )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memset(m_szTemp,0,1024);
- memcpy(m_szTemp,pBuffer,sizeof(m_szTemp));
- GetDataSection();
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- void CPB9315::Set35VarMsg( char szCmd[MAX_CMD], char *pBuffer)
- {
- if( strcmp(szCmd, "cmd-54") == 0 ||strcmp(szCmd, "cmd-55") == 0 || strcmp(szCmd, "cmd-56") == 0 || strcmp(szCmd, "cmd-57") == 0 ||
- strcmp(szCmd, "cmd-58") == 0 || strcmp(szCmd, "cmd-59") == 0 || strcmp(szCmd, "cmd-60") == 0 ||
- strcmp(szCmd, "cmd-61") == 0 || strcmp(szCmd, "cmd-62") == 0 || strcmp(szCmd, "cmd-63") == 0 ||
- strcmp(szCmd, "cmd-64") == 0 || strcmp(szCmd, "cmd-65") == 0 || strcmp(szCmd, "cmd-66") == 0 ||
- strcmp(szCmd, "cmd-67") == 0 || strcmp(szCmd, "cmd-68") == 0 || strcmp(szCmd, "cmd-69") == 0 ||
- strcmp(szCmd, "cmd-60") == 0 || strcmp(szCmd, "cmd-61") == 0 || strcmp(szCmd, "cmd-62") == 0 ||
- strcmp(szCmd, "cmd-63") == 0 || strcmp(szCmd, "cmd-64") == 0 || strcmp(szCmd, "cmd-65") == 0 ||
- strcmp(szCmd, "cmd-66") == 0 || strcmp(szCmd, "cmd-67") == 0 || strcmp(szCmd, "cmd-68") == 0 ||
- strcmp(szCmd, "cmd-69") == 0 || strcmp(szCmd, "cmd-70") == 0 || strcmp(szCmd, "cmd-71") == 0 ||
- strcmp(szCmd, "cmd-72") == 0 || strcmp(szCmd, "cmd-73") == 0 || strcmp(szCmd, "cmd-74") == 0 ||
- strcmp(szCmd, "cmd-75") == 0 || strcmp(szCmd, "cmd-76") == 0 || strcmp(szCmd, "cmd-77") == 0 ||
- strcmp(szCmd, "cmd-78") == 0 || strcmp(szCmd, "cmd-79") == 0 || strcmp(szCmd, "cmd-80") == 0 ||
- strcmp(szCmd, "cmd-81") == 0 || strcmp(szCmd, "cmd-82") == 0 || strcmp(szCmd, "cmd-83") == 0 ||
- strcmp(szCmd, "cmd-84") == 0 || strcmp(szCmd, "cmd-85") == 0 || strcmp(szCmd, "cmd-86") == 0 ||
- strcmp(szCmd, "cmd-87") == 0 || strcmp(szCmd, "cmd-88") == 0 || strcmp(szCmd, "cmd-89") == 0 ||
- strcmp(szCmd, "cmd-90") == 0 || strcmp(szCmd, "cmd-91") == 0 || strcmp(szCmd, "cmd-92") == 0 ||
- strcmp(szCmd, "cmd-93") == 0 || strcmp(szCmd, "cmd-94") == 0 || strcmp(szCmd, "cmd-95") == 0 )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- memcpy(m_sz_35Msg, pBuffer + 4, sizeof(m_sz_35Msg));
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- }
- }
- int CPB9315::Get33VarMsg( char szCmd[MAX_CMD], char szMsg[VAR_MSG], int &nIndex, int &nLen, char szType[TYPE_LENGTH], int startBit, int endBit )
- {
- 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-6") == 0 || strcmp(szCmd, "cmd-5") == 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 || strcmp(szCmd, "cmd-14") == 0)
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- DataProcess(szType, m_sz_33Msg + nIndex, szMsg, nLen, startBit, endBit);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- int CPB9315::Get34VarMsg( char szCmd[MAX_CMD], char szMsg[VAR_MSG], int &nIndex, int &nLen, char szType[TYPE_LENGTH], int startBit, int endBit )
- {
- int nRet = 0;
- if( 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 || 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 || strcmp(szCmd, "cmd-32") == 0 || strcmp(szCmd, "cmd-33") == 0 ||
- 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 ||
- strcmp(szCmd, "cmd-43") == 0 || strcmp(szCmd, "cmd-44") == 0 || strcmp(szCmd, "cmd-45") == 0 ||
- strcmp(szCmd, "cmd-46") == 0 || strcmp(szCmd, "cmd-47") == 0 || strcmp(szCmd, "cmd-48") == 0 ||
- strcmp(szCmd, "cmd-49") == 0 || strcmp(szCmd, "cmd-50") == 0 || strcmp(szCmd, "cmd-51") == 0 ||
- strcmp(szCmd, "cmd-52") == 0 || strcmp(szCmd, "cmd-53") == 0 )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- DataProcess(szType, m_sz_34Msg + nIndex, szMsg, nLen, startBit, endBit);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- int CPB9315::Get35VarMsg( char szCmd[MAX_CMD], char szMsg[VAR_MSG], int &nIndex, int &nLen, char szType[TYPE_LENGTH], int startBit, int endBit )
- {
- int nRet = 0;
- if( strcmp(szCmd, "cmd-54") == 0 ||strcmp(szCmd, "cmd-55") == 0 || strcmp(szCmd, "cmd-56") == 0 || strcmp(szCmd, "cmd-57") == 0 ||
- strcmp(szCmd, "cmd-58") == 0 || strcmp(szCmd, "cmd-59") == 0 || strcmp(szCmd, "cmd-60") == 0 ||
- strcmp(szCmd, "cmd-61") == 0 || strcmp(szCmd, "cmd-62") == 0 || strcmp(szCmd, "cmd-63") == 0 ||
- strcmp(szCmd, "cmd-64") == 0 || strcmp(szCmd, "cmd-65") == 0 || strcmp(szCmd, "cmd-66") == 0 ||
- strcmp(szCmd, "cmd-67") == 0 || strcmp(szCmd, "cmd-68") == 0 || strcmp(szCmd, "cmd-69") == 0 ||
- strcmp(szCmd, "cmd-60") == 0 || strcmp(szCmd, "cmd-61") == 0 || strcmp(szCmd, "cmd-62") == 0 ||
- strcmp(szCmd, "cmd-63") == 0 || strcmp(szCmd, "cmd-64") == 0 || strcmp(szCmd, "cmd-65") == 0 ||
- strcmp(szCmd, "cmd-66") == 0 || strcmp(szCmd, "cmd-67") == 0 || strcmp(szCmd, "cmd-68") == 0 ||
- strcmp(szCmd, "cmd-69") == 0 || strcmp(szCmd, "cmd-70") == 0 || strcmp(szCmd, "cmd-71") == 0 ||
- strcmp(szCmd, "cmd-72") == 0 || strcmp(szCmd, "cmd-73") == 0 || strcmp(szCmd, "cmd-74") == 0 ||
- strcmp(szCmd, "cmd-75") == 0 || strcmp(szCmd, "cmd-76") == 0 || strcmp(szCmd, "cmd-77") == 0 ||
- strcmp(szCmd, "cmd-78") == 0 || strcmp(szCmd, "cmd-79") == 0 || strcmp(szCmd, "cmd-80") == 0 ||
- strcmp(szCmd, "cmd-81") == 0 || strcmp(szCmd, "cmd-82") == 0 || strcmp(szCmd, "cmd-83") == 0 ||
- strcmp(szCmd, "cmd-84") == 0 || strcmp(szCmd, "cmd-85") == 0 || strcmp(szCmd, "cmd-86") == 0 ||
- strcmp(szCmd, "cmd-87") == 0 || strcmp(szCmd, "cmd-88") == 0 || strcmp(szCmd, "cmd-89") == 0 ||
- strcmp(szCmd, "cmd-90") == 0 || strcmp(szCmd, "cmd-91") == 0 || strcmp(szCmd, "cmd-92") == 0 ||
- strcmp(szCmd, "cmd-93") == 0 || strcmp(szCmd, "cmd-94") == 0 || strcmp(szCmd, "cmd-95") == 0 )
- {
- #if IS_USE_READMSG_CS
- EnterCriticalSection( &m_csReadMsg );
- #endif
- DataProcess(szType, m_sz_35Msg + nIndex, szMsg, nLen, startBit, endBit);
- #if IS_USE_READMSG_CS
- LeaveCriticalSection(&m_csReadMsg);
- #endif
- nRet = 0;
- }
- return nRet;
- }
- int CPB9315::GetPB9315IniInfo(
- char szPath[MAX_PATH],
- char szIniName[MAX_PATH],
- char szCmd[MAX_CMD],
- BYTE &IniSendCMD,
- char szType[TYPE_LENGTH],
- int &nIndex,
- int &nLen,
- int &StaBit,
- int &EndBit
- )
- {
- char szFile[MAX_PATH + 1] = "";
- char szSendCmd[3] = {0};
- memset(szType, 0, TYPE_LENGTH);
- wsprintf(szFile, "%s\\config\\%s", szPath, szIniName);
- GetPrivateProfileString(szCmd, "SendCmd", "", szSendCmd, MAX_CMD, szFile);
- IniSendCMD = AsciiToBYTE(szSendCmd[0])*16 + AsciiToBYTE(szSendCmd[1]) ;
- GetPrivateProfileString(szCmd, "Type", "", szType, TYPE_LENGTH, szFile);
- nIndex = GetPrivateProfileInt(szCmd, "Index", 0, szFile);
- nLen = GetPrivateProfileInt(szCmd, "Len", 0, szFile);
- StaBit = GetPrivateProfileInt(szCmd,"Sbit",0,szFile);
- EndBit = GetPrivateProfileInt(szCmd,"Ebit",0,szFile);
- return 0;
- }
- int CPB9315::GetEndCheck(char *buf,int len)
- {
- int iSum = 0;
- for (int i = 0; i < len; i++)
- {
- iSum += (BYTE)buf[i];
- }
- // 再求低8位,取反加+;
- iSum = iSum & 0x00FF;
- return iSum = ~iSum+1;
- }
- void CPB9315::GetDataSection(/*char *pBuf*/)
- {
- int nBlockLen1 = 0, nBlockLen2 = 0,nBlockLen3 = 0,nBlockLen4 =0;
- nBlockLen1 = m_szTemp[2] + 5;
- nBlockLen2 = m_szTemp[nBlockLen1+2] + 5;
- nBlockLen3 = m_szTemp[nBlockLen2 + nBlockLen1 +2] + 5;
- nBlockLen4 = m_szTemp[nBlockLen3 + nBlockLen2 + nBlockLen1] + 5 ;
- memcpy(m_sz_34Msg,m_szTemp + 4,nBlockLen1 - 5);
- memcpy(m_sz_34Msg + nBlockLen1 - 5,m_szTemp + nBlockLen1 + 4,nBlockLen2 - 5);
- }
- void CPB9315::PCRTo16HEXPCRT(char *szSour, char *pDsc,int len)
- {
- #if 1
- for (int i = 0,j = 0; i < len; i++)
- {
- pDsc[j++] = ByteToAscii((szSour[len -i-1] >> 4 ) & 0x0F);
- pDsc[j++] = ByteToAscii(szSour[len -i-1] & 0x0F);
- }
- #else
- int j = 0;
- int nNo = 0;
- for (int i = 0,j = 0; i < len; i++)
- {
- nNo = j++;
- pDsc[nNo] = ByteToAscii((szSour[len -i-1] >> 4 ) & 0x0F);
- nNo = j++;
- pDsc[nNo] = ByteToAscii(szSour[len -i-1] & 0x0F);
- }
- #endif
- }
- void CPB9315::ByteTo16HEXAscii(BYTE &bySour, char *pDsc)
- {
- pDsc[0] = ByteToAscii((bySour >> 4 ) & 0x0F);
- pDsc[1] = ByteToAscii(bySour & 0x0F);
- }
- //char* CPB9315::ByteTo16HEXAscii(BYTE &bySour)
- //{
- // //char *pDsc = new char[3];
- // //memset(pDsc,0,3);
- // char pDsc[3] = {0};
- //
- // pDsc[0] = ByteToAscii((bySour >> 4 ) & 0x0F);
- // pDsc[1] = ByteToAscii(bySour & 0x0F);
- //
- // return pDsc;
- //}
- void CPB9315::DataProcess(const char *szType, char *szMsg, char *szConvMsg, int len, int StaBit, int EndBit)
- {
- if ( strcmp(szType, "HEX") == 0)
- {
- memset(szProcessData,0,9);
- #if 0
- PCRTo16HEXPCRT(szMsg,szProcessData,4);
- LOG4C((LOG_NOTICE,"szPD = %s",szProcessData));
- #else
- char sztmp1[3] = {0},sztmp2[3] = {0},sztmp3[3] = {0},sztmp4[3] = {0};
- ByteTo16HEXAscii((BYTE&)szMsg[3],sztmp1);
- ByteTo16HEXAscii((BYTE&)szMsg[2],sztmp2);
- ByteTo16HEXAscii((BYTE&)szMsg[1],sztmp3);
- ByteTo16HEXAscii((BYTE&)szMsg[0],sztmp4);
- sprintf(szProcessData,"%s%s%s%s",sztmp1,sztmp2,sztmp3,sztmp4);
- #endif
- int iSum = AsciiToBYTE(szProcessData[4])*4096 + AsciiToBYTE(szProcessData[5])*256 + AsciiToBYTE(szProcessData[6])*16 + AsciiToBYTE(szProcessData[7]) ;
- sprintf(szConvMsg,"%d",iSum);
- }
- else if ( strcmp(szType, "BIT") == 0 )
- {
- BitDataProcess((BYTE)szMsg[0],szConvMsg,StaBit,EndBit);
- }
- else if (strcmp(szType,"FLOAT") == 0)
- {
- float fNum = *(float*)szMsg;
- sprintf(szConvMsg,"%f",fNum);
- }
- }
- void CPB9315::BitDataProcess(const BYTE &bySour, char *szRecv,int &StaBit,int &EndBit)
- {
- int ByteBit = 0;
- int sum = bySour;
- #if 0
- switch(StaBit)
- {
- case 7:
- ByteBit = sum & 0x01;
- break;
- case 6:
- ByteBit = (sum & 0x02) / 0x02 ;
- break;
- case 5:
- ByteBit = (sum & 0x04) / 0x04 ;
- break;
- case 4:
- ByteBit = (sum & 0x08) / 0x08 ;
- break;
- case 3:
- ByteBit = (sum & 0x10) / 0x10 ;
- break;
- case 2:
- ByteBit = (sum & 0x20) / 0x20 ;
- break;
- case 1:
- ByteBit = (sum & 0x40) / 0x40 ;
- break;
- case 0:
- ByteBit = (sum & 0x80) / 0x80;
- break;
- }
- #else
- switch(StaBit)
- {
- case 0:
- ByteBit = sum & 0x01;
- break;
- case 1:
- ByteBit = (sum & 0x02) / 0x02 ;
- break;
- case 2:
- ByteBit = (sum & 0x04) / 0x04 ;
- break;
- case 3:
- ByteBit = (sum & 0x08) / 0x08 ;
- break;
- case 4:
- ByteBit = (sum & 0x10) / 0x10 ;
- break;
- case 5:
- ByteBit = (sum & 0x20) / 0x20 ;
- break;
- case 6:
- ByteBit = (sum & 0x40) / 0x40 ;
- break;
- case 7:
- ByteBit = (sum & 0x80) / 0x80;
- break;
- }
- #endif
- sprintf(szRecv,"%d",ByteBit);
- }
- void CPB9315::SimulationCommData()
- {
- char sztemp[1024] = {0};
- sztemp[0] = 0xAB ;
- sztemp[1] = 0x04 ;
- sztemp[2] = 0x78 ;
- sztemp[3] = 0x01 ;
- // 输出线电压;
- sztemp[4] = 0x91 ;
- sztemp[5] = 0x01;
- sztemp[6] = 0x00;
- sztemp[7] = 0x00;
- sztemp[8] = 0x8F ;
- sztemp[9] = 0x01;
- sztemp[10] = 0x00;
- sztemp[11] = 0x00;
- sztemp[12] = 0x8D;
- sztemp[13] = 0x01;
- sztemp[14] = 0x00;
- sztemp[15] = 0x00;
- // 输入线电压;
- sztemp[16] = 0x70 ;
- sztemp[17] = 0x01;
- sztemp[18] = 0x00;
- sztemp[19] = 0x00;
- sztemp[20] = 0x70;
- sztemp[21] = 0x01;
- sztemp[22] = 0x00;
- sztemp[23] = 0x00;
- sztemp[24] = 0x6E;
- sztemp[25] = 0x01;
- sztemp[26] = 0x00;
- sztemp[27] = 0x00;
- // 旁路线电压;
- sztemp[28] = 0x76;
- sztemp[29] = 0x01;
- sztemp[30] = 0x00;
- sztemp[31] = 0x00;
- sztemp[32] = 0x77;
- sztemp[33] = 0x01;
- sztemp[34] = 0x00;
- sztemp[35] = 0x00;
- sztemp[36] = 0x77;
- sztemp[37] = 0x01;
- sztemp[38] = 0x00;
- sztemp[39] = 0x00;
- // 主输入电流;
- sztemp[40] = 0x14;
- sztemp[41] = 0x00;//0x00
- sztemp[42] = 0x00;
- sztemp[43] = 0x00;
- sztemp[44] = 0x13;
- sztemp[45] = 0x00;
- sztemp[46] = 0x00;
- sztemp[47] = 0x00;
- sztemp[48] = 0x13;
- sztemp[49] = 0x00;
- sztemp[50] = 0x00;
- sztemp[51] = 0x00;
- // 输出功率;
- sztemp[52] = 0xFC ;
- sztemp[53] = 0x21;
- sztemp[54] = 0x00;
- sztemp[55] = 0x00;
- // 输入功率;
- sztemp[56] = 0x5C;
- sztemp[57] = 0x2B;
- sztemp[58] = 0x00;
- sztemp[59] = 0x00;
- // 输出电量
- sztemp[60] = 0x54 ;
- sztemp[61] = 0x24;
- sztemp[62] = 0x00;
- sztemp[63] = 0x00;
- // 输入电量;
- sztemp[64] = 0x38;
- sztemp[65] = 0x31;
- sztemp[66] = 0x00;
- sztemp[67] = 0x00;
- // 输出/输入功率因子;
- sztemp[68] = 0x00;
- sztemp[69] = 0x14;
- sztemp[70] = 0x6E;
- sztemp[71] = 0x3F;
- sztemp[72] = 0x00;
- sztemp[73] = 0x47;
- sztemp[74] = 0x61;
- sztemp[75] = 0x3F;
- // 输出\输入\逆变器\旁路 频率;
- sztemp[76] = 0x32;
- sztemp[77] = 0x00;
- sztemp[78] = 0x00;
- sztemp[79] = 0x00;
- sztemp[80] = 0x32;
- sztemp[81] = 0x00;
- sztemp[82] = 0x00;
- sztemp[83] = 0x00;
-
- sztemp[84] = 0x32;
- sztemp[85] = 0x00;
- sztemp[86] = 0x00;
- sztemp[87] = 0x00;
- sztemp[88] = 0x32;
- sztemp[89] = 0x00;
- sztemp[90] = 0x00;
- sztemp[91] = 0x00;
- // 电池电流;
- sztemp[92] = 0x00;
- sztemp[93] = 0x00;
- sztemp[94] = 0x00;
- sztemp[95] = 0xC0;
- // 电池电压;
- sztemp[96] = 0xD8;
- sztemp[97] = 0x01;
- sztemp[98] = 0x00;
- sztemp[99] = 0x00;
- // 电池充电程度;
- sztemp[100] = 0x63;
- sztemp[101] = 0x00;
- sztemp[102] = 0x00;
- sztemp[103] = 0x00;
- // 电池剩余时间;
- sztemp[104] = 0x20;
- sztemp[105] = 0x09;
- sztemp[106] = 0x00;
- sztemp[107] = 0x00;
- // 逆变器相电压;
- sztemp[108] = 0xE7;
- sztemp[109] = 0x00;
- sztemp[110] = 0x00;
- sztemp[111] = 0x00;
- sztemp[112] = 0xE6;
- sztemp[113] = 0x00;
- sztemp[114] = 0x00;
- sztemp[115] = 0x00;
- sztemp[116] = 0xE8;
- sztemp[117] = 0x00;
- sztemp[118] = 0x00;
- sztemp[119] = 0x00;
- // 相负载电流;
- sztemp[120] = 0x08;
- sztemp[121] = 0x00;
- sztemp[122] = 0x00;
- sztemp[123] = 0x00;
- sztemp[124] = 0x5F;
- sztemp[125] = 0xAB;
- sztemp[126] = 0x04;
- sztemp[127] = 0x2C;
- sztemp[128] = 0x82;
- sztemp[129] = 0x0F;
- sztemp[130] = 0x00;
- sztemp[131] = 0x00;
- sztemp[132] = 0x00;
- sztemp[133] = 0x11;
- sztemp[134] = 0x00;
- sztemp[135] = 0x00;
- sztemp[136] = 0x00;
- // 相电流输出百分比;
- sztemp[137] = 0x2D;
- sztemp[138] = 0x00;
- sztemp[139] = 0x00;
- sztemp[140] = 0x00;
- sztemp[141] = 0x2D;
- sztemp[142] = 0x00;
- sztemp[143] = 0x00;
- sztemp[144] = 0x00;
- sztemp[145] = 0x2D;
- sztemp[146] = 0x00;
- sztemp[147] = 0x00;
- sztemp[148] = 0x00;
- // 电压比率;
- sztemp[149] = 0x30;
- sztemp[150] = 0x75;
- sztemp[151] = 0x00;
- sztemp[152] = 0x00;
- sztemp[153] = 0x22;
- sztemp[154] = 0x11;
- sztemp[155] = 0x11;
- sztemp[156] = 0xA0;
- sztemp[157] = 0x00;
- sztemp[158] = 0x22;
- sztemp[159] = 0x47;
- sztemp[160] = 0x13;
- // 相输出电压;
- sztemp[161] = 0xE7;
- sztemp[162] = 0x00;
- sztemp[163] = 0x00;
- sztemp[164] = 0x00;
- sztemp[165] = 0xE6;
- sztemp[166] = 0x00;
- sztemp[167] = 0x00;
- sztemp[168] = 0x00;
- sztemp[169] = 0xE5;
- sztemp[170] = 0x00;
- sztemp[171] = 0x00;
- sztemp[172] = 0x00;
- sztemp[173] = 0x45;
- memcpy(m_szTemp,sztemp,174);
- GetDataSection();
-
- }
|