500 lines
17 KiB
C++
500 lines
17 KiB
C++
// DialShowDevParam.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "GeoMative.h"
|
|
#include "DialShowDevParam.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDialShowDevParam dialog
|
|
extern CGeoMativeApp theApp;
|
|
extern int g_iUILanguage;
|
|
extern float tcp_ntohf(float f);
|
|
extern int g_iOnLineVersion;
|
|
CDialShowDevParam::CDialShowDevParam(CWnd* pParent /*=NULL*/)
|
|
: CNetRequestDialog(CDialShowDevParam::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDialShowDevParam)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_iOperStatus = 0;
|
|
m_iCheckSevInfoStatus = 0;
|
|
}
|
|
|
|
|
|
void CDialShowDevParam::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CNetRequestDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDialShowDevParam)
|
|
DDX_Control(pDX, IDC_COMBO_ALRAM, m_cmbAlarm);
|
|
DDX_Control(pDX, IDC_COMBO_CABLE_TYPE, m_cmbCableType);
|
|
DDX_Control(pDX, IDC_COMBO_POWER_TRFEQ, m_cmbPowerTrefq);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDialShowDevParam, CNetRequestDialog)
|
|
//{{AFX_MSG_MAP(CDialShowDevParam)
|
|
ON_BN_CLICKED(IDC_BUTTON_CFG_DEV_PARAM, OnButtonCfgDevParam)
|
|
//}}AFX_MSG_MAP
|
|
ON_BN_CLICKED(IDC_BUTTON_SERVER_DEVINFO, &CDialShowDevParam::OnBnClickedButtonServerDevinfo)
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDialShowDevParam message handlers
|
|
|
|
BOOL CDialShowDevParam::OnInitDialog()
|
|
{
|
|
CNetRequestDialog::OnInitDialog();
|
|
|
|
// TODO: Add extra initialization here
|
|
CString strTxt = _T("");
|
|
strTxt.Format(_T("SN%u"), m_stDevParam.uiMachineID);
|
|
GetDlgItem(IDC_EDIT_DEV_SN)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("V%d.%d"),m_stDevParam.ucHWVer[0], m_stDevParam.ucHWVer[1]);
|
|
GetDlgItem(IDC_EDIT_DEV_HW_VER)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("V%d.%d.%dT%d"),m_stDevParam.ucSWVer[0], m_stDevParam.ucSWVer[1], m_stDevParam.ucSWVer[2], m_stDevParam.ucSWVer[3]);
|
|
GetDlgItem(IDC_EDIT_DEV_SW_VER)->SetWindowText(strTxt);
|
|
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("%.2f"), m_stDevParam.fTemperature);
|
|
GetDlgItem(IDC_EDIT_DEV_TEMPERATURE)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("%.2fV"), m_stDevParam.fBatteryVol);
|
|
GetDlgItem(IDC_EDIT_DEV_BATTERY_VOL)->SetWindowText(strTxt);
|
|
|
|
m_cmbPowerTrefq.AddString(_T("50HZ"));
|
|
m_cmbPowerTrefq.AddString(_T("60HZ"));
|
|
m_cmbPowerTrefq.SetCurSel(m_stDevParam.ucPowerFreq);
|
|
// strTxt = (0 == m_stDevParam.ucPowerFreq) ? _T("50HZ") : _T("60HZ");
|
|
// GetDlgItem(IDC_EDIT_DEV_POWER_FREQ)->SetWindowText(strTxt);
|
|
if (theApp.m_ucIsMultiChannel > 0)
|
|
{
|
|
if (EN_ON_LIEN_VERSION_1 == g_iOnLineVersion)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
m_cmbCableType.AddString(_T("10道双抽头线"));
|
|
m_cmbCableType.AddString(_T("20道单抽头线"));
|
|
m_cmbCableType.AddString(_T("30道单抽头线"));
|
|
}
|
|
else
|
|
{
|
|
m_cmbCableType.AddString(_T("10 dual take-outs"));
|
|
m_cmbCableType.AddString(_T("20 single take-outs"));
|
|
m_cmbCableType.AddString(_T("30 single take-outs"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
m_cmbCableType.AddString(_T("5道双抽头线"));
|
|
m_cmbCableType.AddString(_T("10道单抽头线"));
|
|
}
|
|
else
|
|
{
|
|
m_cmbCableType.AddString(_T("5 dual take-outs"));
|
|
m_cmbCableType.AddString(_T("10 single take-outs"));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (EN_ON_LIEN_VERSION_1 == g_iOnLineVersion)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
m_cmbCableType.AddString(_T("12道双抽头线"));
|
|
m_cmbCableType.AddString(_T("24道单抽头线"));
|
|
m_cmbCableType.AddString(_T("30道单抽头线"));
|
|
}
|
|
else
|
|
{
|
|
m_cmbCableType.AddString(_T("12 dual take-outs"));
|
|
m_cmbCableType.AddString(_T("24 single take-outs"));
|
|
m_cmbCableType.AddString(_T("30 single take-outs"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
m_cmbCableType.AddString(_T("5道双抽头线"));
|
|
m_cmbCableType.AddString(_T("10道单抽头线"));
|
|
m_cmbCableType.AddString(_T("30道单抽头线"));
|
|
}
|
|
else
|
|
{
|
|
m_cmbCableType.AddString(_T("5 dual take-outs"));
|
|
m_cmbCableType.AddString(_T("10 single take-outs"));
|
|
m_cmbCableType.AddString(_T("30 single take-outs"));
|
|
}
|
|
}
|
|
|
|
}
|
|
m_cmbCableType.SetCurSel(m_stDevParam.ucCableType);
|
|
theApp.m_iCableType = m_stDevParam.ucCableType;
|
|
|
|
// strTxt = GetCableType(m_stDevParam.ucCableType);
|
|
// GetDlgItem(IDC_EDIT_DEV_CABLE_TYPE)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("%d"), m_stDevParam.iGrThreshold);
|
|
GetDlgItem(IDC_EDIT_DEV_GR_THRESHOLD)->SetWindowText(strTxt);
|
|
|
|
if (LANG_ENUS == g_iUILanguage)
|
|
{
|
|
GetDlgItem(IDC_STATIC_DEV_SN)->SetWindowText("Device SN:");
|
|
GetDlgItem(IDC_STATIC_DEV_HW_VER)->SetWindowText("HW Version:");
|
|
GetDlgItem(IDC_STATIC_DEV_SW_VER)->SetWindowText("SW Version:");
|
|
GetDlgItem(IDC_STATIC_DEV_TEMPERATURE)->SetWindowText("Temperature:");
|
|
|
|
GetDlgItem(IDC_STATIC_DEV_BATTERY_VOL)->SetWindowText("Battery Voltage:");
|
|
GetDlgItem(IDC_STATIC_DEV_POWER_FREQ)->SetWindowText("Power Frequency:");
|
|
GetDlgItem(IDC_STATIC_DEV_CABLE_TYPE)->SetWindowText("Cable:");
|
|
|
|
GetDlgItem(IDC_STATIC_DEV_GR_THRESHOLD)->SetWindowText("GR Threshold:");
|
|
GetDlgItem(IDC_STATIC_DEV_BATTERY_ALARM)->SetWindowText("Battery Alarm:");
|
|
GetDlgItem(IDC_STATIC_DEV_STACKING)->SetWindowText("Stacking:");
|
|
GetDlgItem(IDC_STATIC_DEV_MAX_CHANNEL)->SetWindowText("Max Channel:");
|
|
GetDlgItem(IDC_STATIC_DEV_MAX_NUMBER)->SetWindowText(_T("Max points:"));
|
|
GetDlgItem(IDC_BUTTON_CFG_DEV_PARAM)->SetWindowText("Edit");
|
|
GetDlgItem(IDCANCEL)->SetWindowText("Close");
|
|
GetDlgItem(IDC_BUTTON_SERVER_DEVINFO)->SetWindowText(_T("Check sever information"));
|
|
// GetDlgItem(IDC_BUTTON_CFG_DEV_PARAM)->SetWindowText("Set");
|
|
|
|
|
|
SetWindowText("Device Param");
|
|
|
|
m_cmbAlarm.AddString(_T("Close"));
|
|
m_cmbAlarm.AddString(_T("Open"));
|
|
}
|
|
else
|
|
{
|
|
m_cmbAlarm.AddString(_T("关闭"));
|
|
m_cmbAlarm.AddString(_T("打开"));
|
|
}
|
|
|
|
BYTE ucAlarm = (0 == m_stDevParam.ucBatteryAlarm) ? 0 : 1;
|
|
m_cmbAlarm.SetCurSel(ucAlarm);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("%d"),m_stDevParam.ucStacking);
|
|
GetDlgItem(IDC_EDIT_DEV_STACKING)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("%d"),m_stDevParam.ucChannelNum);
|
|
theApp.m_ucMaxChannel = m_stDevParam.ucChannelNum;
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_CHANNEL)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format(_T("%d"), m_stDevParam.ucDownLoadNum);
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->SetWindowText(strTxt);
|
|
|
|
//使能不可编辑
|
|
GetDlgItem(IDC_EDIT_DEV_SN)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_HW_VER)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_SW_VER)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_TEMPERATURE)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_BATTERY_VOL)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->EnableWindow(FALSE);
|
|
m_cmbPowerTrefq.EnableWindow(FALSE);
|
|
m_cmbCableType.EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_GR_THRESHOLD)->EnableWindow(FALSE);
|
|
m_cmbAlarm.EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_STACKING)->EnableWindow(FALSE);
|
|
((CEdit*)(GetDlgItem(IDC_EDIT_DEV_GR_THRESHOLD)))->SetLimitText(5);
|
|
((CEdit*)(GetDlgItem(IDC_EDIT_DEV_STACKING)))->SetLimitText(3);
|
|
|
|
if (EN_ON_LIEN_VERSION_1 == g_iOnLineVersion)
|
|
{
|
|
//一期灰化并隐藏二期的按钮
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->ShowWindow(FALSE);
|
|
GetDlgItem(IDC_BUTTON_SERVER_DEVINFO)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_BUTTON_SERVER_DEVINFO)->ShowWindow(FALSE);
|
|
GetDlgItem(IDC_STATIC_DEV_MAX_NUMBER)->ShowWindow(FALSE);
|
|
}
|
|
|
|
if (1 == m_iCheckSevInfoStatus)
|
|
{
|
|
GetDlgItem(IDC_BUTTON_CFG_DEV_PARAM)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_BUTTON_CFG_DEV_PARAM)->ShowWindow(FALSE);
|
|
GetDlgItem(IDC_BUTTON_SERVER_DEVINFO)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_BUTTON_SERVER_DEVINFO)->ShowWindow(FALSE);
|
|
//GetDlgItem(IDD_DIALOG_DEV_PARAM_SHOW)->SetWindowText(_T("服务端设备参数信息"));
|
|
m_iCheckSevInfoStatus = 0;
|
|
|
|
CRect rec;
|
|
GetWindowRect(&rec);
|
|
rec.left += 280;
|
|
rec.right += 280;
|
|
MoveWindow(&rec);
|
|
//::SetWindowPos(NULL, NULL, rec.left, rec.top, rec.right, rec.bottom, SWP_SHOWWINDOW);
|
|
//::SetWindowPos(NULL, rec.left, rec.top, rec.right, rec.bottom, SWP_SHOWWINDOW);
|
|
}
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
CString CDialShowDevParam::GetCableType(BYTE ucCableType)
|
|
{
|
|
switch (ucCableType)
|
|
{
|
|
case 0:
|
|
return _T("12双抽头线");
|
|
case 1:
|
|
return _T("24抽头线");
|
|
case 2:
|
|
return _T("30抽头集中式线");
|
|
default:
|
|
return _T("Unknow");
|
|
}
|
|
}
|
|
void CDialShowDevParam::OnButtonCfgDevParam()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
if (EN_ON_LIEN_VERSION_1 == g_iOnLineVersion)
|
|
{
|
|
//灰化并隐藏二期的按钮
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->ShowWindow(FALSE);
|
|
GetDlgItem(IDC_BUTTON_SERVER_DEVINFO)->EnableWindow(FALSE);
|
|
GetDlgItem(IDC_BUTTON_SERVER_DEVINFO)->ShowWindow(FALSE);
|
|
}
|
|
|
|
if (0 == m_iOperStatus)
|
|
{
|
|
m_cmbPowerTrefq.EnableWindow(TRUE);
|
|
m_cmbCableType.EnableWindow(TRUE);
|
|
GetDlgItem(IDC_EDIT_DEV_GR_THRESHOLD)->EnableWindow(TRUE);
|
|
m_cmbAlarm.EnableWindow(TRUE);
|
|
GetDlgItem(IDC_EDIT_DEV_STACKING)->EnableWindow(TRUE);
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->EnableWindow(TRUE);
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
GetDlgItem(IDC_BUTTON_CFG_DEV_PARAM)->SetWindowText(_T("下发"));
|
|
else
|
|
GetDlgItem(IDC_BUTTON_CFG_DEV_PARAM)->SetWindowText(_T("Action"));
|
|
m_iOperStatus = 1;
|
|
}
|
|
else if (1 == m_iOperStatus)
|
|
{
|
|
if (-1 == m_cmbPowerTrefq.GetCurSel())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("请选择工业频率"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please select industrial frequency"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
if (-1 == m_cmbCableType.GetCurSel())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("请选择电缆类型"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please select the cable type"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
if (-1 == m_cmbAlarm.GetCurSel())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("请选择电量报警"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please select the power level alarm"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
CString strVal = _T("");
|
|
GetDlgItem(IDC_EDIT_DEV_GR_THRESHOLD)->GetWindowText(strVal);
|
|
if (strVal.IsEmpty())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("接地电阻阈值不能为空"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Ground resistance threshold cannot be null"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_stDevParam.iGrThreshold = atoi(strVal);
|
|
if (m_stDevParam.iGrThreshold < 0 || m_stDevParam.iGrThreshold > 30000)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("接地电阻阈值范围需为0-30000"));
|
|
else
|
|
MessageBoxEx(NULL, _T("The threshold range of grounding resistance shall be 0-30000"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
|
|
strVal.Empty();
|
|
GetDlgItem(IDC_EDIT_DEV_STACKING)->GetWindowText(strVal);
|
|
if (strVal.IsEmpty())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("迭代次数不能为空"));
|
|
else
|
|
MessageBoxEx(NULL, _T("The number of iterations cannot be empty"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
int iStacking = atoi(strVal);
|
|
|
|
if (iStacking< 0 || iStacking > 255)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("迭代次数数值须介于0-255之间"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Number of iterations must be between 0 and 255"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
|
|
strVal.Empty();
|
|
GetDlgItem(IDC_EDIT_DEV_MAX_NUMBER)->GetWindowText(strVal);
|
|
BYTE ucDownLoadNum;
|
|
if (strVal.IsEmpty())
|
|
{
|
|
ucDownLoadNum = m_stDevParam.ucChannelNum;
|
|
}
|
|
else
|
|
{
|
|
ucDownLoadNum = (UINT8)atoi(strVal);
|
|
}
|
|
if (ucDownLoadNum < m_stDevParam.ucChannelNum || ucDownLoadNum > 20)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("每次最大下发点数须介于通道数和20之间"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Maximum points per issue must be between channel number and 20"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
|
|
int nRet = 0;
|
|
CString strTips;
|
|
if (g_iUILanguage == LANG_ZHCN)
|
|
{
|
|
strTips.Format(_T("此操作会影响正在测试的任务,请确认服务端无正在测试的任务!\n是否继续?"));
|
|
nRet = AfxMessageBox(strTips, MB_YESNO);
|
|
}
|
|
else
|
|
{
|
|
strTips.Format(_T("This operation will affect the tasks being tested. Please make sure there are no tasks being tested on the server! \ncontinue ?"));
|
|
nRet = MessageBoxEx(NULL, strTips, STRING_MESSAGEBOXEX_TITLE, MB_YESNO, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
}
|
|
if (IDYES != nRet)
|
|
return;
|
|
m_stDevParam.ucStacking = iStacking;
|
|
m_stDevParam.ucPowerFreq = m_cmbPowerTrefq.GetCurSel();
|
|
m_stDevParam.ucCableType = m_cmbCableType.GetCurSel();
|
|
m_stDevParam.ucBatteryAlarm = m_cmbAlarm.GetCurSel();
|
|
m_stDevParam.ucDownLoadNum = ucDownLoadNum;
|
|
CNetRequestDialog::OnOK();
|
|
}
|
|
|
|
}
|
|
void CDialShowDevParam::OnBnClickedButtonServerDevinfo()
|
|
{
|
|
theApp.m_NetWorkOper.SetSuspendForThread(true);
|
|
///////////////////////////////////从云端获取历史设备信息/////////////////////////////////////////////////////
|
|
UINT32 uiDevID = htonl(m_stDevParam.uiMachineID);// m_stDevParam.uiMachineID;
|
|
PostNetRequest(EN_REQ_DOWNLOAD_DEV_INFO, this->m_hWnd, (char*)(&uiDevID), sizeof(UINT32));
|
|
// if (!theApp.m_NetWorkOper.SendCtrlMsgDirect(EN_REQ_DOWNLOAD_DEV_INFO, 0xFFFFFFFF, 1, (char*)(&uiDevID), sizeof(UINT32)))
|
|
// {
|
|
// theApp.m_NetWorkOper.SetSuspendForThread(false);
|
|
// AfxMessageBox(_T("user login information send failed"));
|
|
// return;
|
|
// }
|
|
//
|
|
// STSynDevParam *DevPar;
|
|
// int iIndex = 0;
|
|
// if (EN_RECV_SUCCESS == theApp.m_NetWorkOper.RecvMsgDirect(chMsgSyn, &iLen, 200, 5000))
|
|
// {
|
|
// if (iLen >= sizeof(STSynDevParam))
|
|
// {
|
|
// DevPar = (STSynDevParam*)chMsgSyn;
|
|
// }
|
|
// }
|
|
// theApp.m_NetWorkOper.SetSuspendForThread(false);
|
|
//
|
|
// //温度异常值判断和字节转换
|
|
// if (tcp_ntohf(DevPar->fTemperature) < 0.0f || tcp_ntohf(DevPar->fTemperature) > 150.0f) { DevPar->fTemperature = 0.0f; }
|
|
// //DevPar->ucHWVer[0] = DevPar->ucHWVer[0] - 0x30;
|
|
// //DevPar->ucHWVer[1] = DevPar->ucHWVer[1] - 0x30;
|
|
// /*DevPar->ucSWVer[0] = DevPar->ucSWVer[0] - 0x30;
|
|
// DevPar->ucSWVer[1] = DevPar->ucSWVer[1] - 0x30;
|
|
// DevPar->ucSWVer[2] = DevPar->ucSWVer[2] - 0x30;
|
|
// DevPar->ucSWVer[3] = DevPar->ucSWVer[3] - 0x30;*/
|
|
// CDialShowDevParam dialShowDebParam;
|
|
// dialShowDebParam.SetDevParam(DevPar);
|
|
// dialShowDebParam.m_iCheckSevInfoStatus = 1;
|
|
// dialShowDebParam.DoModal();
|
|
}
|
|
|
|
void CDialShowDevParam::PreNetResponse(WPARAM wParam, LPARAM lParam)
|
|
{
|
|
LPRESPONSEPACKET pResponsePacket = (LPRESPONSEPACKET)lParam;
|
|
if (pResponsePacket == NULL)
|
|
{
|
|
return;
|
|
}
|
|
switch (pResponsePacket->clsPacketBase.ucCmd)
|
|
{
|
|
case EN_REQ_DOWNLOAD_DEV_INFO:
|
|
{
|
|
STSynDevParam* DevPar = NULL;
|
|
if (pResponsePacket->wDataLen >= sizeof(STSynDevParam))
|
|
{
|
|
DevPar = (STSynDevParam*)pResponsePacket->pData;
|
|
|
|
if (NULL == DevPar)
|
|
{
|
|
ASSERT(DevPar != NULL);
|
|
return;
|
|
}
|
|
//温度异常值判断和字节转换
|
|
DevPar->fTemperature = tcp_ntohf(DevPar->fTemperature);
|
|
if (DevPar->fTemperature < 0.0f || DevPar->fTemperature > 150.0f)
|
|
{
|
|
DevPar->fTemperature = 0.0f;
|
|
}
|
|
//DevPar->ucHWVer[0] = DevPar->ucHWVer[0] - 0x30;
|
|
//DevPar->ucHWVer[1] = DevPar->ucHWVer[1] - 0x30;
|
|
/*DevPar->ucSWVer[0] = DevPar->ucSWVer[0] - 0x30;
|
|
DevPar->ucSWVer[1] = DevPar->ucSWVer[1] - 0x30;
|
|
DevPar->ucSWVer[2] = DevPar->ucSWVer[2] - 0x30;
|
|
DevPar->ucSWVer[3] = DevPar->ucSWVer[3] - 0x30;*/
|
|
CDialShowDevParam dialShowDebParam;
|
|
DevPar->uiMachineID = ntohl(DevPar->uiMachineID);
|
|
DevPar->fBatteryVol = tcp_ntohf(DevPar->fBatteryVol);
|
|
DevPar->iGrThreshold = ntohl(DevPar->iGrThreshold);
|
|
dialShowDebParam.SetDevParam(DevPar);
|
|
dialShowDebParam.m_iCheckSevInfoStatus = 1;
|
|
dialShowDebParam.DoModal();
|
|
}
|
|
else
|
|
{
|
|
if (g_iUILanguage == LANG_ZHCN)
|
|
{
|
|
AfxMessageBox(_T("尚未上传设备信息,请上传后查看"));
|
|
}
|
|
else
|
|
{
|
|
MessageBoxEx(NULL, _T("Device information has not been uploaded, please check after uploading"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
}
|
|
}
|
|
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
} |