|
@@ -11,7 +11,7 @@
|
|
|
|
|
|
char cmd_receive_start_app[6]{ 0xAA, 0x06, 0x11, 0x01, 0x94, 0xDE };
|
|
|
char cmd_send_started_app[5]{ 0xAB, 0x05, 0x0A, 0xDF, 0x4E };
|
|
|
-
|
|
|
+char cmd_send_close_app[6]{ 0xAA, 0x06, 0x11, 0x02, 0xA4, 0xBD };
|
|
|
|
|
|
|
|
|
SerialPortSlot::SerialPortSlot(CSerialPort& serialPort, HANDLE startAPPEvent)
|
|
@@ -156,6 +156,7 @@ void SerialPortManager::release()
|
|
|
m_hStartEvent = NULL;
|
|
|
}
|
|
|
|
|
|
+#include "Assist.h"
|
|
|
int SerialPortManager::listenCOMandStartApp(const TCHAR* szAppPath, const TCHAR* szAppArgs)
|
|
|
{
|
|
|
int ret = 0;
|
|
@@ -169,18 +170,18 @@ int SerialPortManager::listenCOMandStartApp(const TCHAR* szAppPath, const TCHAR*
|
|
|
ResetEvent(m_hStartEvent);
|
|
|
|
|
|
if ((ret = startAPP(szAppPath, szAppArgs)) != 0)
|
|
|
- printf("Error, startAPP failed! ret=%d\n", ret);
|
|
|
+ Assist::WriteTextLog(_T("Error, startAPP failed! ret=%d"), ret);
|
|
|
else
|
|
|
- printf("Success, startAPP finished!\n");
|
|
|
+ Assist::WriteTextLog(_T("Success, startAPP finished!\n"));
|
|
|
|
|
|
if ((ret = writeData(cmd_send_started_app, sizeof(cmd_send_started_app))) != 0)
|
|
|
- printf("Error, Respond failed! ret=%d\n", ret);
|
|
|
+ Assist::WriteTextLog(_T("Error, Respond failed! ret=%d\n"), ret);
|
|
|
else
|
|
|
- printf("Respond success!\n");
|
|
|
+ Assist::WriteTextLog(_T("Respond success!\n"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- printf("Wait for start app event error! dwRet=%ld\n", dwRet);
|
|
|
+ Assist::WriteTextLog(_T("Wait for start app event error! dwRet=%ld"), dwRet);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -192,6 +193,11 @@ int SerialPortManager::sendStartedApp()
|
|
|
return writeData(cmd_send_started_app, sizeof(cmd_send_started_app));
|
|
|
}
|
|
|
|
|
|
+int SerialPortManager::sendCloseApp()
|
|
|
+{
|
|
|
+ return writeData(cmd_send_close_app, sizeof(cmd_send_close_app));
|
|
|
+}
|
|
|
+
|
|
|
int SerialPortManager::writeData(const char* szBuf, int size)
|
|
|
{
|
|
|
int ret = 0;
|