Commit Graph

183 Commits

Author SHA1 Message Date
Charl Wentzel
3f568364da Important Update:
- DataTreeCore:
  - Rename enum EDataType -> EJsonDataType
- DeviceCore:
  - Rename enum EMBDataType -> EDeviceDataType
  - Add method GetNextTypeDevice() method
  - Bug fix: Add Type Name: 0 -> "none"
  - Added permanent Event Channel to TDevice
  - Add param Type to TDevice
  - Removed UpdateInterval/Timeout params & methods from TDevice
  - Separated DeviceInit() method from Init()
  - Add param DeviceInit to force/avoid DeviceInit() in Init()
  - Renamed and restructured SetUpdate() & SetParamScan() methods to:
      SetParamAccess() & SetParamEvent()
  - Converted DestroyDevice() and DestroyDeviceParam() to inline methods
  - Moved methods GetCmdParam() and HandleCommand() from CModbusInterface
  - Renamed TDeviceParam field:
    UpdateInterval/Timeout -> EventInterval/Timeout
  - Renamed TDeviceParam field: Scan -> Read
  - Added TDeviceParam field: Write
2018-12-11 19:55:44 +02:00
Charl Wentzel
07f746db2a Important Update:
- DeviceCore:
  - Add dtNone data type
  - Add Config param, reference to data tree
  - Add Init() methods, loading config from JSON
  - Add GetDataType() method, converts text to data type enum
  - Add Set/UpdateStringValue() methods with Len param
  - Clear compiler warnings, missing switch case values
2018-12-10 21:21:13 +02:00
Charl Wentzel
2ff8f556aa Important Update:
- Add "Custom" handle type to allow derived classes, e.g. BLEinterface
2018-12-09 11:13:54 +02:00
Charl Wentzel
83c192c1a6 Important Update:
- DataTreeCore:
  - Re-arrange method declaration order
  - Renamed methods Delete() to DeleteCh()
  - Added GetChName(), GetChType(), GetChLen() & ClearCh(Path) methods
- ApplicationCore:
  - Add WriteToScreen() method (Hide access to JSONparser)
2018-11-27 09:56:27 +02:00
Charl Wentzel
277798a008 Important Update:
- JSON config:
  - Move Name, Definition & AddressList under "application" object
2018-11-26 09:53:00 +02:00
Charl Wentzel
d770d9f6cb Important Update:
- LogCore:
  - Implement ReadLogLevel() & ReadLogOutput() methods
    Standardised handling of logging parameters
  - Split Log/Output in config to: Log/Output & Log/Options
  - LogOutput (Show) param: first nibble = format, second nibble = options
  - Replace Format constants (OUT_XXX) with enum ELogOutput
  - Add loRaw format - raw untouched output
  - Replace OUT_CRLF with OUT_NOCRLF - Replace \r\n with "."
  - Improved Binary output method
  - Simplified Log->Output() method
- FunctionCore, ApplicationCore:
  - Replace reading of LogConfig with new methods in LogCore
2018-11-25 18:24:36 +02:00
Charl Wentzel
bdff82f9c8 Bug fix:
- DataTreeCore:
  - Error in GetChild() return when Child not created
2018-11-25 12:07:51 +02:00
Charl Wentzel
5dd0e88708 Minor Update:
- WatchdogCore:
  - Renamed FunctionType TYPE_WATCHDOG -> TYPE_WATCHDOGPING
- ApplicationCore:
  - Prevent overwriting existing Function Type
2018-11-25 10:19:52 +02:00
Charl Wentzel
a972fb9101 Major Update:
- Implement consistent Function addition to application
  - Use TYPE_XXX constants to declare function type
  - Use NewXXXX() methods to call constructor correctly
  - Add FunctionType list (with constructor) to Application
  - Create Function by comparison to FunctionType list
- Simplify LoadConfig() and Init() methods for functions
  - Combine methods into Init() method
  - Pass relevant data member to Init() method
  - Remove all CDataMember references on functions
- ApplicationCore:
  - Split ReadParam() method from LoadConfig() method
  - Split main configuration into separate files:
    - config/ - main config file, general application settings
    - definition/ - application definition, e.g. function blocks
  - Definition and Address List files specified in config file
  - Load address file in address/ branch
  - Made DataTree & JSONparser private
  - Made Config, Definition & Address branches public
  - Removed unnecessary branch references
  - Improved event logging
- DataTreeCore:
  - Allow GetChFirstChild & GetChElement to create parent branches
    with correct type, ie. Object/Array
  - Remove unnecessary Create param from GetXxx functions
  - Bug fix: Print empty objects/arrays correct, ie. empty brackets
  - Bug fix: Adding element at specific index
  - Bug fix: Error when get/create string value with "null"
- FunctionCore:
  - Type param now set as constant via constructor
  - Create empty Handles & Channels objects if none in Config
- SelectableCore:
  - Add Queue length parameter to handles for UNIX and TCP sockets
- DeviceCore:
  - Bug fix: missing Process() method
2018-11-24 13:35:23 +02:00
Charl Wentzel
7434334280 Major Update:
- FunctionCore, SelectCore, SelectableCore, DeviceCore, FileCore:
  - Update Logs to show [ProcessName]/[FunctionName]
- SelectableCore:
  - Update ConnectTypeName array (more readable)
  - Return THandle on all OpenXxxx() methods
  - Do not remove select handle for UDPremoteClient (same handle as server)
  - Add correct Handle when adding RemoteClient to Selector
2018-11-22 11:29:55 +02:00
Charl Wentzel
e3e5aa5258 Important Update:
- Bug fix: Handle not updated in SelectCore if SelectHandle re-used
2018-11-21 14:53:16 +02:00
Charl Wentzel
bd85621b40 Bug fixes:
- DataTreeCore:
  - Incorrectly added new child to parent
- JSONparseCore:
  - Printed incomplete object (false error)
2018-11-20 12:59:21 +02:00
Charl Wentzel
6263c0f508 Important update:
- DataTreeCore:
  - Renamed Get/SetMemXxx() methods to Get/SetChXxx()
  - Renamed GetMember() to GetChild()
  - Updated: JSONparse, ApplicationCore, FunctionCore, SelectableCore,
             and WatchdogCore
  - Remove unused PrevChild & Last vars in GetChild (GetMember)
- JSONparseCore:
  - Use return values from write() and PrintXxx() methods to report fail
- SelectableCore:
  - Fix possible uninitialised FlowCtrl & Parity value
- DateTimeCore:
  - Fix possible memory overrun in temp buffer
- EventBufferCore:
  - Fix possible uninitialised value error in AddEvent
2018-11-20 11:27:09 +02:00
Charl Wentzel
278198171d Important Update:
- SelectableCore:
  - Finish UDP implementation
    - Change UDPsock to UDPserver/client/remote
    - Add OpenUDPserver/client/remote methods
    - Add ReadFrom/WriteToUDP() methods (cannot write to FD)
    - ReadFrom/WriteToFD():
      - return negative bytes on error
      - small delay between consecutive reads/writes
  - Set address correctly on resolve (for UDP or TCP)
  - Improve ReadFrom/WriteToFD() methods (improved timing & error)
  - Improve error reporting on Input/OutputHandle() methods
- CharBufferCore:
  - Standardise ReadFrom/WriteToFD() method
  - Bug fix: Peek/PeekCopy error if Data param not passed
- FileCore
  - Standardise ReadFrom/WriteToFD() method
2018-11-19 19:52:39 +02:00
Charl Wentzel
1e74b9cd60 Important Update:
- SelectableCore:
  - Bug fix: StateCallBack array to small
  - Implemented and tested UNIX sockets
  - Started implementation of UDP sockets
  - Add "TCP" to TCP socket related methods and types
2018-11-18 18:29:20 +02:00
Charl Wentzel
85a811c19f Important Bug fix:
- Fixed memory errors and leaks in DataTreeCore:
  - Initial values not set correctly for Name, Next/PrevPeer
  - Correctly set Last/FirstChild & Prev/NextPeer references on delete
  - Added methods SetValuePtr()
- Fixed memory errors and leaks in JSONparseCore:
  - Set set string/int/float values by passing pointers, ie. SetValuePtr()
2018-11-18 12:47:33 +02:00
Charl Wentzel
2382ff4527 Important Update:
- DataTreeCore:
  - Rename all Get/SetChild...() methods to Get/SetMem...()
- Update all other objects with new methods
2018-11-17 20:02:47 +02:00
Charl Wentzel
f2a1ca950a Major Update:
- DataTreeCore:
  - Merge TDataMember and CDataTree into => CDataMember
  - Each node, incl root is now CDataMember object
  - Modified function to not require BaseMember (Object is basemember)
  - Split/duplicat most functions to require, or not require child path
  - Added isNull/Object/Array/Sting() etc methods
  - Many other methods removed or restructured
- Updated DataTree usage in: JSONparseCore,
  ApplicationCore, FunctionCore, SelectableCore, WatchdogCore
2018-11-17 19:10:59 +02:00
Charl Wentzel
d36bf3230b Minor fix:
- SelectableCore:
  - Bug fix: Incorrect handle passed to Select for RemoteClient
2018-11-04 19:02:01 +02:00
Charl Wentzel
d18e046e57 Important Update:
- SelectableCore:
  - Bug fix: correct ConnectTypeNames
  - Pass handle reference to Select when adding file discriptor.
  - Rename Select vars Handle -> SelectHandle
  - Show type and name of handle on Select logs
2018-11-04 17:31:12 +02:00
Charl Wentzel
12a8ddb7ba Important Update:
- JSONparseCore:
  - Allow JSON to be parsed from string data
- DataTreeCore:
  - Allow GetMember to work with now path, ie. return BaseMember param
2018-10-28 22:36:31 +00:00
Charl Wentzel
22a05ebd4e Important update:
- Bug fix: Set constant default address/port values for
    LinePrinter, TCPserver & TCPclient
2018-10-23 11:44:38 +01:00
Charl Wentzel
4ec1dc6cd7 Important Update:
- Add Resolve Delay, allow time delay before resolving address
  Allow completion of other actions before blocking all to getaddr()
- Remove Handle->KeepAlive, assume always true
2017-12-10 21:39:55 +02:00
Charl Wentzel
75dec370f7 Minor Update:
- Fix log error on port close
2017-12-07 06:47:40 +02:00
Charl Wentzel
2c998ac7af Minor fix:
- Rename SOAP param: AutoMange/CloseDelay -> AutoManage/CloseTimeout
2017-12-06 11:10:11 +02:00
Charl Wentzel
7c33c9dbc7 Important Update:
- SelectCore:
  - Bug fix: only remove handle from read/write list if different function
2017-12-06 09:56:28 +02:00
Charl Wentzel
7f39f8b985 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
2017-12-06 08:43:25 +02:00
Charl Wentzel
3eaf0853fb 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
2017-12-01 10:56:48 +02:00
Charl Wentzel
15e6d5a645 Important Update:
- SelectableCore:
  - Simplify Handle AutoManage logic
  - Bug fix: AutoManage fail to open (WaitingToOpen) if no data written
2017-11-29 12:51:29 +02:00
Charl Wentzel
92ce01a3b7 Important Update:
- JSONparseCore:
  - Bug fix: Incorrectly terminated PrintString on null
- SelectableCore:
  - Add BaudRate, DataBits, Parity, StopBits, FlowCtrl, DataWait to THandle
  - Include Serial Port setup in SetPortHandle()
  - Read Serial Port config in LoadConfigData()
  - Rename SetSerialConfig() -> ConfigureSerialPort()
  - Configure Serial Port immediately after opening port
2017-11-29 11:30:05 +02:00
Charl Wentzel
89123fa4af Important Update:
- SelectableCore:
  - Split SetBuffers() into SetInBuffer() and SetOutBuffer()
  - Rename SerialConfig() -> SetSerialConfig()
  - Add serial port configuration (eg. baudrate) to ConfigData
  - Read only no of bytes reported by FIONREAD
- DataTree:
  - Bug fix: Create Int/Float/Bool params if requested
2017-11-28 18:35:05 +02:00
Charl Wentzel
4ed36809b8 Important update:
- Detect serial port disconnect/close
2017-11-27 18:48:41 +02:00
Charl Wentzel
d123b6ceeb Merge branch 'WatchdogCore' 2017-11-21 11:43:38 +02:00
Charl Wentzel
3eee39611f Minor update:
- LiteProtocolCore:
  - improve error logging
2017-11-21 11:42:42 +02:00
Charl Wentzel
4c6f971a7d Important update:
- Bug fix: start/end char for Watchdog protocol
2017-11-21 11:40:30 +02:00
Charl Wentzel
9f7e1b486e Important Update:
- SelectableCore:
  - Split handling of Handle from Input() to InputHandle() method
  - Allow multiple handles to be connected to single Channel
  - Update logs to report Handle, not Channel name
- TimingCore:
  - Convert all functions to inline functions in header (remove .cpp file)
  - Add new function TimeLeft()
- WatchdogCore:
  - Bug fix: No watchdog channel, use InputHandle() method not Input()
  - Bug fix: ping ignored, use To:"watchdog" in ping command
2017-11-21 10:15:26 +02:00
Charl Wentzel
c023cec697 Important update:
- Bug fix: Error when writing to closed socket
2017-11-20 15:32:21 +02:00
Charl Wentzel
c1b111e196 Important Update:
- DataTree:
  - Allow to read Null/String/Int/Float/Bool as anyone of the other types,
    except Array/Object
2017-11-20 07:41:51 +02:00
Charl Wentzel
7ef3d71af9 Important Updates:
- FunctionCore:
  - Output() returns largest no of bytes written to linked input
- SelectableCore:
  - Auto-manage:
    - Add AutoManage param -> Persistent
    - Will automatic open port if written to when Auto-Manage enabled
    - Will keep port open (re-open if closed) if Persistent = true
  - DNS resolve:
    - Set AddressFailed if port could not open/bind
    - Only use next resolved address if current address failed
2017-11-18 17:06:32 +02:00
Charl Wentzel
abba077ed0 Important Update:
- SelectableCore:
  - Skip IP address "0.0.0.0" when resolving localhost
2017-08-28 13:17:19 +02:00
Charl Wentzel
4af8f529c9 Minor Update:
- DateTimeCore:
  - Change default separators for date/time, allow no separators
- JSONparseCore:
  - Bug fix: Output escape sequences in Hexadecimal
2017-08-23 18:03:11 +02:00
Charl Wentzel
5f5e89e7cd Important update:
- EventBufferCore: (new)
  - Defines Events and related functions
  - Defines Event Buffer
- ItemBuffer:
  - Specify "Keep" parameter for Delete, to override CopyEntries
2017-08-21 20:51:10 +02:00
Charl Wentzel
2830b8dd6d Important Bug fixes:
- Remote Client connect not working properly
  - Set Client Port no on connect
  - Correctly handle create failure
  - Show error on fail
- Input() fail to transfer data if Handle & Channel not same name
  - Search for linked handles
2017-08-18 09:12:55 +02:00
Charl Wentzel
18b487cbdd Minor Update:
- JSONparseCore:
  - Simplify & correct PrintObject() and PrintArray() logic
2017-08-18 05:21:09 +02:00
Charl Wentzel
01845022a1 Merge branch 'Connect' 2017-08-17 14:41:09 +02:00
Charl Wentzel
a209065386 Minor Update:
- SelectableCore:
  - Rename struct Handle parameters:
    Address -> IPaddress, PortNo -> PortName
2017-08-17 14:23:45 +02:00
Charl Wentzel
8fd04dc9e2 Important Update:
- CItemBuffer:
  - Rename CItemBufferCore -> CItemBuffer
  - Add item count and GetCount() method
  - Bug fix: Reset LastItem on DeleteAll()
- TimingCore:
  - Bug fix: Handle buffer overflow on 32-bit processors
2017-08-17 10:56:10 +02:00
Charl Wentzel
2b7c49d5bb Important Update:
- DataTreeCore:
  - Add Parent & Prev Child links to DataMembers
  - Update CreateMember() to set Parent/Sibling reference
      & increase Parent->Len
  - Remove AddMember()
  - Update DestroyMember() to decrease Parent->Len
- JSONparseCore:
  - Update ParseArray() for above changes made to DataTreeCore
2017-08-11 15:42:59 +02:00
Charl Wentzel
73743060a0 Minor Updates:
- DataTreeCore:
  - Correct calculation of length in SetValue()
2017-08-10 21:17:32 +02:00
Charl Wentzel
c9244555ec Important update:
- LiteProtocolCore:
  - Bug fix: NewCommandStr() cannot shrink CommandStr on CreateCommand
  - Bug fix: AppendParam() cannot pass NULL string value
2017-08-06 12:32:14 +02:00