Major Update:

- Updated all Logged messages, standardised DebugLevel:
  - dlNone   - Show startup and stop
  - dlLow    - Show creation/destruction of Function Blocks and Local IO
  - dlMedium - Show connection events, eg. open/close
  - dlHigh   - Show data flow events
-LogCore:
  - LogMessage and ShowOutput uses va_list
    only run printf if DebugLevel correct
  - Remove global LogStr[] variable
- SelectableCore:
  - Implemented Auto-management of handles
    auto open on startup/fail/close
  - Changed simple Open/Close/Read/Write methods to inline
  - Do not set Select Write trigger for server socket
  - Memory leak, setting address twice on RemoteClient
  - Bug fix, only send handle out data if DebugLevel = dlHigh
  - Bug fix, do not Read/ProcessBuffer if no InputBuffer
This commit is contained in:
Charl Wentzel
2016-05-27 13:32:54 +02:00
parent c01c8f5e9b
commit b4073a166a
7 changed files with 127 additions and 183 deletions

View File

@@ -77,6 +77,7 @@ struct SHandle {
int FD;
EConnectState State;
bool Auto;
// Buffers
CBuffer * InBuffer;
@@ -168,6 +169,7 @@ protected:
virtual int OpenClientSocket( THandle * Handle );
// Mutual Operations
virtual int Open( THandle * Handle );
virtual bool Close( THandle * Handle, bool CloseChildren = false );
virtual bool Read( THandle * Handle );
virtual bool Write( THandle * Handle );
@@ -202,7 +204,7 @@ public:
}
// Configuration
THandle * CreateHandle( const char * HandleName, bool CreateIO = false );
THandle * CreateHandle( const char * HandleName, bool CreateIO, bool AutoManage );
bool SetBuffers( THandle * Handle, int InBufSize, int OutBufSize, int InTimeout, const char * InMarker, int InMarkerLen );
bool SerialConfig( THandle * Handle, int Baud, short DataBits, short StopBits, short Parity, short FlowCtrl, int Wait );
@@ -212,16 +214,16 @@ public:
bool ClearHandle( THandle * Handle );
// FD operations
virtual int Open( const char * HandleName );
inline virtual int Open( const char * HandleName ) { return (Open( GetHandle( HandleName ))); };
virtual bool Close( const char * HandleName, bool CloseChildren = false ) { return (Close( GetHandle( HandleName ), CloseChildren )); };
virtual bool Close( int FD, bool CloseChildren = false ) { return (Close( GetHandle( FD ), CloseChildren )); };
inline virtual bool Close( const char * HandleName, bool CloseChildren = false ) { return (Close( GetHandle( HandleName ), CloseChildren )); };
inline virtual bool Close( int FD, bool CloseChildren = false ) { return (Close( GetHandle( FD ), CloseChildren )); };
virtual bool Read( const char * HandleName ) { return (Read( GetHandle( HandleName ))); };
virtual bool Read( int FD ) { return (Read( GetHandle( FD ))); };
inline virtual bool Read( const char * HandleName ) { return (Read( GetHandle( HandleName ))); };
inline virtual bool Read( int FD ) { return (Read( GetHandle( FD ))); };
virtual bool Write( const char * HandleName ) { return (Write( GetHandle( HandleName ))); };
virtual bool Write( int FD ) { return (Write( GetHandle( FD ))); };
inline virtual bool Write( const char * HandleName ) { return (Write( GetHandle( HandleName ))); };
inline virtual bool Write( int FD ) { return (Write( GetHandle( FD ))); };
// Function Interface
virtual int Input( const char *IOName, const char * Buffer, int BufLen = -1 );