瀏覽代碼

API接口缺少extern ,导致调用失败。

sat23 4 年之前
父節點
當前提交
2507c413b6
共有 2 個文件被更改,包括 11 次插入11 次删除
  1. 3 3
      SerialWatch/SerialWatch/SerialWatch.cpp
  2. 8 8
      SerialWatch/SerialWatch/SerialWatch.h

+ 3 - 3
SerialWatch/SerialWatch/SerialWatch.cpp

@@ -120,18 +120,18 @@ SERIALWATCH_API bool RTK_USBUpgrade(BYTE byKey)
 		// 回车;
 		SendCommand(_T("\r"), 5, 500);
 		// 判断是否出现console字样;
-		if ( WatchWord(_T("console:/")) ) {
+		if ( WatchWord(_T("console:/"), 3000) ) {
 #ifdef _DEBUG
 			printf("找到关键字\n");
 #endif
 			// 重启;
-			SendCommand(_T("reboot\r"), 1);	
+			SendCommand(_T("reboot\r"), 1, 0);	
 			if ( WatchWord(_T("Terminated"), 100) ) {
 				ClearBuffer();
 				DWORD dwTickCount = GetTickCount();
 				while ( TRUE ) {
 					// 连续发送150次按键;
-					SendCommand((LPCTSTR)&byKey, 150);
+					SendCommand((LPCTSTR)&byKey, 150, 0);
 					if ( byKey == 0x1B ){ // ESC键;
 						if ( WatchWord(_T("Realtek>"), 150) ) {
 #ifdef _DEBUG

+ 8 - 8
SerialWatch/SerialWatch/SerialWatch.h

@@ -12,18 +12,18 @@
 
 
 // 打开串口;
-SERIALWATCH_API BOOL OpenTVPort(int nPort, DWORD dwBaudrate = 115200, BYTE ByteSize = 8, BYTE Parity = NOPARITY, BYTE StopBits = 1);
+extern "C" SERIALWATCH_API BOOL OpenTVPort(int nPort, DWORD dwBaudrate, BYTE ByteSize, BYTE Parity, BYTE StopBits);
 // 串口是否打开;
-SERIALWATCH_API BOOL IsOpen();
+extern "C" SERIALWATCH_API BOOL IsOpen();
 // 关闭串口;
-SERIALWATCH_API void CloseTVPort();
+extern "C" SERIALWATCH_API void CloseTVPort();
 // 开启监听;
-SERIALWATCH_API void StartMonitor();
+extern "C" SERIALWATCH_API void StartMonitor();
 // 发送指令;//命令、发送次数、每次间隔多少毫秒;
-SERIALWATCH_API void SendCommand(LPCTSTR lpCommand, int nSendCount = 1, int nSleep = 0);
+extern "C" SERIALWATCH_API void SendCommand(LPCTSTR lpCommand, int nSendCount, int nSleep );
 // 清空Buffer;//在监听关键字前清空;
-SERIALWATCH_API void ClearBuffer();
+extern "C" SERIALWATCH_API void ClearBuffer();
 // 监听指定关键字是否出现;
-SERIALWATCH_API bool WatchWord(LPCTSTR lpWatchWord, int nWatchTime = 3000);
+extern "C" SERIALWATCH_API bool WatchWord(LPCTSTR lpWatchWord, int nWatchTime);
 // RTK的升级方案;
-SERIALWATCH_API bool RTK_USBUpgrade(BYTE byKey);
+extern "C" SERIALWATCH_API bool RTK_USBUpgrade(BYTE byKey);