Commit Graph

169 Commits

Author SHA1 Message Date
Charl Wentzel
253eb91824 Important Update:
- FunctionCore:
  - Add OldState to ChannelStateEvent()
  - Add new method ChannelOutState()
  - Update Logging levels
- SelectableCore:
  - Restart LastAction timer of Name Resolve fail (cause delayed re-open)
- Watchdog:
  - Move JSON PingInterval param to "Config" object
2019-06-10 17:25:31 +02:00
Charl Wentzel
7787da5119 Important Update:
- Complete Async resolve:
  - Remove Resolving param from THandle
  - Rename state csResolving -> csPreparing
  - Added handle state csPrepared, to indicated resolve complete
  - Open handle if state = csPrepared
  - Remove Resolve delay (not required since async resolve)
    - remove from JSON config as well
2019-06-10 10:44:51 +02:00
Charl Wentzel
bde14a13da Major Update:
- FunctionCore
  - Replace Channel->Ready with Channel->State (off/waiting/ready)
  - Add Function reference to Handle
- SelectableBare/Core:
  - Implement async address resolve with event handling
    - Create ResolveHandler() signal handler (friend) function
  - Change Create/Remove/DestroyHandle() methods to virtual methods
    - Move socket specific code to SelectableCore
  - Rename ChangeState() to virtual HandleState()
  - Move ClearHandle() from SelectableBare -> SelectableCore
  - Implement new/delete from THandle
  - Set max TCP SYN count on connect
2019-06-09 22:05:27 +02:00
Charl Wentzel
08fce64629 Important Update:
- FunctionCore
  - So not set Function JSON "config" param to empty object by default
  - Change TChannelLink to reference Channel direct
  - Add Input/Output to TChannelLink
    - Replace LinkChannel() Bidirectional param with Input/Output param
    - Update JSON config as well
  - Implement Channel "Ready" state and events
    - Remove Input/OutputEnabled parameters and related methods
    - Remove from JSON config as well
    - Update AddChannel() method accordingly
  - Add Ref param to struct TChannel
- SelectableCore:
  - Convert inline ChangeState() to non-inline method
  - Move ChangeState() to last step in open/close methods
  - Add Channels in Not Ready state
  - Change Channel state when Handle state changed
- DeviceCore:
  - Add Channels in Ready state
- FileCore:
  - Add Channel in Not Ready state
2019-06-05 19:13:04 +02:00
Charl Wentzel
fa6825b72a Important Update:
- FunctionCore/SelectableCore/FileCore/DeviceCore:
  - Remove InputChannels
    - Only OutputChannels -> LinkedChannels
    - Remove PullInput/Output() methods
    - Remove StoredOutput
  - Add References to channels and linked channels
    - Send SourceRef with output
    - Receive TargetRef with input
    - Filter output channels based on TargetRef
2019-06-04 18:35:23 +02:00
Charl Wentzel
7459763eb6 Important Update:
- Remove unused: FunctionCore-ChannelBuffer
- DataTreeCore:
  - Bug fix: Set Len=0 on element Clear()
- SelectableBare/Core:
  - Move move BuildArgs() to SelectableBare
  - Make OutputHandle() to virtual method
- UtilCore:
  - Bug fix: Handle NoCrLF correctly in BytesToSafeStr()
2019-06-02 16:12:42 +02:00
Charl Wentzel
ac649bf4fb Minor Update:
- DeviceCore:
  - Initialise params in header file
- JSONparseCore:
  - Increase Read buffer to handle large queries
- UtilCore:
  - Bug fix: handle NULL seperator in Hex conversions
2019-05-28 09:22:28 +02:00
Charl Wentzel
316b27b19f Important Update:
- DeviceCore:
  - Allow adjustable reply timeout with SetWaitForReply()
2019-05-22 15:35:27 +02:00
Charl Wentzel
97eb749903 Merge branch 'BeagleBoneIO' 2019-05-20 18:08:10 +02:00
Charl Wentzel
c0a50bf2bd Minor update:
- FunctionCore:
  - Set Function Type in Init()
- SelectableBare:
  - Remove unnecesary initialisation in constructor
- SelectableCore:
  - Remove code duplicated in SelectableBare
2019-05-20 18:07:25 +02:00
Charl Wentzel
c723846fc9 Bug fix:
- JSONparse:
  - Error deleting unused array element
2019-05-20 17:33:35 +02:00
Charl Wentzel
0682de7f62 Merge branch 'WatchdogCore' 2019-05-13 09:41:16 +02:00
Charl Wentzel
cb98634b79 Minor Update:
- Comments added
2019-05-13 09:33:37 +02:00
Charl Wentzel
aedf3c6b46 Minor Update:
- LogCore: Increase log buffer for larger data events
2019-05-03 11:33:00 -05:00
Charl Wentzel
1b4ec32065 Minor Update:
- UtilCore:
  - Set optional parameters on HexStrToBytes function.
2019-04-23 21:52:23 +02:00
Charl Wentzel
01ec1071b1 Important Update:
- Save reference to process config in Function Core
  - Moved from DeviceCore to here as common feature
  - "Config" : object
    Allow additional config to be stored in application definition
  - "Config" : string
    Name reference to config object in main JSON file
  - Remove from Device Core
2019-04-22 10:29:52 +02:00
Charl Wentzel
77db246541 Important Update:
- UtilCore:
  - Coverted strings not zero terminated
2019-04-21 12:53:28 +02:00
Charl Wentzel
0db59f8ecd Important Update:
- SelectableBare:
  - Bug fix: Packet sent too early
2019-04-19 11:16:07 +02:00
Charl Wentzel
f89d59e269 Merge branch 'master' into GISReaderPort 2019-04-15 17:27:47 +02:00
Charl Wentzel
0046edc251 Important Update:
- Implemented new Util library:
  - Convert Bytes to Hex/Bin/Safe string
  - Convert HexString to Bytes
  - Search String for substring function
- Use Util library in LogCore for String conversions
2019-04-15 17:26:52 +02:00
Charl Wentzel
f20a9a676f Important Update:
- JSONparseCore:
  - Implement output to string
  - Added method WriteToString()
  - Create function pointers which is selected for correct output:
    JSONstrOutput or JSONfileOutput -> Print()
  - Replace all write() statements with Print() statements
  - Modify PrintStr not use dprintf, but sprintf to temp buffer
2019-04-07 10:25:44 +02:00
Charl Wentzel
7acdd8f704 Minor Update:
- Increase buffer of JSONparse to ensure reading for long strings
2019-04-06 13:45:45 +02:00
Charl Wentzel
bc89021a0e Important Update:
- DateTimeCore:
  - Added new functions to process data information
- JSONparse:
  - Bug fix: file permissions on create
2019-04-03 17:03:50 +02:00
Charl Wentzel
5899bf9892 Merge branch 'master' into HitNotBLE
# Conflicts:
#	SelectableCore.cpp
#	SelectableCore.h
2019-04-03 17:02:52 +02:00
Charl Wentzel
ebaf52a1a0 Important Update:
- Split SelectableCore.cpp into two classes:
  SelectableBare & SelectableCore
2019-03-29 15:44:13 +02:00
Charl Wentzel
889df6c7de Important Update:
- DeviceCore:
  - Added PollCycle variable (not used here)
- WatchdogCore:
  - Return "true" on in Process()
- SelectableCore:
  - Minor update (code compacted)
- Application/Function:
  - Added CApplication as friend of CFunction
  - Added param WaitToTerminate on Function
  - Application Run() only exists if all (WaitToTerminate) functions
    has terminated cleanly.
2019-03-09 20:41:25 +02:00
Charl Wentzel
3626909786 Important Update:
- Added SendEnable (vir RTS pin) for TTL/RS485 converter
- Bug fix: Check for Handle->InTimeout before force output
2019-03-04 16:42:29 +02:00
Charl Wentzel
49294ab6b5 Important Update:
- Update Command port:
  - Simplified error handling
  - Provide error reply
- Added method GetNextParamGroup()
2019-01-10 11:46:41 +02:00
Charl Wentzel
b679da9c29 Important Update:
- Renamed JSON parameter: PollGroup -> ParamGroup
2019-01-09 15:48:37 +02:00
Charl Wentzel
f10750ca2d Important Update:
- Remove separate poll group specifications in JSON file
- Implemented PollGroups per parameter or node in JSON file
- Implemented copying of PollGroups from Template
2019-01-09 15:19:06 +02:00
Charl Wentzel
3472f506b6 Major Update:
- JSONparseCore:
  - Add initialisations values for class params
  - Add method AddBase() to dynamically change DataTree
  - Added Error messages
- DeviceCore:
  - Implement ValueTree (JSON tree)
    - Node are added as devices & params are created/added
    - Nodes (and path) are referenced on devices & params
    - Node values are updated as device params are updated
  - Added Persistence File (not yet complete)
  - Updated InitDevices() & InitDeviceParams()
    - Split into smaller methods: CopyTemplateParam() & InitDeviceParam()
    - Load Device definition or Parameter maps from files
    - Allow loading of nested parameter map files
    - Load Parameter as JSON tree, generate names/path dynamically
2019-01-09 10:56:38 +02:00
Charl Wentzel
3e40f7a86d Important Update:
- Implement Handle Address renaming:
- Restructure JSON config, with address list and rename list
- SelectableCore:
  - Add method GetHandleAddress() - lookup renamed handle
  - Add init values to all struct and classes declarations
- Replace malloc()/strcpy() sequences with strdup()
2019-01-08 08:35:21 +02:00
Charl Wentzel
c5da842ac1 Major Update:
- FunctionCore:
  - Add OutputFormat param on Output() method - override output format
- SelectableCore:
  - Update Log output formats (process/functionblock)
- DeviceCore:
  - Updated device data format (different byte sequences)
  - Added ID & Address fields to TDevice struct
  - Add search methods for ID & Address
  - Update AddDevice() method to check for duplicate ID & address
  - Handle Invalid reply different from reply timeout
  - Add methods ValidReplyReceived() for standardise operation
  - Bug fix: DeviceTypes added as to Device List!
  - Bug fix: Check if Device/DeviceType created before adding params
  - Added correct handling of new Device Data types (LH & HL)
  - Updated log messages
2018-12-16 00:42:43 +02:00
Charl Wentzel
f1be4e9540 Important Update:
- Switch from malloc/free -> new/delete for structures
- Bug fix: Move Parameter groups to Device (not class)
- Update Parameter groups:
  - Update Read/Write indicators as params are added
2018-12-13 12:41:37 +02:00
Charl Wentzel
dc76d99b58 Important Update;
- ApplicationCore:
  - Minor log updates
- FunctionCore:
  - Initialise structs & object params in declaration
- DeviceCore:
  - Update logs with more consistent structure
  - Initialise structs & object params in declaration
  - Implemented DeviceType templates
    - Added Add/Get/Destroy methods
    - Load from config or separate template file
    - Build Devices/Params from template
  - Implemented ParamGroups
    - Added Add/Get/Destroy methods
    - Load with DeviceTypes
  - Added JSON parser to read separate template files
  - Bug fix: Getxxxx() methods
2018-12-13 09:17:39 +02:00
Charl Wentzel
90beb031af Minor Update 2018-12-11 21:36:24 +02:00
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