/* * 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 //--------------------------------------------------------------------------- // 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_ */