Important update:

- SelectableCore:
  - Rename methods: SetSerialPortConfig() -> WriteSerialConfig(),
      GetSerialPortConfig() -> ReadSerialConfig(),
      InputHandle() -> OutputHandle(),
      ProcessBuffer() -> ProcessInputBuffer()
      SetPortHandle(config)() -> SetSerialHandle(Config)()
  - Rename serial port identification: "Port" -> "SerialPort"
    - Update logs accordingly
  - Add LinePrinter Port
    - Add to LoadConfig()
    - Add SetLinePrinterHandle() & OpenLinePrinterPort() methods
    - Add handling for open/read/write/close events
  - Add CloseDelay for AutoManage (non-persistent) ports
    - Rename handle timer: ReopenStart -> LastAction
    - Reset timer on all open/read/write/close events
    - Check for Close timeout in Process() and close port
    - Remove CloseChildren parameter on Close() method
    - Add QuickReopen parameter to Close() method
- SelectCore:
  - Overwrite existing handle - not yet removed
  - Handle In/Out baudrate on serial port separately
This commit is contained in:
Charl Wentzel
2017-12-06 08:43:25 +02:00
parent 3eaf0853fb
commit 7f39f8b985
4 changed files with 352 additions and 176 deletions

View File

@@ -93,18 +93,20 @@ void CSelect::Add( int FD, bool Read, bool Write, CSelectableCore * Function )
while (*Handle && ((*Handle)->FD != FD)) {
Handle = &((*Handle)->Next);
}
// Create if not exist
if (!*Handle) {
// Create
if (*Handle) {
// Old handle not yet removed, remove from read/write lists
Remove( FD, true, true );
}
else {
// Create if not exist
*Handle = (TSelectHandle*)malloc( sizeof(TSelectHandle) );
memset( *Handle, 0, sizeof(TSelectHandle) );
// Set Parameters
(*Handle)->FD = FD;
(*Handle)->Function = Function;
(*Handle)->FD = FD;
}
// Set Parameters
(*Handle)->Function = Function;
// Add Read select
if (Read && !(*Handle)->Read) {
(*Handle)->Read = true;