55 lines
953 B
C++
55 lines
953 B
C++
#pragma once
|
|
|
|
#include "ehs/EHS.h"
|
|
|
|
namespace ehs
|
|
{
|
|
enum class Parity : UInt_8
|
|
{
|
|
NONE,
|
|
ODD,
|
|
EVEN,
|
|
MARK,
|
|
SPACE
|
|
};
|
|
|
|
enum class StopBits : UInt_8
|
|
{
|
|
ONE,
|
|
ONE_POINT_FIVE,
|
|
TWO
|
|
};
|
|
|
|
class EHS_LIB_IO COM
|
|
{
|
|
private:
|
|
UInt_8 port;
|
|
UInt_32 baudRate;
|
|
UInt_8 byteSize;
|
|
Parity parity;
|
|
StopBits stopBits;
|
|
void* hdl;
|
|
bool initialized;
|
|
|
|
public:
|
|
COM();
|
|
|
|
COM(const UInt_8 port, const UInt_32 baudRate, const UInt_8 byteSize, const Parity parity, const StopBits stopBits);
|
|
|
|
COM(const COM& com) = default;
|
|
|
|
void Initialize();
|
|
|
|
void UnInitialize();
|
|
|
|
UInt_32 Wait();
|
|
|
|
void Transmit(const Char_8 data);
|
|
|
|
UInt_32 Send(const Char_8* data, const UInt_32 size);
|
|
|
|
UInt_32 Receive(const Char_8* data, const UInt_32 size);
|
|
|
|
void Flush();
|
|
};
|
|
} |