| | |
| | | CMTerm1Doc* pDoc = (CMTerm1Doc *)GetDocument();
|
| | |
|
| | |
|
| | | int r = pDoc->Connect();
|
| | | s1.Format(_T("Open %s = %d"), pDoc->MyKLink1.MySerPort1.m_strResult, r);
|
| | | //int r = pDoc->Connect();
|
| | | int r = theApp.MyKLink1.Connect();
|
| | |
|
| | | s1.Format(_T("Open %s = %d"), theApp.MyKLink1.MySerPort1.m_strResult, r);
|
| | | SysLog(s1);
|
| | | if (r == pDoc->MyKLink1.MySerPort1.R_OK)
|
| | | if (r == theApp.MyKLink1.MySerPort1.R_OK)
|
| | | {
|
| | | pDoc->MyKLink1.Open();
|
| | | theApp.MyKLink1.Open();
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | |
| | | CMTerm1Doc* pDoc = (CMTerm1Doc *)GetDocument();
|
| | |
|
| | | pDoc->DisConnect();
|
| | | pDoc->MyKLink1.Close();
|
| | | theApp.MyKLink1.Close();
|
| | | return 0;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | unsigned short buf1[1024];
|
| | | unsigned short len1;
|
| | | int res = pDoc->MyKLink1.GetInfo(1 ,&len1, buf1);
|
| | | SysLog(pDoc->MyKLink1.m_resultStr);
|
| | | int res = theApp.MyKLink1.GetInfo(1 ,&len1, buf1);
|
| | | SysLog(theApp.MyKLink1.m_resultStr);
|
| | | CString s1;
|
| | | s1.Format(_T("GetInfo = %d %d bytes"), res,len1);
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | if (res == theApp.MyKLink1.KL_OK)
|
| | | {
|
| | | s1.Append(_T("\r\n"));
|
| | | for (int i = 0; i < len1 / 2; i++)
|
| | |
| | | CString s2;
|
| | | CString s3;
|
| | | unsigned char buf2[1024];
|
| | | res = pDoc->MyKLink1.GetUID(1, &len1, (unsigned short *)buf2);
|
| | | SysLog(pDoc->MyKLink1.m_resultStr);
|
| | | res = theApp.MyKLink1.GetUID(1, &len1, (unsigned short *)buf2);
|
| | | SysLog(theApp.MyKLink1.m_resultStr);
|
| | | s1.Format(_T("GetUID = %d %d bytes"), res,len1);
|
| | |
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | if (res == theApp.MyKLink1.KL_OK)
|
| | | {
|
| | | s1.Append(_T("\r\n"));
|
| | | for (int i = 0; i < 12; i++)
|
| | |
| | | SetDlgItemText(IDC_EDIT_DEVICE_UID, s2);
|
| | |
|
| | |
|
| | | res = pDoc->MyKLink1.GetSN(1, &len1, (unsigned short *)buf2);
|
| | | SysLog(pDoc->MyKLink1.m_resultStr);
|
| | | res = theApp.MyKLink1.GetSN(1, &len1, (unsigned short *)buf2);
|
| | | SysLog(theApp.MyKLink1.m_resultStr);
|
| | | s1.Format(_T("GetSN = %d %d bytes"), res,len1);
|
| | | s2.Empty();
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | if (res == theApp.MyKLink1.KL_OK)
|
| | | {
|
| | | s1.Append(_T("\r\n"));
|
| | | for (int i = 0; i < 4; i++)
|
| | |
| | | }
|
| | | SysLog(s1);
|
| | |
|
| | | res = pDoc->MyKLink1.ReadFactoryData(1, 0, 120, &len1, (unsigned short *)buf2);
|
| | | SysLog(pDoc->MyKLink1.m_resultStr);
|
| | | res = theApp.MyKLink1.ReadFactoryData(1, 0, 120, &len1, (unsigned short *)buf2);
|
| | | SysLog(theApp.MyKLink1.m_resultStr);
|
| | | s1.Format(_T("GetFactoryData = %d %d bytes"), res, len1);
|
| | | s2.Empty();
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | if (res == theApp.MyKLink1.KL_OK)
|
| | | {
|
| | | s1.Append(_T("\r\n"));
|
| | | for (int i = 0; i < 256 && i< len1; i++)
|
| | |
| | | */
|
| | | int res = 0;
|
| | | unsigned short len1;
|
| | | res = pDoc->MyKLink1.ReadFactoryData(1, 0, 120, &len1, (unsigned short *)buf1);
|
| | | SysLog(pDoc->MyKLink1.m_resultStr);
|
| | | res = theApp.MyKLink1.ReadFactoryData(1, 0, 120, &len1, (unsigned short *)buf1);
|
| | | SysLog(theApp.MyKLink1.m_resultStr);
|
| | | s1.Format(_T("GetFactoryData = %d %d bytes"), res,len1);
|
| | |
|
| | | GetDlgItemText(IDC_DATETIMEPICKER1, s1);
|
| | |
| | | SysLog(s1);
|
| | | }
|
| | |
|
| | | res = pDoc->MyKLink1.WriteFactoryData(1, 0, 80, buf1);
|
| | | SysLog(pDoc->MyKLink1.m_resultStr);
|
| | | res = theApp.MyKLink1.WriteFactoryData(1, 0, 80, buf1);
|
| | | SysLog(theApp.MyKLink1.m_resultStr);
|
| | | s1.Format(_T("WriteFactoryData = %d "), res);
|
| | | SysLog(s1);
|
| | | return 0;
|