diff options
| author | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
|---|---|---|
| committer | Dave Wilson <[email protected]> | 2015-03-17 19:50:07 -0700 |
| commit | 97cf5197cf5b882b2c689d8dc2b555f2edf8f418 (patch) | |
| tree | 46f3701832d70b420eb0fc0eb93261f9da45db3f /wpd/WpdBasicHardwareDriver/RS232Target.h | |
| parent | ef1905bf1e8825bb31120dfb27e0daf3154d859a (diff) | |
Initial publish
Diffstat (limited to 'wpd/WpdBasicHardwareDriver/RS232Target.h')
| -rw-r--r-- | wpd/WpdBasicHardwareDriver/RS232Target.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/wpd/WpdBasicHardwareDriver/RS232Target.h b/wpd/WpdBasicHardwareDriver/RS232Target.h new file mode 100644 index 00000000..b4754639 --- /dev/null +++ b/wpd/WpdBasicHardwareDriver/RS232Target.h @@ -0,0 +1,53 @@ +#pragma once + +class RS232Target : + public IRequestCallbackRequestCompletion +{ +public: + RS232Target(); + + ~RS232Target(); + + HRESULT Create(_In_ WpdBaseDriver* pBaseDriver, + _In_ IWDFDevice* pDevice, + HANDLE hRS232Port); + + void Delete(); + + HRESULT Start(); + + HRESULT Stop(); + + BOOL IsReady(); + + WDF_IO_TARGET_STATE GetState(); + + HRESULT SendReadRequest(); + + HRESULT SendWriteRequest(_In_reads_(cbBufferSize) BYTE* pBuffer, + size_t cbBufferSize); + +public: // IUnknown + ULONG __stdcall AddRef(); + ULONG __stdcall Release(); + HRESULT __stdcall QueryInterface(REFIID riid, void** ppv); + + // + // IRequestCallbackRequestCompletion + // + STDMETHOD_ (void, OnCompletion)(_In_ IWDFIoRequest* pWdfRequest, + _In_ IWDFIoTarget* pIoTarget, + _In_ IWDFRequestCompletionParams* pParams, + _In_ PVOID pContext); + +private: + ULONG m_cRef; + + WpdBaseDriver* m_pBaseDriver; + + // Ensure ample buffer size + BYTE m_pReadBuffer[MAX_AMOUNT_TO_READ*2]; + + CComPtr<IWDFDevice> m_pWDFDevice; + CComPtr<IWDFIoTarget> m_pFileTarget; +};
\ No newline at end of file |
