#pragma once

#include "GlobalDefs.h"
#include "struct.h"
#include "windows.h"
#include "SysTime.h"
#include "SysPerfTimer.h"
#include "Status.h"

class Serial
{
public:
	Serial( Status *pStatus, char *commPort );
	~Serial(void);

	bool Init();
	bool WriteString( char *cmd );
	bool WriteString( char *cmd, UINT8 len );
	bool ReadString( char *cmd, UINT32 *bytesRead );
	bool ReadString( char *cmd, UINT32 bytesToRead, UINT32 *bytesRead );
	void Purge() { PurgeComm( m_hCom, PURGE_RXCLEAR | PURGE_TXCLEAR ); }

private:
	HANDLE			m_hCom;
	Status			*m_pStatus;
	char				m_chCommPort[48];

};

