//
//
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
//  PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
//  REMAINS UNCHANGED.
//
//  Email:  yetiicb@hotmail.com
//
//  Copyright (C) 2002-2003 Idael Cardoso. 
//


#if !defined(AFX_SERIALPORT_H__731AC17A_665D_4C64_AAA7_6D284B3B7AE8__INCLUDED_)
#define AFX_SERIALPORT_H__731AC17A_665D_4C64_AAA7_6D284B3B7AE8__INCLUDED_

#include "stdafx.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CSerialPort  
{
public:
	bool Set_RTS_State(bool state);
	bool Set_DTR_State(bool state);
	bool Get_RTS_State();
	bool Get_DTR_State();
	bool Get_RI_State();
	bool Get_DSR_State();
	bool Get_CTS_State();
	bool Get_CD_State();
	virtual uint32_t Write(const LPVOID Buffer, uint32_t BufferSize);
	virtual uint32_t Read(LPVOID Buffer, uint32_t BufferSize);
	virtual bool IsOpen();
	virtual void Close();
    // Use PortName usually "COM1:" ... "COM4:" note that the name must end by ":"
	virtual bool Open(LPCTSTR PortName, uint32_t BaudRate, BYTE ByteSize, BYTE Parity, BYTE StopBits, uint32_t DesiredAccess = GENERIC_READ|GENERIC_WRITE);
	CSerialPort();
	virtual ~CSerialPort();

protected:
	HANDLE m_PortHandle;
};

#endif // !defined(AFX_SERIALPORT_H__731AC17A_665D_4C64_AAA7_6D284B3B7AE8__INCLUDED_)
