New file |
| | |
| | | // CDialogDateTime.cpp: 实现文件
|
| | | //
|
| | |
|
| | | #include "pch.h"
|
| | | #include "MultiTerminal1.h"
|
| | | #include "CDialogDateTime.h"
|
| | | #include "afxdialogex.h"
|
| | | #include "KLinkProtocol.h"
|
| | |
|
| | | // CDialogDateTime 对话框
|
| | |
|
| | | IMPLEMENT_DYNAMIC(CDialogDateTime, CDialogEx)
|
| | |
|
| | | CDialogDateTime::CDialogDateTime(CWnd* pParent /*=nullptr*/)
|
| | | : CDialogEx(IDD_DIALOG_DATETIME, pParent)
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | CDialogDateTime::~CDialogDateTime()
|
| | | {
|
| | | }
|
| | |
|
| | | void CDialogDateTime::DoDataExchange(CDataExchange* pDX)
|
| | | {
|
| | | CDialogEx::DoDataExchange(pDX);
|
| | | }
|
| | |
|
| | |
|
| | | BEGIN_MESSAGE_MAP(CDialogDateTime, CDialogEx)
|
| | | ON_BN_CLICKED(IDC_BUTTON_SUBMIT, &CDialogDateTime::OnBnClickedButtonSubmit)
|
| | | ON_WM_TIMER()
|
| | | END_MESSAGE_MAP()
|
| | |
|
| | |
|
| | | // CDialogDateTime 消息处理程序
|
| | |
|
| | |
|
| | | BOOL CDialogDateTime::OnInitDialog()
|
| | | {
|
| | | CDialogEx::OnInitDialog();
|
| | |
|
| | | // TODO: 在此添加额外的初始化
|
| | | ((CButton *)GetDlgItem(IDC_CHECK_SYSTIME))->SetCheck(1);
|
| | | SetTimer(1, 300, NULL);
|
| | | return TRUE; // return TRUE unless you set the focus to a control
|
| | | // 异常: OCX 属性页应返回 FALSE
|
| | | }
|
| | |
|
| | | int CDialogDateTime::ShowParams()
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | return 0;
|
| | | }
|
| | |
|
| | |
|
| | | int CDialogDateTime::UpdateDisplay()
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | CString s1;
|
| | | if (((CButton *)GetDlgItem(IDC_CHECK_SYSTIME))->GetCheck())
|
| | | {
|
| | | CTime time1;
|
| | | time1 = time1.GetTickCount();
|
| | |
|
| | | int year = time1.GetYear();
|
| | | s1.Format(_T("%02d"), year);
|
| | | SetDlgItemText(IDC_EDIT_YEAR, s1);
|
| | | int mon = time1.GetMonth();
|
| | | s1.Format(_T("%02d"), mon);
|
| | | SetDlgItemText(IDC_EDIT_MONTH, s1);
|
| | | int day = time1.GetDay();
|
| | | s1.Format(_T("%02d"), day);
|
| | | SetDlgItemText(IDC_EDIT_DAY, s1);
|
| | |
|
| | | int hour = time1.GetHour();
|
| | | s1.Format(_T("%02d"), hour);
|
| | | SetDlgItemText(IDC_EDIT_HOUR, s1);
|
| | | int min = time1.GetMinute();
|
| | | s1.Format(_T("%02d"), min);
|
| | | SetDlgItemText(IDC_EDIT_MINUTE, s1);
|
| | | int sec=time1.GetSecond();
|
| | | s1.Format(_T("%02d"), sec);
|
| | | SetDlgItemText(IDC_EDIT_SECOND, s1);
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | |
|
| | | void CDialogDateTime::OnTimer(UINT_PTR nIDEvent)
|
| | | {
|
| | | // TODO: 在此添加消息处理程序代码和/或调用默认值
|
| | | if (nIDEvent == 1)
|
| | | {
|
| | | UpdateDisplay();
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | }
|
| | | CDialogEx::OnTimer(nIDEvent);
|
| | | }
|
| | |
|
| | |
|
| | | void CDialogDateTime::OnBnClickedButtonSubmit()
|
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | int year, mon, day;
|
| | | int hour, min, sec;
|
| | |
|
| | | year = GetDlgItemInt(IDC_EDIT_YEAR);
|
| | | mon = GetDlgItemInt(IDC_EDIT_MONTH);
|
| | | day = GetDlgItemInt(IDC_EDIT_DAY);
|
| | |
|
| | | hour = GetDlgItemInt(IDC_EDIT_HOUR);
|
| | | min = GetDlgItemInt(IDC_EDIT_MINUTE);
|
| | | sec = GetDlgItemInt(IDC_EDIT_SECOND);
|
| | | tm tm1;
|
| | | tm1.tm_year = year;
|
| | | tm1.tm_mon = mon;
|
| | | tm1.tm_mday = day;
|
| | |
|
| | | tm1.tm_hour = hour;
|
| | | tm1.tm_min = min;
|
| | | tm1.tm_sec = sec;
|
| | |
|
| | | CTime time1(year,mon,day,hour,min,sec);
|
| | | __time32_t time2 = time1.GetTime();
|
| | | MyKLProtocol1.SetDateTime32(1, time2);
|
| | | // MyKLProtocol1.WriteDataByte(1, 4, MyKLProtocol1.KLDataTypeSDT, 36, (unsigned char *)&time2);
|
| | |
|
| | | }
|
| | |
|
| | |
|
New file |
| | |
| | | #pragma once
|
| | |
|
| | |
|
| | | // CDialogDateTime 对话框
|
| | |
|
| | | class CDialogDateTime : public CDialogEx
|
| | | {
|
| | | DECLARE_DYNAMIC(CDialogDateTime)
|
| | |
|
| | | public:
|
| | | CDialogDateTime(CWnd* pParent = nullptr); // 标准构造函数
|
| | | virtual ~CDialogDateTime();
|
| | |
|
| | | // 对话框数据
|
| | | #ifdef AFX_DESIGN_TIME
|
| | | enum { IDD = IDD_DIALOG_DATETIME };
|
| | | #endif
|
| | |
|
| | | protected:
|
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
| | |
|
| | | DECLARE_MESSAGE_MAP()
|
| | | public:
|
| | | afx_msg void OnBnClickedButtonSubmit();
|
| | | virtual BOOL OnInitDialog();
|
| | | afx_msg void OnTimer(UINT_PTR nIDEvent);
|
| | | int ShowParams();
|
| | | int UpdateDisplay();
|
| | | };
|
| | |
| | | res = MyKLProtocol1.GetEventLog(1, i, nReadCount, &KEventLogs[i]);
|
| | | s1.Format(_T(" Get EventLog %d Result r=%d "),i, res);
|
| | | s1.AppendFormat(_T("%d %d %d %d %d %d"), KEventLogs[i].Sign1, KEventLogs[i].Seq1, KEventLogs[i].nTime, KEventLogs[i].nType, KEventLogs[i].nParam1, KEventLogs[i].nParam2);
|
| | | SysLog(s1);
|
| | | // SysLog(s1);
|
| | | s1.Format(_T("%d"), i);
|
| | | m_list_eventlog.InsertItem(i, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[i].Seq1);
|
| | | m_list_eventlog.SetItemText(i, 1, s1);
|
| | |
|
| | | s1.Format(_T("%d"), KEventLogs[i].nTime);
|
| | | CTime ctime1 = KEventLogs[i].nTime;
|
| | | s1 = ctime1.Format(_T("%Y-%m-%d %H:%M:%S"));
|
| | |
|
| | | m_list_eventlog.SetItemText(i, 2, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[i].nType);
|
| | | m_list_eventlog.SetItemText(i, 3, s1);
|
| | |
| | | m_list_eventlog.SetItemText(i, 4, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[i].nParam2);
|
| | | m_list_eventlog.SetItemText(i, 5, s1);
|
| | |
|
| | | }
|
| | |
|
| | | return 0;
|
| | |
| | | pPacket->Cmd = nCMD;
|
| | | pPacket->Type1 = Type;
|
| | | int Datalen = 0;
|
| | | int nWordAddr;
|
| | | int nWordCount;
|
| | |
|
| | | switch (nCMD)
|
| | | {
|
| | | case KLCmdNone:
|
| | |
| | |
|
| | | pKLStat pStat = (pKLStat)&(pPacket->Stat);
|
| | | int Datalen = 0;
|
| | | int nWordAddr;
|
| | | int nWordCount;
|
| | |
|
| | | switch (nCMD)
|
| | | {
|
| | | case KLCmdNone:
|
| | |
| | | ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nCount, m_DataBuf);
|
| | | return KL_OK;
|
| | | }
|
| | | int KLinkProtocol::ReadBits(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values)
|
| | | int KLinkProtocol::ReadBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values)
|
| | | {
|
| | | return KL_OK;
|
| | | }
|
| | | int KLinkProtocol::WriteBits(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values)
|
| | | int KLinkProtocol::WriteBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values)
|
| | | {
|
| | | return KL_OK;
|
| | | }
|
| | | int KLinkProtocol::ReadBitsByWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT *Values)
|
| | | int KLinkProtocol::ReadBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values)
|
| | | {
|
| | | return KL_OK;
|
| | | }
|
| | | int KLinkProtocol::WriteBitsByWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT *Values)
|
| | | int KLinkProtocol::WriteBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values)
|
| | | {
|
| | | return KL_OK;
|
| | | }
|
| | |
| | | return m_nSeq;
|
| | | }
|
| | |
|
| | | int KLinkProtocol::ReadDataByte(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values)
|
| | | int KLinkProtocol::ReadDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values)
|
| | | {
|
| | | m_Dst = nDst;
|
| | | m_resultStr.Empty();
|
| | | UCHAR nExpSeq = GetNextSeq();
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdReadDataByte, nType, nByteAddr/2, nCount);
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdReadDataByte, nType, nByteAddr/2, nByteCount);
|
| | | SendPacket(m_Packetbuf, len1);
|
| | | int numToRead = sizeof(stKLRplyPktHdr) + nCount;
|
| | | int numToRead = sizeof(stKLRplyPktHdr) + nByteCount;
|
| | | int len2 = 0;
|
| | | int nTryCount = 0;
|
| | | for (int i = 0; i < 2; i++)
|
| | |
| | |
|
| | | return KL_OK;
|
| | | }
|
| | | int KLinkProtocol::WriteDataByte(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values)
|
| | | int KLinkProtocol::WriteDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values)
|
| | | {
|
| | | m_Dst = nDst;
|
| | | UCHAR nExpSeq = GetNextSeq();
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteDataByte, nType, nByteAddr/2, nCount, Values);
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteDataByte, nType, nByteAddr/2, nByteCount, Values);
|
| | | SendPacket(m_Packetbuf, len1);
|
| | | int len2 = RecvPacket(m_RecvBuf, 64);
|
| | | if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); }
|
| | |
| | | return res;
|
| | | }
|
| | |
|
| | | int KLinkProtocol::ReadDataWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | int KLinkProtocol::ReadDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | {
|
| | | m_Dst = nDst;
|
| | | UCHAR nExpSeq = GetNextSeq();
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdReadDataWord, nType, nWordAddr, nCount);
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdReadDataWord, nType, nWordAddr, nWordCount);
|
| | | SendPacket(m_Packetbuf, len1);
|
| | | int len2 = RecvPacket(m_RecvBuf, 64);
|
| | | if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); }
|
| | |
| | | Values[0] = m_DataBuf[0];
|
| | | return res;
|
| | | }
|
| | | int KLinkProtocol::WriteDataWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | int KLinkProtocol::WriteDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | {
|
| | | m_Dst = nDst;
|
| | | UCHAR nExpSeq = GetNextSeq();
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteDataWord, nType, nWordAddr, nCount, Values);
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteDataWord, nType, nWordAddr, nWordCount, Values);
|
| | | SendPacket(m_Packetbuf, len1);
|
| | | int len2 = RecvPacket(m_RecvBuf, 64);
|
| | | if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); }
|
| | |
| | | return res;
|
| | | }
|
| | |
|
| | | int KLinkProtocol::ReadData(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | int KLinkProtocol::ReadData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | {
|
| | | m_Dst = nDst;
|
| | | UCHAR nExpSeq = GetNextSeq();
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdReadData, nType, nWordAddr,nCount);
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdReadData, nType, nWordAddr, nWordCount);
|
| | | SendPacket(m_Packetbuf, len1);
|
| | | int len2 = RecvPacket(m_RecvBuf, 64);
|
| | | if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); }
|
| | |
| | |
|
| | | return KL_OK;
|
| | | }
|
| | | int KLinkProtocol::WriteData(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | int KLinkProtocol::WriteData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | {
|
| | | m_Dst = nDst;
|
| | | UCHAR nExpSeq = GetNextSeq();
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteData, nType, nWordAddr, nCount, Values);
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteData, nType, nWordAddr, nWordCount, Values);
|
| | | SendPacket(m_Packetbuf, len1);
|
| | | int len2 = RecvPacket(m_RecvBuf, 64);
|
| | | if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); }
|
| | |
| | |
|
| | | return KL_OK;
|
| | | }
|
| | | int KLinkProtocol::GetInfo(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | int KLinkProtocol::GetInfo(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values)
|
| | | {
|
| | | m_Dst = nDst;
|
| | | UCHAR nExpSeq = GetNextSeq();
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdGetInfo, nType, nWordAddr, nCount, Values);
|
| | | int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdGetInfo, nType, nWordAddr, nWordCount, Values);
|
| | | SendPacket(m_Packetbuf, len1);
|
| | | int len2 = RecvPacket(m_RecvBuf, 64);
|
| | | if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); }
|
| | |
| | | return KL_OK;
|
| | | }
|
| | |
|
| | | int KLinkProtocol::GetDateTime32(UCHAR nDst, UINT * pValue)
|
| | | {
|
| | | int res = KL_OK;
|
| | | res = ReadDataByte(nDst, 4, KLDataTypeSDT, 36, (UCHAR *)pValue);
|
| | | return res;
|
| | |
|
| | | }
|
| | |
|
| | | int KLinkProtocol::SetDateTime32(UCHAR nDst, UINT Value)
|
| | | {
|
| | | int res = KL_OK;
|
| | | res = WriteDataByte(nDst, 4, KLDataTypeSDT, 36, (UCHAR *)&Value);
|
| | | return res;
|
| | | }
|
| | |
|
| | |
|
| | |
| | | int ProcessPacket(void *pBuf, int nLen);
|
| | | int ParseRplyPacket(void *pBuf, int nPkgLen, UCHAR * nCmd, UCHAR * Status, USHORT* nCount, void * pData);
|
| | |
|
| | | int GetInfo(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int GetInfo(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int GetSN(UCHAR nDst, int * nCount);
|
| | | int GetUID(UCHAR nDst, int * nCount);
|
| | | int GetTime32(UCHAR nDst, int * nCount);
|
| | | int SetTime32(UCHAR nDst, int * nCount);
|
| | | //int GetTime32(UCHAR nDst, int * nCount);
|
| | | //int SetTime32(UCHAR nDst, int * nCount);
|
| | | int GetDateTime32(UCHAR nDst, UINT * pValue);
|
| | | int SetDateTime32(UCHAR nDst, UINT Value);
|
| | |
|
| | |
|
| | | int GetEventLogCount(UCHAR nDst, int * nCount);
|
| | |
| | |
|
| | | int ReadBit(UCHAR nDst, UCHAR nType,USHORT nBitAddr, UCHAR * Value);//Read 1 Single bit
|
| | | int WriteBit(UCHAR nDst, UCHAR nType,USHORT nBitAddr, UCHAR Value);//Write 1 Single bit
|
| | | int ReadBits(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values);
|
| | | int WriteBits(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values);
|
| | | int ReadBitsByWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT *Values);
|
| | | int WriteBitsByWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT *Values);
|
| | | int ReadBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values);
|
| | | int WriteBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values);
|
| | | int ReadBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values);
|
| | | int WriteBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values);
|
| | |
|
| | | int ReadDataByte(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values);
|
| | | int WriteDataByte(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values);
|
| | | int ReadDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values);
|
| | | int WriteDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values);
|
| | |
|
| | | int ReadDataWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int WriteDataWord(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int ReadDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int WriteDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | |
|
| | | int ReadData(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int WriteData(UCHAR nDst, UCHAR nCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int ReadData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | | int WriteData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values);
|
| | |
|
| | |
|
| | |
|
| | |
| | | <ClInclude Include="CDialogCommSet1.h" />
|
| | | <ClInclude Include="CDialogCommTest.h" />
|
| | | <ClInclude Include="CDialogDataMon.h" />
|
| | | <ClInclude Include="CDialogDateTime.h" />
|
| | | <ClInclude Include="CDialogEventLog.h" />
|
| | | <ClInclude Include="CDialogForceIO.h" />
|
| | | <ClInclude Include="CDialogInfoDisplay.h" />
|
| | |
| | | <ClInclude Include="targetver.h" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <ClCompile Include="..\MyLib\Utils.cpp" />
|
| | | <ClCompile Include="CAnsiParser.cpp" />
|
| | | <ClCompile Include="CDataParser1.cpp" />
|
| | | <ClCompile Include="CDialogCoilMon.cpp" />
|
| | | <ClCompile Include="CDialogCommSet1.cpp" />
|
| | | <ClCompile Include="CDialogCommTest.cpp" />
|
| | | <ClCompile Include="CDialogDataMon.cpp" />
|
| | | <ClCompile Include="CDialogDateTime.cpp" />
|
| | | <ClCompile Include="CDialogEventLog.cpp" />
|
| | | <ClCompile Include="CDialogForceIO.cpp" />
|
| | | <ClCompile Include="CDialogInfoDisplay.cpp" />
|
| | |
| | | <ClInclude Include="CDialogForceIO.h">
|
| | | <Filter>头文件</Filter>
|
| | | </ClInclude>
|
| | | <ClInclude Include="CDialogDateTime.h">
|
| | | <Filter>头文件</Filter>
|
| | | </ClInclude>
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <ClCompile Include="MultiTerminal1.cpp">
|
| | |
| | | <ClCompile Include="CDialogForceIO.cpp">
|
| | | <Filter>源文件</Filter>
|
| | | </ClCompile>
|
| | | <ClCompile Include="..\MyLib\Utils.cpp">
|
| | | <Filter>源文件</Filter>
|
| | | </ClCompile>
|
| | | <ClCompile Include="CDialogDateTime.cpp">
|
| | | <Filter>源文件</Filter>
|
| | | </ClCompile>
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <ResourceCompile Include="MultiTerminal1.rc">
|
| | |
| | |
|
| | | #include "CDialogProgress.h"
|
| | | #include "CDialogEventLog.h"
|
| | | #include "CDialogDateTime.h"
|
| | | #include "CDialogForceIO.h"
|
| | |
|
| | | #ifdef _DEBUG
|
| | |
| | | ON_COMMAND(ID_MENU_EVENT_LOG, &CMultiTerminal1Dlg::OnMenuEventLog)
|
| | | ON_COMMAND(ID_MENU_COMM_TEST, &CMultiTerminal1Dlg::OnMenuCommTest)
|
| | | ON_COMMAND(ID_MENU_FORCE_IO, &CMultiTerminal1Dlg::OnMenuForceIo)
|
| | | ON_COMMAND(ID_MENU_DATETIME, &CMultiTerminal1Dlg::OnMenuDatetime)
|
| | | END_MESSAGE_MAP()
|
| | |
|
| | |
|
| | |
| | |
|
| | | // TODO: 在此添加额外的初始化代码
|
| | |
|
| | | CString VersionStr = _T("V1.01");
|
| | | CString BuildStr = _T("20210423");
|
| | | CString VersionStr = _T("V1.02");
|
| | | CString BuildStr = _T("20210728");
|
| | |
|
| | | MyLogger1.AttachWnd(GetDlgItem(IDC_EDIT_LOG1)->m_hWnd);
|
| | | MyLogger1.bShowLog[0] = 1;
|
| | |
| | |
|
| | | s1.AppendFormat(_T("跳线 %02X %s 当前 %02X\r\n"), MyKLProtocol1.MEM.SDD[0], intToBinString(MyKLProtocol1.MEM.SDD[0]), MyKLProtocol1.MEM.SDD[1]);
|
| | | // s1.AppendFormat(_T("当前跳线 %02X %s\r\n"), MyKLProtocol1.MEM.SDD[1], intToBinString(MyKLProtocol1.MEM.SDD[1]));
|
| | | s1.AppendFormat(_T("Tick计数 %d \r\n"), MyKLProtocol1.MEM.SDD[2]);
|
| | | s1.AppendFormat(_T("03 nRunCount %d \r\n"), MyKLProtocol1.MEM.SDD[3]);
|
| | | s1.AppendFormat(_T("Tick计数 %u \r\n"), MyKLProtocol1.MEM.SDD[2]);
|
| | | s1.AppendFormat(_T("03 nRunCount %u \r\n"), MyKLProtocol1.MEM.SDD[3]);
|
| | | s1.AppendFormat(_T("04 RunStat %d \r\n"), MyKLProtocol1.MEM.SDD[4]);
|
| | | s1.AppendFormat(_T("05 ErrStat %d \r\n"), MyKLProtocol1.MEM.SDD[5]);
|
| | | s1.AppendFormat(_T("06 PwrOnCount %d \r\n"), MyKLProtocol1.MEM.SDD[6]);
|
| | | s1.AppendFormat(_T("07 ThisRunTime %d \r\n"), MyKLProtocol1.MEM.SDD[7]);
|
| | |
|
| | | int nTime1 = MyKLProtocol1.MEM.SDD[7];
|
| | | s1.AppendFormat(_T("%dd %02d:%02d:%02d \r\n"), nTime1 / 86400, nTime1 / 3600 % 24, nTime1 / 60 % 60, nTime1 % 60);
|
| | | s1.AppendFormat(_T("08 TotalTime %d \r\n"), MyKLProtocol1.MEM.SDD[8]);
|
| | |
| | | CString s3;
|
| | | _tctime32_s(s3.GetBuffer(1024),1024, &time1);
|
| | | s3.ReleaseBuffer();
|
| | | s1.Append(s3 + _T("\r\n"));
|
| | |
|
| | | CTime ctime1;
|
| | | ctime1=time1;
|
| | | s3=ctime1.Format(_T("%Y-%m-%d %H:%M:%S"));
|
| | | s1.Append(s3 + _T("\r\n"));
|
| | | // s1.AppendFormat(_T("%04d-%02d-%02d %02d:%02d:%02d \r\n"), nTime1 / 86400, nTime1 / 3600 % 24, nTime1 / 60 % 60, nTime1 % 60);
|
| | | s1.AppendFormat(_T("10 PwrFailCount %d \r\n"), MyKLProtocol1.MEM.SDD[10]);
|
| | | s1.AppendFormat(_T("11 LastPwrFailTime %d \r\n"), MyKLProtocol1.MEM.SDD[11]);
|
| | |
| | | time1 = nTime1;
|
| | | _tctime32_s(s3.GetBuffer(1024), 1024, &time1);
|
| | | s3.ReleaseBuffer();
|
| | | ctime1 = time1;
|
| | | ctime1 += (30 * 365 + 7 ) * 24 * 3600 ;
|
| | | ctime1 = CStringToCTime(_T("2000-01-01 08:00:00"));
|
| | | s3 = ctime1.Format(_T("%Y-%m-%d %H:%M:%S"));
|
| | | s1.Append(s3 + _T("\r\n"));
|
| | |
|
| | | s1.AppendFormat(_T("12 LastScanTime uS %d \r\n"), MyKLProtocol1.MEM.SDD[12]);
|
| | |
| | | void CMultiTerminal1Dlg::OnBnClickedButtonConnect()
|
| | | {
|
| | | OnMenuOnline();
|
| | | if (!m_bResourceOpened)
|
| | | {
|
| | | return;
|
| | | }
|
| | | m_bMonitoring = false;
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | }
|
| | |
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | OnMenuOnline();
|
| | | if (! m_bResourceOpened)
|
| | | {
|
| | | return;
|
| | | }
|
| | | m_bMonitoring = false;
|
| | | OnMenuMonitor();
|
| | | return;
|
| | |
| | | CDialogForceIO dialog1;
|
| | | INT_PTR r = dialog1.DoModal();
|
| | | }
|
| | |
|
| | |
|
| | | void CMultiTerminal1Dlg::OnMenuDatetime()
|
| | | {
|
| | | // TODO: 在此添加命令处理程序代码
|
| | | CDialogDateTime dialog1;
|
| | | INT_PTR r = dialog1.DoModal();
|
| | | }
|
| | |
| | | afx_msg void OnMenuEventLog();
|
| | | afx_msg void OnMenuCommTest();
|
| | | afx_msg void OnMenuForceIo();
|
| | | afx_msg void OnMenuDatetime();
|
| | | };
|
| | |
| | | #include <afxcontrolbars.h>
|
| | | #include <afxcontrolbars.h>
|
| | | #include <afxcontrolbars.h>
|
| | | #include <afxcontrolbars.h>
|
| | |
|
| | | #endif //PCH_H
|
| | |
| | | #define IDD_DIALOG_PROGRESS 155
|
| | | #define IDD_DIALOG_EVENTLOG 157
|
| | | #define IDD_DIALOG_FORCE_IO 159
|
| | | #define IDD_DIALOG_DATETIME 161
|
| | | #define IDC_EDIT_LOG1 1001
|
| | | #define IDC_STATIC_STATUS_CON 1002
|
| | | #define IDC_COMBO_RES 1003
|
| | |
| | | #define IDC_EDIT1 1068
|
| | | #define IDC_EDIT2 1069
|
| | | #define IDC_RADIO4 1070
|
| | | #define IDC_EDIT_DAY 1070
|
| | | #define IDC_RADIO5 1071
|
| | | #define IDC_EDIT_HOUR 1071
|
| | | #define IDC_RADIO6 1072
|
| | | #define IDC_EDIT_MINUTE 1072
|
| | | #define IDC_RADIO7 1073
|
| | | #define IDC_EDIT_SECOND 1073
|
| | | #define IDC_RADIO8 1074
|
| | | #define IDC_RADIO9 1075
|
| | | #define IDC_RADIO10 1076
|
| | |
| | | #define IDC_BUTTON_ON 1094
|
| | | #define IDC_BUTTON_OFF 1095
|
| | | #define IDC_STATIC_INFO 1096
|
| | | #define IDC_CHECK_SYSTEMTIME 1097
|
| | | #define IDC_CHECK_SYSTIME 1097
|
| | | #define IDC_BUTTON_SUBMIT 1098
|
| | | #define IDC_EDIT_YEAR 1099
|
| | | #define IDC_EDIT_MONTH 1100
|
| | | #define ID_BUTTON32771 32771
|
| | | #define ID_BUTTON32772 32772
|
| | | #define ID_BUTTON32773 32773
|
| | |
| | | #define ID_32830 32830
|
| | | #define ID_MENU_COMM_TEST 32831
|
| | | #define ID_MENU_FORCE_IO 32832
|
| | | #define ID_MENU_DATETIME 32833
|
| | | #define ID_MENU_PASSWORD 32834
|
| | |
|
| | | // Next default values for new objects
|
| | | //
|
| | | #ifdef APSTUDIO_INVOKED
|
| | | #ifndef APSTUDIO_READONLY_SYMBOLS
|
| | | #define _APS_NEXT_RESOURCE_VALUE 161
|
| | | #define _APS_NEXT_COMMAND_VALUE 32833
|
| | | #define _APS_NEXT_CONTROL_VALUE 1097
|
| | | #define _APS_NEXT_RESOURCE_VALUE 163
|
| | | #define _APS_NEXT_COMMAND_VALUE 32835
|
| | | #define _APS_NEXT_CONTROL_VALUE 1101
|
| | | #define _APS_NEXT_SYMED_VALUE 101
|
| | | #endif
|
| | | #endif
|
| | |
| | | #include "StdAfx.h"
|
| | | #include "pch.h"
|
| | | //#include "StdAfx.h"
|
| | | #include "Utils.h"
|
| | | #include <list>
|
| | | #include <regex>
|