You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
66 lines
1.6 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 30/08/2001
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: RS232.h
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Header file of RS232.h
|
|
//----------------------------------------------------------------------------
|
|
#ifndef __CONNECTION__RS232__H__INCLUDED__
|
|
#define __CONNECTION__RS232__H__INCLUDED__
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "Connect.h"
|
|
|
|
class CConnectionRS232 :
|
|
public CConnection
|
|
{
|
|
public:
|
|
CConnectionRS232();
|
|
virtual ~CConnectionRS232();
|
|
|
|
public:
|
|
BOOL Create( LPCTSTR pPort, INT nBaudRate, INT nBitCount, INT nParity, INT nStopBit, DWORD dwReadBufferSize, DWORD dwWriteBufferSize );
|
|
void Destroy();
|
|
|
|
public:
|
|
HANDLE GetCommPortHandle() { return m_hCommPort; }
|
|
HANDLE GetOperationStopEvent() { return m_hEventQuit; }
|
|
|
|
public:
|
|
virtual DWORD Read( IN PBYTE pBuffer, IN DWORD dwSize, IN DWORD dwTimeout );
|
|
virtual DWORD Write( IN PBYTE pBuffer, IN DWORD dwSize, IN DWORD dwTimeout );
|
|
|
|
private:
|
|
HANDLE m_hCommPort;
|
|
DWORD m_dwCommMask;
|
|
OVERLAPPED m_ovWrite;
|
|
OVERLAPPED m_ovWriteWait;
|
|
OVERLAPPED m_ovRead;
|
|
OVERLAPPED m_ovReadWait;
|
|
HANDLE m_hEventQuit;
|
|
|
|
struct tagCreateParams
|
|
{
|
|
TCHAR pPort[MAX_PATH];
|
|
INT nBaudRate;
|
|
INT nBitCount;
|
|
INT nParity;
|
|
INT nStopBit;
|
|
DWORD dwReadBufferSize;
|
|
DWORD dwWriteBufferSize;
|
|
}m_CreateParams;
|
|
|
|
private:
|
|
BOOL Create();
|
|
};
|
|
|
|
#endif
|