You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
802 B
C++

#pragma once
#include <functional>
#include "ComComm.h"
//对第三方com 再封装一次
class CCommMgr
{
public:
CCommMgr(void);
~CCommMgr(void);
bool Open(DWORD dwPort, DWORD dwBaudRate = 9600);
bool Open(DWORD dwPort, char *szSetStr);
void Close();
void SetWnd(HWND hWnd);
void SetNotify(std::function<void()> _pfn);
void SetWorkMode(BOOL bSleep, DWORD dwOutTime);
DWORD Write(const char *szBuffer);
DWORD WriteBuf(LPVOID Buffer, DWORD dwBufferLength);
std::string ReadStr();
DWORD ReadBuf(char *szBuffer,DWORD dwBufferLength);
int Read(LPVOID Buffer, DWORD dwBufferLength);
bool IsOpen(){return m_Com.IsOpen();};
void SetBufferSize(DWORD dwInputSize, DWORD dwOutputSize);
int GetInputSize();
private:
ComComm m_Com;//PLC 串口管理对象
};