添加项目文件。

This commit is contained in:
ldh
2026-11-06 14:55:37 +08:00
parent 6ae1d524c9
commit b6cf723cad
19 changed files with 2266 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include "link.h"
#include <windows.h>
namespace ts660b
{
// 基于 Win32 通信 API 的串口链路。
// 参数与 Tdg7ChlDriver 保持一致:8N1、无流控、DTR/RTS 关闭。
class Win32ByteLink : public IByteLink
{
public:
Win32ByteLink() = default;
~Win32ByteLink() override { Close(); }
bool Open(const wchar_t* portName, int baudRate) override;
void Close() override;
bool IsOpen() const override { return handle_ != INVALID_HANDLE_VALUE; }
bool Write(const char* data, int length) override;
int Read(char* buffer, int capacity, int timeoutMs) override;
void Purge() override;
private:
HANDLE handle_ = INVALID_HANDLE_VALUE;
};
}