Commit Graph

21 Commits

Author SHA1 Message Date
Charl Wentzel
8933ec1ae6 Important Update:
- FunctionCore:
  - Fix Memory Leaks:
    - Recreate Name in LoadConfig()
    - Setting FirstChannel to NULL in LoadConfig()
  - Fix fault on empty Log/Output in LoadConfig()
  - Check if Log/Level exists in LoadConfig()
  - Do not auto-create all config parameters
- SelectableCore:
  - Fix Memory Leaks:
    - Setting FirstHandle to NULL in LoadConfig()
  - Do not auto-create all config parameters
  - Update logs to specifically refer to "TCP" server/client
2017-07-12 06:19:06 +02:00
Charl Wentzel
3f86de71b1 Major update:
- DataTreeCore:
  - Bug fix: GetMember() error if member not found
- FunctionCore: (affected: SelectableCore, FileCore, WatchdogCore)
  - Made destructor virual
  - Standardize method parameter naming, e.g. pName, pLog
  - Renamed parameters: DebugLevel -> LogLevel, OutputDisplay -> LogOutput
  - Reinstated parameter BaseMember
  - Removed logging parameters from constructor
  - Created method InitLoggging() (shows "Function Created" message)
  - Split LoadConfig() method into parts:
    - Implemented public LoadConfig() methods
    - Implemented LoadConfigData() method, load parameters from DataTree
- WatchdogCore:
  - Derive from CSelectableCore instead of CFunctionCore
  - Rename parameter: PingTimeout -> PingInterval
  - Replace Ping Channel with Handle only
  - Add method SetInterval()
  - Send command direct to handle with (channel) Input()
- SelectableCore:
  - Rename parameters: Auto -> AutoManage, ReopenTimeout -> ReopenDelay
  - Implemented own virtual LoadConfigData() method
- DeviceCore:
  - Made all logging conditional: if (Log) Log->Message(...)
- SelectCore:
  - Renamed parameters: DebugLevel -> LogLevel
2017-07-11 06:20:14 +02:00
Charl Wentzel
4802452a7c Important Update:
- CLiteProtocol:
  - Set input string on methods to const char *
  - Simplify checking for verification
  - Ensure Length parameter can be left out on all methods
  - Add quick functions for structured commands: To, From, Command
- CLogCore:
  - Use only "\n", not "\r\n"
- SignalCore:
  - Use std::endl instead of "\r\n"
2017-07-08 22:23:50 +02:00
Charl Wentzel
748b62d235 Important Update:
- SelectableCore:
  - Made GetType() & GetState() public methods
  - Update logs in Input()
- FunctionCore:
  - Add Input/OutputEnabled parameters with Get/Set methods.
  - Update logging in Input() and Output()
  - Check if input/output enabled in Input() and Output()
2017-07-05 10:59:24 +02:00
Charl Wentzel
5b4e6822c7 Bug fixes:
- Fixed bugs on CRollingBuffer and CShiftBuffer
  - Remove "virtual" from methods declarations
  - Correct validation checks on methods
  - Use memmove to shift data in ShiftBuffer
  - Initialise buffer in RollingBuffer
  - FindStr() -> Return start position of match
  - Fix incorrect params passed to Peek()/PeekCopy() in Pop()/PopCopy()
  - Fix endless lopp in RollingBuffer::Push()
2017-03-22 07:52:58 +02:00
Charl Wentzel
b5763d7f50 Major Update: (compiling but untested)
- Replace CBuffer with CRollingBuffer and CShiftBuffer
  ShiftBuffer is faster and simpler and always zero terminates
- Updated SelectableCore to use RollingBuffer
- Add Overwrite parameter to Push() and ReadFromFD() methods
- Add PeakDirect() method for fast direct access to buffer
2017-03-22 03:43:29 +02:00
Charl Wentzel
92db4da7de Importnant update:
- Add callback functions for change in socket states
2017-02-16 03:12:18 +02:00
Charl Wentzel
c2acb4b77d Minor updates:
- CSelectableCore:
  - Allow ForkPipeHandle to change ExecPath
  - Remove parent/child process test comments
  - Move FD operations methods from private -> public
2016-10-24 17:53:50 +02:00
Charl Wentzel
7564e6a288 Major update:
- Rename Function LocalIO -> Channel (Parameters & Methods)
2016-08-23 13:19:43 +02:00
Charl Wentzel
5ea05d119e Major update:
- Logging
  - Created LogCore Class
  - Updated LogCore to use file descriptors instead of stdout
  - Add Log object reference to constructors for:
    FunctionCore, SelectCore
  - Use extern Log() object in SignalCore
- SelectableCore
  - Added new connection type: ForkedPipe
    Create pipe, fork process, connect pipe out to child stdin, exec
2016-08-22 12:14:53 +02:00
Charl Wentzel
eaace97ec9 Minor Update:
- BufferCore:
  - Method WriteToFD should ignore EAGAIN
- LogCore:
  - Add OUT_COUNT output bit (show total output bytes)
- SelectableCore:
  - Add Force param on WriteToFD, ignore EAGAIN if !Force
2016-07-27 13:42:50 +02:00
Charl Wentzel
1a9f825b25 Major Update:
- Minor fix: Set correct names in comments at top of file
- New FileCore Class:
  - Writing data to output file
- BufferCore:
  - Check for "EAGAIN" on write and retry write
- FunctionCore:
  - Add new Output method that references LocalIO directly
- SelectableCore:
  - New method SetAutomanage to specify auto re-open parameters
  - Re-open timer implemented to slow re-open events
  - Only call ProcessBuffer() if data received on socket
  - Force processing input data when no input marker set
  - Use new Output method to simplify code
  - Bug fix: Read correctly from buffer on multiple reads/writes on FD
  - Check for "EAGAIN" on write to FD and retry write
2016-07-20 09:37:25 +02:00
Charl Wentzel
6fee4d0eac Important Update:
- BufferCore:
  - Added PeekCopy and PopCopy methods
- SelectableCore:
  - Add status checking of Handle on Read and Write
  - Reject input if Handle not open
- TimingCore:
  - Added method ClearStartTime
2016-07-06 15:17:10 +02:00
Charl Wentzel
1ced40260d Minor Update:
- Added Output on Function Output events
2016-06-15 12:03:15 +02:00
Charl Wentzel
b418fa73e0 Important Update:
- LogCore:
  - Removed global DebugLevel var, now passed as parameter
  - Implemented binary output values
- FunctionCore, SelectCore and SelectableCore:
  - internal DebugLevel param implemented
  - new internal DisplayOutput param (Normal/Hex/Bin)
- BufferCore:
  - Bug fix: allow for empty search string/marker
2016-06-09 06:53:09 +02:00
Charl Wentzel
13b0a4736c Minor Update:
- Use Timeout function in SelectableCore
2016-06-02 13:44:30 +02:00
Charl Wentzel
b4073a166a 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
2016-05-27 13:32:54 +02:00
Charl Wentzel
c01c8f5e9b Major Update:
- Implemented global var DebugLevel
- Update LogCore to check DebugLevel
- Added many log messages and standadised all log messages
- Further improved validation checks on all methods
- Updated SelectCore, only remove SelectHandle from list during Test()
- Close Handles in SelectableCore destructor
Bug fixes:
- Non-blocking Client Socket Connection now working correctly
- Remove FD from Select lists at the correct time
2016-05-26 15:03:13 +02:00
Charl Wentzel
9ace97c1a3 Major update:
- General bug fixes
- Implement search for multi-character marker search in BufferCore
  Replaced FindChar() method with FindStr() method
- Implemented LocalIO and LinkedIO in FunctionCore
- Connect LocalIO with FD in SelectableCore
- Implement Write buffer with Write Select in SelectableCore
- Improve validation checks in SelectableCore
- Use Handle ptr instead of Handle Names for Config methods
2016-05-25 14:17:40 +02:00
Charl Wentzel
e83c09ecb6 Important Update:
- Converted Select functions into new class CSelectCore
- Move Read/Write code from main() to SelectableCore Read()/Write()
- Pass CSelectCore object to CSelectableCore on create
- Updated SelectCore Read/Write lists directly from SelectableCore
- SelectCore->Test() checks all FDs directly and call Read/Write functions
- Improved checking/validating for methods in SelectableCore
2016-05-24 15:02:51 +02:00
Charl Wentzel
dcfbd85efa Major Update:
- Merged SelectCore and PortCore into new SelectableCore
  Single well integrated Class
- Rename SelectCore.h to SelectableCore.h
- Create new TFileHandle structure for Ports/Sockets
- Moved buffer and Input Timeout from FunctionCore to TFileHandle
- Moved Read, Write and ProcessBuffer from FunctionCore to TFileHandle
Bug Fixes:
- malloc correct size for names
- Calculate MaxFD correctly when closing FDs
2016-05-23 14:35:15 +02:00