Files
redAcore/PortCore.h
Charl Wentzel c50766021a Important Update:
- Still testing
- Separate Rolling Buffer from PortCore to BufferCore
- Implement BufferCore in PortCore
- Add additional Rolling Buffer functions for future
2016-05-18 15:09:02 +02:00

71 lines
1.6 KiB
C++

/*
* PortCore.h
*
* Created on: 13 May 2016
* Author: wentzelc
*/
#ifndef REDACORE_PORTCORE_H_
#define REDACORE_PORTCORE_H_
// redA Libraries
#include "BufferCore.h"
// Standard C/C++ Libraries
#include <sys/time.h>
//---------------------------------------------------------------------------
// Defines required to configure port
#define NO_PARITY 0
#define ODD_PARITY 1
#define EVEN_PARITY 2
#define MARK_PARITY 3
#define SPACE_PARITY 4
#define NO_FLOWCTRL 0
#define HW_FLOWCTRL 1
#define SW_FLOWCTRL 2
//---------------------------------------------------------------------------
// Port Core Class
class CPortCore
{
private:
// Port Def
int Handle;
char * Name;
// Port Buffer
CBuffer * Buffer;
// Input Timer
timeval InStart;
long InTimeout; // millisecs
// Input Markers
char * InMarkers;
int InMarkerLen;
// Output
int OutputHandle;
public:
CPortCore( const char * PortName, const int PortInBufSize );
~CPortCore();
bool Open();
bool Close();
bool InputConfig( long InputTimeout, const char * InputMarkers, int InputMarkerLen );
bool SerialConfig( int Baud, short DataBits, short StopBits, short Parity, short FlowCtrl, int Wait );
bool OutputConfig( int PortOutputHandle );
int GetHandle() { return Handle; };
bool Read( int MaxRead );
bool Maintain();
bool ProcessBuffer( bool Force );
};
//---------------------------------------------------------------------------
#endif /* REDACORE_PORTCORE_H_ */