diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd1a6c..7d59485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,22 @@ # CSerialPort Changelog - --- +## v4.3.0 (2023-02-15) + +Feature: +* readEvent replace with CSerialPortListener 使用CSerialPortListener进行读取事件通知 +* replace std::string with const char* as much as possible 尽可能使用const char*代替std::string +* add function getReadBufferUsedLen() to get used buffer length 增加getReadBufferUsedLen函数用于获取缓冲区长度 +* add LOG_INFO to output CSerialPort info 增加LOG_INFO输出串口信息 + +## v4.2.2 (2023-02-15) + +Feature: +* read event notify with portName and readBufferLen 读取事件通知支持串口名称与长度 +* add function getReadBufferUsedLen() to get used buffer length 增加getReadBufferUsedLen函数用于获取缓冲区长度 +* add LOG_INFO to output CSerialPort info 增加LOG_INFO输出串口信息 + ## v4.2.1 (2022-11-07) Feature: diff --git a/README.md b/README.md index 0b5252b..094ff93 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,8 @@ CSerialPort was tested on the following platforms # Latest version -## Version: 4.2.1.221107 -by itas109 on 2022-11-07 +## Version: 4.3.0.230215 +by itas109 on 2023-02-15 # Quick Start @@ -75,7 +75,7 @@ run demo ( for example serial port lookback test on linux) ``` CSerialPort/bin $ ./bin/CSerialPortDemoNoGui -Version: https://github.com/itas109/CSerialPort - V4.2.1.221107 +Version: https://github.com/itas109/CSerialPort - V4.3.0.230215 availableFriendlyPorts: 1 - /dev/ttyS0 diff --git a/README_zh_CN.md b/README_zh_CN.md index 9320353..56fd899 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -59,8 +59,8 @@ CSerialPort已经在以下平台做过测试 # Latest version 最新版本 -## Version: 4.2.1.221107 -by itas109 on 2022-11-07 +## Version: 4.3.0.230215 +by itas109 on 2023-02-15 # Quick Start 快速开始 @@ -76,7 +76,7 @@ $ cmake --build . ``` CSerialPort/bin $ ./bin/CSerialPortDemoNoGui -Version: https://github.com/itas109/CSerialPort - V4.2.1.221107 +Version: https://github.com/itas109/CSerialPort - V4.3.0.230215 availableFriendlyPorts: 1 - /dev/ttyS0 diff --git a/VERSION b/VERSION index 801cd11..d1c7b0a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.2.1.221107 +4.3.0.230215 \ No newline at end of file diff --git a/doc/CSerialPort_doc_cn.chm b/doc/CSerialPort_doc_cn.chm index 2faf939..af7b1de 100644 Binary files a/doc/CSerialPort_doc_cn.chm and b/doc/CSerialPort_doc_cn.chm differ diff --git a/doc/CSerialPort_doc_en.chm b/doc/CSerialPort_doc_en.chm index 0f6f12f..00a8ad1 100644 Binary files a/doc/CSerialPort_doc_en.chm and b/doc/CSerialPort_doc_en.chm differ diff --git a/include/CSerialPort/SerialPort_version.h b/include/CSerialPort/SerialPort_version.h index f892a5a..c18ba8f 100644 --- a/include/CSerialPort/SerialPort_version.h +++ b/include/CSerialPort/SerialPort_version.h @@ -14,7 +14,7 @@ #define __CSERIALPORT_VERSION_H__ #define CSERIALPORT_COPYRIGHT "Copyright (C) 2014 itas109. All Rights Reserved." -#define CSERIALPORT_VERSION "4.2.1.221107" +#define CSERIALPORT_VERSION "4.3.0.230215" #define CSERIALPORT_VERSION_MAJOR 4 #define CSERIALPORT_VERSION_MINOR 2 #define CSERIALPORT_VERSION_PATCH 1 diff --git a/test/CSerialPortVirtual.cpp b/test/CSerialPortVirtual.cpp index d3ae628..2e0e718 100644 --- a/test/CSerialPortVirtual.cpp +++ b/test/CSerialPortVirtual.cpp @@ -3,7 +3,7 @@ #ifdef _WIN32 #include -#include // _T +#include //_T #else #include // perror #include // openpty @@ -24,7 +24,30 @@ CSerialPortVirtual::~CSerialPortVirtual() {} bool CSerialPortVirtual::createPair(char *portName1, char *portName2) { #ifdef _WIN32 - return false; + bool ret = false; + HINSTANCE libInst; + + if (8 == sizeof(char *)) // 64bit application + { + libInst = LoadLibrary(_T("VSPDCTL64.DLL")); + } + else + { + libInst = LoadLibrary(_T("VSPDCTL.DLL")); + } + + if (libInst) + { + typedef bool(__stdcall * CreatePairFn)(char *Port1, char *Port2); + CreatePairFn CreatePair = (CreatePairFn)GetProcAddress(libInst, "CreatePair"); + if (CreatePair) + { + ret = CreatePair(portName1, portName2); // portName1 = "COM1", portName2 = "COM2" + } + FreeLibrary(libInst); + } + + return ret; #else int error = -1; @@ -109,7 +132,30 @@ bool CSerialPortVirtual::createPair(char *portName1, char *portName2) bool itas109::CSerialPortVirtual::deletePair(char *portName) { #ifdef _WIN32 - return false; + bool ret = false; + HINSTANCE libInst; + + if (8 == sizeof(char *)) // 64bit application + { + libInst = LoadLibrary(_T("VSPDCTL64.DLL")); + } + else + { + libInst = LoadLibrary(_T("VSPDCTL.DLL")); + } + + if (libInst) + { + typedef bool(__stdcall * DeletePairFn)(char *Port1); + DeletePairFn DeletePair = (DeletePairFn)GetProcAddress(libInst, "DeletePair"); + if (DeletePair) + { + ret = DeletePair(portName); + } + FreeLibrary(libInst); + } + + return ret; #else return true; #endif diff --git a/test/CSerialPortVirtual.h b/test/CSerialPortVirtual.h index ee41f28..0af78bf 100644 --- a/test/CSerialPortVirtual.h +++ b/test/CSerialPortVirtual.h @@ -19,10 +19,11 @@ class CSerialPortVirtual CSerialPortVirtual(); ~CSerialPortVirtual(); - static bool createPair(char *portName1, char *portName2); - static bool deletePair(char *portName); + static bool createPair(char* portName1, char* portName2); + static bool deletePair(char* portName); private: + }; } // namespace itas109 #endif //__CSERIALPORT_VIRTUAL_H__