| | |
| | | {
|
| | | // TODO: 在此添加一次性构造代码
|
| | |
|
| | | MyKLink1.SetSendCallBackFunc(std::bind(&CMTerm2Doc::SendPacket, this, std::placeholders::_1, std::placeholders::_2));
|
| | | MyKLink1.SetRecvCallBackFunc(std::bind(&CMTerm2Doc::RecvPacket, this, std::placeholders::_1, std::placeholders::_2));
|
| | | StartTime = myHvSerialPort1.GetTimemS();
|
| | | KLink::stCallBackFuncs callbackfuncs;
|
| | | callbackfuncs.OpenFunc = std::bind(&HvSerialPort::Open, &myHvSerialPort1);
|
| | | callbackfuncs.CloseFunc = std::bind(&HvSerialPort::Close, &myHvSerialPort1);
|
| | | callbackfuncs.ClearBufFunc = std::bind(&HvSerialPort::ClearBuf, &myHvSerialPort1);
|
| | | // callbackfuncs.SendPkgFunc = std::bind(&CMTerm2Doc::SendPacket, this, std::placeholders::_1, std::placeholders::_2);
|
| | | // callbackfuncs.RecvPkgFunc = std::bind(&CMTerm2Doc::RecvPacket, this, std::placeholders::_1, std::placeholders::_2);
|
| | |
|
| | | callbackfuncs.SendPkgFunc = std::bind(&HvSerialPort::Send, &myHvSerialPort1, std::placeholders::_1, std::placeholders::_2);
|
| | | callbackfuncs.RecvPkgFunc = std::bind(&HvSerialPort::Recv, &myHvSerialPort1, std::placeholders::_1, std::placeholders::_2);
|
| | |
|
| | | MyKLink1.SetCallBackFuncs(&callbackfuncs);
|
| | |
|
| | | // MyKLink1.SetSendCallBackFunc(std::bind(&CMTerm2Doc::SendPacket, this, std::placeholders::_1, std::placeholders::_2));
|
| | | // MyKLink1.SetRecvCallBackFunc(std::bind(&CMTerm2Doc::RecvPacket, this, std::placeholders::_1, std::placeholders::_2));
|
| | | // StartTime = myHvSerialPort1.GetTimemS();
|
| | | }
|
| | |
|
| | | CMTerm2Doc::~CMTerm2Doc()
|
| | |
| | | int CMTerm2Doc::DoPLCMonitor()
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | CString s1;
|
| | | if (m_bSimulate) {
|
| | | int nDataType = MyKLink1.KLDataTypeWX;
|
| | | int nDataAddr = 0;
|
| | |
| | | int nDataCount = 4;
|
| | | int res;
|
| | | res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.WX);// (unsigned char *)&KMem.DT[nDataAddr]);
|
| | | if (res != MyKLink1.KL_OK) {
|
| | | s1.Format(_T("R:= %d %s \r\n"), res, MyKLink1.m_resultStr);
|
| | | SysLog(s1);
|
| | | }
|
| | |
|
| | | nDataType = MyKLink1.KLDataTypeWY;
|
| | | nDataAddr = 0;
|
| | | nDataCount = 4;
|
| | | res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.WY);// (unsigned char *)&KMem.DT[nDataAddr]);
|
| | |
|
| | | if (res != MyKLink1.KL_OK) {
|
| | | s1.Format(_T("R:= %d %s \r\n"), res, MyKLink1.m_resultStr);
|
| | | SysLog(s1);
|
| | | }
|
| | | nDataType = MyKLink1.KLDataTypeWR;
|
| | | nDataAddr = 0;
|
| | | nDataCount = 10;
|
| | | res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.WR);// (unsigned char *)&KMem.DT[nDataAddr]);
|
| | |
|
| | | if (res != MyKLink1.KL_OK) {
|
| | | s1.Format(_T("R:= %d %s \r\n"), res, MyKLink1.m_resultStr);
|
| | | SysLog(s1);
|
| | | }
|
| | | nDataType = MyKLink1.KLDataTypeDT;
|
| | | nDataAddr = 0;
|
| | | nDataCount = 80;
|
| | | res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.DT);// (unsigned char *)&KMem.DT[nDataAddr]);
|
| | |
|
| | | if (res != MyKLink1.KL_OK) {
|
| | | s1.Format(_T("R:= %d %s \r\n"), res, MyKLink1.m_resultStr);
|
| | | SysLog(s1);
|
| | | }
|
| | | nDataType = MyKLink1.KLDataTypeSV;
|
| | | nDataAddr = 0;
|
| | | nDataCount = 40;
|
| | | res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.SV);// (unsigned char *)&KMem.DT[nDataAddr]);
|
| | |
|
| | | if (res != MyKLink1.KL_OK) {
|
| | | s1.Format(_T("R:= %d %s \r\n"), res, MyKLink1.m_resultStr);
|
| | | SysLog(s1);
|
| | | }
|
| | | nDataType = MyKLink1.KLDataTypeEV;
|
| | | nDataAddr = 0;
|
| | | nDataCount = 40;
|
| | | res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.EV);// (unsigned char *)&KMem.DT[nDataAddr]);
|
| | |
|
| | | if (res != MyKLink1.KL_OK) {
|
| | | s1.Format(_T("R:= %d %s \r\n"), res, MyKLink1.m_resultStr);
|
| | | SysLog(s1);
|
| | | }
|
| | | }
|
| | |
|
| | | return 0;
|