- Converted CSocketCore to Class/Object - Implemented CFunctionCore as base class for CPortCore and CSocketCore - Moved common functions to CFunctionCore and renamed eg. Maintain() -> Process() - Pass Objects directly to each other as OutputFunction - New Input() method allows data transfer between objects
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
/*
|
|
* PortCore.h
|
|
*
|
|
* Created on: 13 May 2016
|
|
* Author: wentzelc
|
|
*/
|
|
|
|
#ifndef REDACORE_PORTCORE_H_
|
|
#define REDACORE_PORTCORE_H_
|
|
|
|
// redA Libraries
|
|
#include "FunctionCore.h"
|
|
|
|
// Standard C/C++ Libraries
|
|
/* none */
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// 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 : public CFunctionCore
|
|
{
|
|
protected:
|
|
// Input Markers
|
|
char * InMarkers;
|
|
int InMarkerLen;
|
|
|
|
// Device Interfaces
|
|
int Handle;
|
|
|
|
public:
|
|
CPortCore( const char * PortName );
|
|
virtual ~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 );
|
|
int GetPortFD() { return Handle; };
|
|
|
|
virtual int Input( int InputID, char * Buffer, int BufLen );
|
|
|
|
virtual bool ProcessBuffer( bool Force );
|
|
};
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif /* REDACORE_PORTCORE_H_ */
|