6 #ifndef _INC_cSerialPort_H
7 #define _INC_cSerialPort_H
12 #include "../GrayLibBase.h"
46 void AttachSerial(HANDLE hComm);
48 virtual HRESULT ReadX(
void* pData,
size_t nDataSize)
override;
49 virtual HRESULT WriteX(
const void* pData,
size_t nDataSize)
override;
55 HRESULT TransmitChar(
char CChar);
58 HRESULT GetCommConfigInfo(COMMCONFIG& config);
61 static HRESULT GRAYCALL GetDefaultConfig(
int nPort, COMMCONFIG& config);
63 static HRESULT GRAYCALL SetDefaultConfig(
int nPort, COMMCONFIG& config);
66 HRESULT SetState(
const DCB& dcb);
68 HRESULT ClearError(DWORD& dwErrors);
71 HRESULT SetHandshakeOut(DWORD dwFunc);
72 HRESULT GetHandshakeOut(COMSTAT& stat);
78 HRESULT GetHandshakeInp(DWORD& dwModemStatus);
82 HRESULT SetTimeouts(
const COMMTIMEOUTS& timeouts);
83 HRESULT GetTimeouts(OUT COMMTIMEOUTS& timeouts);
88 HRESULT SetEventMask(DWORD dwEventMask);
89 HRESULT GetEventMask(DWORD& dEventwMask);
90 HRESULT WaitEvent(DWORD& dwEventMask);
93 HRESULT GetProperties(COMMPROP& properties);
96 HRESULT TerminateOutstandingWrites();
97 HRESULT TerminateOutstandingReads();
101 HRESULT SetupQueue(DWORD dwInQueue, DWORD dwOutQueue);
110 #if defined(_WIN32) && !defined(UNDER_CE)
120 int m_iOverlappedOps;
123 static void WINAPI _OnCompletion(DWORD dwErrorCode, DWORD dwCount, LPOVERLAPPED lpOverlapped);
124 virtual void OnCompletion(
LSTATUS dwErrorCode, DWORD dwCount, LPOVERLAPPED lpOverlapped);
127 HRESULT GetOverlappedResult(OVERLAPPED& overlapped, DWORD& dwBytesTransferred, BOOL bWait);
129 HRESULT Read(
void* lpBuf, DWORD dwCount, OVERLAPPED& overlapped);
130 HRESULT Write(
const void* lpBuf, DWORD dwCount, OVERLAPPED& overlapped);
134 #if defined(_WIN32) && ! defined(UNDER_CE)
135 : m_iOverlappedOps(0)
140 virtual HRESULT ReadX(
void* pData,
size_t nDataSize)
override;
141 virtual HRESULT WriteX(
const void* pData,
size_t nDataSize)
override;
143 HRESULT WaitEvent(DWORD& dwEventMask, OVERLAPPED& overlapped);
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cSerialPort.h:26
UNITTEST2_PREDEF(cSerialPort)
Definition: cOSHandle.h:59
Definition: cStream.h:456
UNITTEST2_PREDEF(cQuadtree)
LONG LSTATUS
AKA error_status_t. FACILITY_WIN32 codes returned from RegCreateKeyEx() etc. Maybe NOT GetLastError()...
Definition: HResult.h:74
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22