📄 operationtooldlg1.cpp
字号:
#include "stdafx.h"
#include "OperationTool.h"
#include "OperationToolDlg.h"
#include <direct.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
void COperationToolDlg::mf_AddTeamName()
{
m_nTeam = -1;
m_cbTeam.ResetContent();
m_cbTeam.AddString("Get Basic Instrument Information");
m_cbTeam.AddString("Get Sensor Information");
m_cbTeam.AddString("Get Miscellaneous Information");
m_cbTeam.AddString("Get Operation Parameters");
m_cbTeam.AddString("Get Data Stored");
m_cbTeam.AddString("Set Sensor Value");
m_cbTeam.AddString("Set Operation Parameters");
m_cbTeam.AddString("Command to Slave Operation");
m_cbTeam.AddString("Command of Special Function");
}
void COperationToolDlg::mf_AddMiscellaneousInformation()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("GET_BATT");
m_cbItem.AddString("GET_TEMP");
m_cbItem.AddString("GET_LEL_DPL_UNIT");
m_cbItem.AddString("GET_MEASU_TYPE");
m_cbItem.AddString("GET_AVG_TYPE");
m_cbItem.AddString("GET_PRINT");
m_cbItem.AddString("GET_SITEUSER");
m_cbItem.AddString("GET_SECURE_BEEP");
m_cbItem.AddString("GET_POWONZERO");
}
void COperationToolDlg::mf_AddBasicInstrument()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("GET_SERIAL");
m_cbItem.AddString("GET_INSTID");
m_cbItem.AddString("GET_MODELNAME");
m_cbItem.AddString("GET_FIRMVER");
m_cbItem.AddString("GET_PRODUCTNAME");
m_cbItem.AddString("GET_SYSOPTION");
m_cbItem.AddString("GET_STATUS");
}
void COperationToolDlg::mf_AddCommandSlaveOperation()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("SET_MASKEY");
m_cbItem.AddString("SET_DISP");
m_cbItem.AddString("REQ_CHARGEON");
m_cbItem.AddString("REQ_CHARGEOFF");
m_cbItem.AddString("REQ_PUMPON");
m_cbItem.AddString("REQ_PUMPOFF");
m_cbItem.AddString("REQ_POWERON");
m_cbItem.AddString("REQ_POWEROFF");
m_cbItem.AddString("REQ_ERASE_EVENT");
m_cbItem.AddString("REQ_LOAD_FIRMWARE");
m_cbItem.AddString("REQ_GOTOMODE");
}
void COperationToolDlg::mf_AddCommandSpecialFunction()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("GET_INTERN_EE");
m_cbItem.AddString("GET_EXTERN_EE");
m_cbItem.AddString("GET_RAM");
m_cbItem.AddString("GET_PCBVER");
m_cbItem.AddString("GET_WRITE_INTER");
m_cbItem.AddString("GET_WRITE_EXTER");
m_cbItem.AddString("GET_WRITE_SN");
m_cbItem.AddString("SET_MASKEY");
}
void COperationToolDlg::mf_AddOperationParameters()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("GET_ALARM_INFO");
m_cbItem.AddString("GET_BKLIT");
m_cbItem.AddString("GET_CLOCK");
m_cbItem.AddString("GET_DILUT_RATIO");
m_cbItem.AddString("GET_HOSTSLAVE");
m_cbItem.AddString("GET_LANG_INX");
m_cbItem.AddString("GET_LASTRUNTIME");
m_cbItem.AddString("GET_LCDCONT");
m_cbItem.AddString("GET_PUMPINFO");
m_cbItem.AddString("GET_PWONNAME");
m_cbItem.AddString("GET_SECURITY");
m_cbItem.AddString("GET_WARMTIME");
m_cbItem.AddString("GET_BKLIT2");
m_cbItem.AddString("GET_CALTIME");
m_cbItem.AddString("GET_VibratorInfo");
m_cbItem.AddString("GET_VOC6PARA");
/* m_cbItem.AddString("GET_VOC7PARA");
m_cbItem.AddString("GET_LELPARA");
m_cbItem.AddString("GET_LOG_TYPE");
m_cbItem.AddString("GET_LOG_INTERVAL");
m_cbItem.AddString("GET_LOG_PERIOD");
m_cbItem.AddString("GET_LOG_LAST");
m_cbItem.AddString("GET_LOG_SCHEDULE");
m_cbItem.AddString("GET_MULTICAL");
m_cbItem.AddString("GET_USERTYPE");
m_cbItem.AddString("GET_SENSOR_SN");
m_cbItem.AddString("GET_SENSDATA");
m_cbItem.AddString("GET_RAW_BYINX");
m_cbItem.AddString("GET_GPS");
m_cbItem.AddString("GET_PUMP_RUN_TIME");
*/
}
void COperationToolDlg::mf_AddSensorInformation()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("GET_SEN_SUMMARY");
m_cbItem.AddString("GET_SENSORNAME");
m_cbItem.AddString("GET_SEN_DATAFORMAT");
m_cbItem.AddString("GET_CAL_TIME");
m_cbItem.AddString("GET_SEN_SPAN");
m_cbItem.AddString("GET_LMTLOW");
m_cbItem.AddString("GET_LMTHIGH");
m_cbItem.AddString("GET_LMTSTEL");
m_cbItem.AddString("GET_LMTTWA");
m_cbItem.AddString("GET_LMTRANGE");
m_cbItem.AddString("GET_SEN_READING");
m_cbItem.AddString("GET_SEN_ALARM");
m_cbItem.AddString("GET_SEN_LOGMAP");
m_cbItem.AddString("GET_SEN_CAL_DUE");
}
void COperationToolDlg::mf_AddSetOperationPara()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("SET_ALARM_INFO");
m_cbItem.AddString("SET_BKLIT");
m_cbItem.AddString("SET_CLOCK");
m_cbItem.AddString("SET_DILUT_RATIO");
m_cbItem.AddString("SET_HOSTSLAVE");
m_cbItem.AddString("SET_LANG_INX");
m_cbItem.AddString("SET_LCDCONT");
m_cbItem.AddString("SET_MEASU_TYPE");
m_cbItem.AddString("SET_AVG_TYPE");
m_cbItem.AddString("SET_PRINT");
m_cbItem.AddString("SET_PUMPSPD");
m_cbItem.AddString("SET_PWONMSG");
m_cbItem.AddString("SET_SETURITY");
m_cbItem.AddString("SET_SITEUSER");
m_cbItem.AddString("SET_BKLIT2");
m_cbItem.AddString("SET_USERTYPE");
m_cbItem.AddString("SET_WARMTIME");
m_cbItem.AddString("SET_POWERONZERO");
m_cbItem.AddString("SET_CALTIME");
m_cbItem.AddString("SET_LEL_DPL_UNIT");
m_cbItem.AddString("SET_SECURE_BEEP");
m_cbItem.AddString("SET_VibratorInfo");
m_cbItem.AddString("SET_VOC6PARA");
m_cbItem.AddString("SET_VOC7PARA");
m_cbItem.AddString("SET_LELPARA");
m_cbItem.AddString("SET_LOGTYPE");
m_cbItem.AddString("SET_LOG_INTERVAL");
m_cbItem.AddString("SET_LOG_PERIOD");
m_cbItem.AddString("SET_LOG_LAST");
m_cbItem.AddString("SET_LOG_SCHEDULE");
m_cbItem.AddString("SET_MULTICAL");
m_cbItem.AddString("SET_USERTYPE");
m_cbItem.AddString("SET_PUMP_RUNTIME");
}
void COperationToolDlg::mf_AddSetSensorValue()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("SET_SPAN_INX");
m_cbItem.AddString("SET_SPANGAS");
m_cbItem.AddString("SET_LMTLOW_INX");
m_cbItem.AddString("SET_LMTLOW");
m_cbItem.AddString("SET_LMTHIGH_INX");
m_cbItem.AddString("SET_LMTHIGH");
m_cbItem.AddString("SET_LMTSTEL_INX");
m_cbItem.AddString("SET_LMTSTEL");
m_cbItem.AddString("SET_LMTTWA_INX");
m_cbItem.AddString("SET_LMTTWA");
m_cbItem.AddString("SET_SENTOTAL");
}
void COperationToolDlg::mf_AddSlaveDataStored()
{
m_nItem = -1;
m_cbItem.ResetContent();
m_cbItem.AddString("GET_EVENNUM");
m_cbItem.AddString("GET_EVENTHEADER");
m_cbItem.AddString("GET_EVENDATA");
m_cbItem.AddString("GET_SIZE_DATALOG");
m_cbItem.AddString("GET_DATALOG");
m_cbItem.AddString("GET_MODE");
}
void COperationToolDlg::mf_Deal21Proc(short I_nCMDS, short I_nPacketLen, BYTE *I_pbyDataS)
{
ASSERT(I_pbyDataS != NULL);
BYTE bylocalCMDS;
bylocalCMDS = (I_nCMDS & 0xFF);
if ((bylocalCMDS >= 0x20 ) && (bylocalCMDS < 0x30 ))
{
mf_Deal212XProc(bylocalCMDS, I_nPacketLen, I_pbyDataS);
}
else if ((bylocalCMDS >= 0x30 ) && (bylocalCMDS < 0x40 ))
{
mf_Deal213XProc(bylocalCMDS, I_nPacketLen, I_pbyDataS);
}
else if ((bylocalCMDS >= 0x40 ) && (bylocalCMDS < 0x50 ))
{
mf_Deal214XProc(bylocalCMDS, I_nPacketLen, I_pbyDataS);
}
else if ((bylocalCMDS >= 0x50 ) && (bylocalCMDS < 0x70 ))
{
mf_Deal215XProc(bylocalCMDS, I_nPacketLen, I_pbyDataS);
}
else if ((bylocalCMDS >= 0x80 ) && (bylocalCMDS < 0x90 ))
{
mf_Deal218XProc(bylocalCMDS, I_nPacketLen, I_pbyDataS);
}
}
void COperationToolDlg::mf_Deal23Proc(short I_nCMDS, short I_nPacketLen, BYTE *I_pbyDataS)
{
ASSERT(I_pbyDataS != NULL);
CString strInf;
CString strLast;
strInf = "The Number of received data is:";
strLast.Format("%d", I_nPacketLen);
strInf += strLast;
strInf += "\r\n\r\n";
if (I_nCMDS == 0x238A )
{
strInf += "The Setting Unit Mode is: ";
switch(I_pbyDataS[0])
{
case 1:
strInf += "idle";
break;
case 2:
strInf += "init";
break;
case 3:
strInf += "diagnostic";
break;
case 4:
strInf += "sleep";
break;
case 5:
strInf += "Calibration";
break;
case 6:
strInf += "survey";
break;
case 7:
strInf += "transparent";
break;
case 8:
strInf += "Pc communication";
break;
case 9:
strInf += "charging";
break;
default:
strInf += " ";
break;
}
}
else
{
strInf += "Set OK.";
}
mf_DispMsg(strInf);
mf_ChangeFormat();
}
void COperationToolDlg::mf_Deal61Proc(short I_nCMDS, short I_nPacketLen, BYTE *I_pbyDataS)
{
ASSERT(I_pbyDataS != NULL);
BYTE bylocalCMDS;
CString strInf;
CString strLast;
int xyz = 0;
int nWriteByteCount = 0;
BYTE byFinishFlag = 1; //finish falg
UINT unPacketIndexHigh = 0; //Packet Index
UINT unPacketIndexLow = 0; //Packet Index
CByteArray abyExternEE; //read abyDataLog
BYTE abyDataS[VERPACKETMAX] = "";
short nParaCount;
strInf = "The Number of received data is:";
strLast.Format("%d", I_nPacketLen);
strInf += strLast;
strInf += "\n\r\n\r";
bylocalCMDS = (I_nCMDS & 0xFF);
switch(bylocalCMDS)
{
case 0x20:
if (I_nPacketLen > 0)
{
strInf += "It have data";
}
else
{
strInf += "The Return is: 0X6120 without data";
}
break;
case 0x21: //0x6021
mf_ClearFile("Extern_EE.Txt"); //clear extern memory
byFinishFlag = I_pbyDataS[0];
unPacketIndexHigh = I_pbyDataS[1];
unPacketIndexLow = I_pbyDataS[2];
nParaCount = I_nPacketLen;
while(byFinishFlag != 1)
{
if ((unPacketIndexHigh == m_abyDataH[0]) && (unPacketIndexLow == m_abyDataH[1]))
{
for (xyz=3; xyz < nParaCount; xyz++) //add data to abyDataLog
{
abyExternEE.Add(I_pbyDataS[xyz]);
}
nWriteByteCount ++;
if (nWriteByteCount == 2)
{
mf_SaveMemory("Extern_EE.TXT", abyExternEE);
nWriteByteCount = 0;
}
mf_RepeatReadData(nParaCount, abyDataS);
byFinishFlag = abyDataS[0];
unPacketIndexHigh = abyDataS[1];
unPacketIndexLow = abyDataS[2];
if (byFinishFlag == 1)
{
for (xyz=3; xyz < nParaCount; xyz++) //add data to abyDataLog
{
abyExternEE.Add(I_pbyDataS[xyz]);
}
if (abyExternEE.GetSize() > 0)
{
mf_SaveMemory("Extern_EE.Txt", abyExternEE);
}
}
} //end PacketIndexHigh
} //end while
strInf = "Please look for file Extern_EE.txt in same path";
break;
case 0x22:
if (I_nPacketLen > 0)
{
strInf += "It have data";
}
else
{
strInf += "The Return is: 0X6122 without data";
}
break;
case 0x23:
if (I_nPacketLen > 0)
{
strInf += "It have data";
}
else
{
strInf += "The Return is: 0X6123 without data";
}
break;
case 0x24:
if (I_nPacketLen > 0)
{
strInf += "It have data";
}
else
{
strInf += "The Return is: 0X6124 without data";
}
break;
case 0x25:
if (I_nPacketLen > 0)
{
strInf += "It have data";
}
else
{
strInf += "The Return is: 0X6125 without data";
}
break;
case 0x26:
if (I_nPacketLen > 0)
{
strInf += "It have data";
}
else
{
strInf += "The Return is: 0X6126 without data";
}
break;
case 0x27:
if (I_nPacketLen > 0)
{
strInf += "It have data";
}
else
{
strInf += "The Return is: 0X6127 without data";
}
break;
default:
break;
}
mf_DispMsg(strInf);
mf_ChangeFormat();
}
//
//display error message
//
void COperationToolDlg::mf_Deal71Proc(short I_nLength, BYTE *I_pbyDataS)
{
ASSERT(I_pbyDataS != NULL);
CString strInf;
CString strLast;
strInf = "The Number of received data is:";
strLast.Format("%d", I_nLength);
strInf += strLast;
strInf += "\n\r\n\r";
if (I_nLength > 0)
{
switch(I_pbyDataS[0])
{
case 0x31:
strInf += "For all failure reasons other than in the following list.";
break;
case 0x32:
strInf += "The command is not supported by this unit.";
break;
case 0x33:
strInf += "The command is supported by this unit, but the data in the command packet is not supported ";
break;
case 0x34:
strInf += "The value to be set is not valid.";
break;
case 0x35:
strInf += "No specific sensor";
break;
case 0x36:
strInf += "Not in correct mode, can not perform the command";
break;
case 0x37:
strInf += "The slave does not have the option requested.";
break;
case 0x38:
strInf += "There is no data on the specific sensor or parameter.";
break;
case 0x39:
strInf += "The value to be set is protected, can not be changed.";
break;
case 0x3A:
strInf += "Can not perform some operation due to low battery.";
break;
case 0x3B:
break;
case 0x3C:
strInf += "No gas supplied during Span Gas Calibration.";
break;
default:
strInf +="Error from SLAVE.";
break;
}
}
else
{
strInf += "Error from SLAVE.";
}
mf_DispMsg(strInf);
mf_ChangeFormat();
}
void COperationToolDlg::mf_Deal212XProc(BYTE I_byCMDS, short I_nPacLen, BYTE *I_pbyDataS)
{
ASSERT(I_pbyDataS != NULL);
int xyz;
CString strUnitInf;
CString strLast;
strUnitInf = "The Number of received data is:\t";
strLast.Format("%d\n\r", I_nPacLen);
strUnitInf += strLast;
switch (I_byCMDS)
{
case 0x20: //0x2120
strUnitInf += "The Unit Serial is:\t";
for (xyz = 0; xyz < I_nPacLen; xyz++)
{
strLast.Format("%02X", I_pbyDataS[xyz]);
strUnitInf += strLast ;
if (xyz == 1)
{
strUnitInf += "-";
}
}
break;
case 0x21: //0x2121
strUnitInf += "The Instrument ID is:\t";
strLast.Format("%02X", I_pbyDataS[0]);
strUnitInf += strLast ;
break;
case 0x22: //0x2122
strUnitInf += "The Model name is:\t";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -