Major update:

- 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
This commit is contained in:
Charl Wentzel
2016-05-19 15:10:55 +02:00
parent e222d51997
commit 0d1c46ac53
8 changed files with 370 additions and 205 deletions

View File

@@ -9,10 +9,10 @@
#define REDACORE_PORTCORE_H_
// redA Libraries
#include "BufferCore.h"
#include "FunctionCore.h"
// Standard C/C++ Libraries
#include <sys/time.h>
/* none */
//---------------------------------------------------------------------------
@@ -29,41 +29,29 @@
//---------------------------------------------------------------------------
// Port Core Class
class CPortCore
class CPortCore : public CFunctionCore
{
private:
// Port Def
int Handle;
char * Name;
// Port Buffer
CBuffer * Buffer;
// Input Timer
timeval InStart;
long InTimeout; // millisecs
protected:
// Input Markers
char * InMarkers;
int InMarkerLen;
// Output
int OutputHandle;
// Device Interfaces
int Handle;
public:
CPortCore( const char * PortName, const int PortInBufSize );
~CPortCore();
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 );
bool OutputConfig( int PortOutputHandle );
int GetHandle() { return Handle; };
int GetPortFD() { return Handle; };
bool Read( int MaxRead );
bool Maintain();
bool ProcessBuffer( bool Force );
virtual int Input( int InputID, char * Buffer, int BufLen );
virtual bool ProcessBuffer( bool Force );
};
//---------------------------------------------------------------------------