Important Update:

- SelectableCore:
  - Move Serial port config params to Port/SerialConfig
  - Only configure serial port if config setting provided in JSON file
  - Add SerialConfig param to THandle struct, set when serial config given
  - Rename method: ConfigureSerialPort() -> SetSerialPortConfig()
  - New method: GetSerialPortConfig() read serial port config into Handle
  - Split method SetPortHandle():
    - SetPortHandle() - only set port type and address
    - SetPortHandleSerial() - only set serial port parameters
This commit is contained in:
Charl Wentzel
2017-12-01 10:56:48 +02:00
parent 15e6d5a645
commit 3eaf0853fb
2 changed files with 154 additions and 57 deletions

View File

@@ -94,6 +94,7 @@ struct SHandle {
bool AddressFailed; // Indicate failure to connect to address
bool KeepAlive; // Socket keep alive
bool SerialConfig;
int Baudrate;
short DataBits;
short Parity;
@@ -257,8 +258,8 @@ public:
bool SetOutBuffer( THandle * Handle, int OutBufSize );
// Specific port parameters
bool SetPortHandle( THandle * Handle, const char * FileName,
int Baudrate, short DataBits, short Parity, short StopBits, short FlowCtrl, int DataWait );
bool SetPortHandle( THandle * Handle, const char * FileName );
bool SetPortHandleSerial( THandle * Handle, int Baudrate, short DataBits, short Parity, short StopBits, short FlowCtrl, int DataWait );
bool SetForkPipeHandle( THandle * Handle, const char * ExecPath );
bool SetSocketHandle( THandle * Handle, EConnectType Type, const char * HostName, const char * PortName, bool KeepAlive );
bool ClearHandle( THandle * Handle );
@@ -281,7 +282,8 @@ public:
inline virtual bool Write( const char * HandleName ) { return (Write( GetHandle( HandleName ))); };
inline virtual bool Write( int FD ) { return (Write( GetHandle( FD ))); };
bool ConfigureSerialPort( THandle * Handle );
bool SetSerialPortConfig( THandle * Handle );
bool GetSerialPortConfig( THandle * Handle );
// Info
inline EConnectType GetType( const char * HandleName ) {