Commit Graph

28 Commits

Author SHA1 Message Date
Charl Wentzel
bdff82f9c8 Bug fix:
- DataTreeCore:
  - Error in GetChild() return when Child not created
2018-11-25 12:07:51 +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
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
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
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
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
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
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
ade3c10a1a Important Update:
- DataTreeCore:
  - Add GetLen() method to get length of (text) value
- FileCore:
  - Minor fix: rename MaxLen -> Len
2017-08-02 03:38:37 +02:00
Charl Wentzel
e71157b9ec Important Update:
- ApplicationCore:
  - Rename ConfigParser -> JSONparser
  - Make JSONparser a public parameter
- DataTreeCore:
  - Bug fix: Insufficient memory allocation on SetValue if Len = -1
2017-07-29 12:45:45 +02:00
Charl Wentzel
b7033bea81 Minor update:
- DataTreeCore:
  - Bug fix: Return Default value on GetStr() if not found or created
2017-07-28 06:46:33 +02:00
Charl Wentzel
2f81d1fbbe Important Update:
- Library Clean up:
  - Removed all unused C/C++ libraries from source
  - First C/C++ libraries then redA libraries
- Library changes:
  - renamed BufferCore -> CharBufferCore
  - added ItemBufferCore
- CharBufferCore:
  - Derive RollingBuffer & ShiftBuffer from common class CharBuffer
  - CharBuffer is mostly a virtual class (interface)
2017-07-22 17:46:05 +02:00
Charl Wentzel
aaf3c59727 Important Updates:
- DataTreeCore:
  - Allow types float, int & bool to be read as strings with GetStr()
- LogCore:
  - Add comments to Logging parameters
- WatchDogCore:
  - Call CSelectableCore::Process() in Process() to manage connect
- SelectableCore:
  - Allow SetSocketHandle() to be called if Handle already set as socket
  - added strlcase() method to convert string to lower case
  - Update Handle structure:
    - renamed Address -> HostName
    - renamed PortNo -> PortName
    - added AddressList for all resolved addresses
    - added AddressInfo for active address
  - Add ResolveAddress() method
    - Domain name and protocol port resolving with GetAddrInfo()
  - JSON updated:
    - domain name can be provided instead of IP address
    - protocol can be specified instead of Port No, e.g. "HTTP" / "SSH"
  - Resolve address before connect, or use next resolved address
2017-07-22 09:40:17 +02:00
Charl Wentzel
434377f122 Major Update:
- Implement new ApplicationCore:
  - Manage Tools: Log, DataTree, JSONparser & Selector
  - Load configuration, Manage FunctionBlocks
- FunctionCore & dirived classes, SignalCore:
  - affects: SelectableCore, DeviceCore, FileCore, WatchdogCore
  - Do not pass Log()
  - Define and pass Type
  - Update/reduce included headers
  - Use ProcessName and Application global vars
  - Get Log, DataTree from Application
  - Use virtual Init() function to set must have Channels/Handles
- DataTreeCore:
  - Bug fix: Check if child members exist and destroy in SetValuePtr()
  - Add method GetFirstChild with BaseMember & Path
  - Bug fix: do not use RootMember if no Parent in GetChildxxx() methods
- SignalCore, SelectCore:
  - Use Application->Log()
- FunctionCore:
  - Add itself to Application (function list)
  - Add parameter: LinkConfigMember, Type
  - Use virtual LoadConfigData() to configure from DataTree
  - Rename methods: LoadConfig() -> InitConfig(),
      InitLogging() -> SetLogParam(), SetDebugLevel() -> SetLogLevel()
  - Add method: GetType(), LoadChannelLinkData(), InitChannelLinks()
  - Modify LinkIn/OutputChannel() to use name for InFunction, not pointer
- SelectableCore & Dirived classes:
  - Affects DeviceCore & WatchdogClient
  - Rename parameter: Select -> Selector, BaseMember -> ConfigMember
  - Get Selector from Application->Selector
  - Change Handles JSON structure from Array to Key:Value pairs
  - Bug fix: check if Selector exist during Input()
  - Bug fix: do not set PortNo if not exist
2017-07-16 20:29:01 +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
ee29625b9a Important update:
- DataTree->GetStr return Member->Value or NULL if not found
- Rename DeviceCore EDataType to EMBDataType, avoid conflict with JSONpaser
- Add DataTree to FunctionCore with LoadConfig() method
- Change ProcessName to char * (from char[])
- JSONparse:
  - Rename RootPath to BasePath on all methods to reduce confusion
  - Allow FilePath to be NULL, add '/' if not present
  - Fixed Parsing sequence in ParseObject & ParseArray
2017-04-10 21:33:14 +02:00
Charl Wentzel
9b42d516a1 Important Update:
- Implemented basic child element navigation:
  GetFirstChild(), GetNextChild(), GetIndexChild()
- Bug fix: Faulty name comparison using length
2017-04-06 06:56:03 +02:00
Charl Wentzel
23db2539d9 Important Update:
- Bug fix: Create wrong member name because not zero terminated
- Bug fix: Only create array element if brackets empty
2017-04-06 05:35:30 +02:00
Charl Wentzel
200f7e1f8b Important Update:
- Improve "printing" for JSON with single & multi line objects
- Fix bugs in getting, setting & creating array elements
- "array[]" allowed to create/add element at end of an array
- No longer duplicate get() path (reduce memory allocation)
  - added NameLen to TMember to eliminate zero-terminate requirement
- Fix ReadfromXXX() return values
2017-04-05 08:07:53 +02:00
Charl Wentzel
66fc4bc123 Important Update:
- Bug fix: incorrect memory allocation in SetValue()
- Implement conversion of escaped chars during parsing
- Implement escaping chars during printing
2017-04-03 21:48:29 +02:00
Charl Wentzel
8f39adb0f3 Important update:
- Buffer:
  - fix undefined value: zero terminate buffer when loading from FD
- DataTree:
  - fix memory leak: destroy temporary search path
  - improve delete(): delete all children for member if no path given
  - bug fix: initiate object with 0 length (not -1)
- JSONparse:
  - Remove level parameter
  - Add path to load/save/print methods (print only portion of tree)
  - fix memory leak: destroy temporary object name
2017-03-29 21:27:28 +02:00
Charl Wentzel
5691b22df9 Minor Update:
- Pass printf Mask for Int/Float values on Get/Set methods
  - On GetValue use mask for default value
- Add SetArray() method
- Bug fix: Incorrect malloc size in SetValue()
- Bug fix: Len not calculated if -1 passed to SetValue()
- Set default value for Len = -1 on SetValue() methods
- Don't pass Len to SetValue() unless required
2017-03-27 04:29:11 +02:00
Charl Wentzel
a22f60b152 Major Update:
- Bug fix: BufferCore - set correct auto buffer size
- Change Get/Set methods to use BaseReference and full path instead of
    ParentPath and MemberName
- Add Create param to all Get methods (create if not found)
- Implement arrays & parsing of arrays
- Set CJSONparse as friend class to DataTree (access protected methods)
- Print JSON to screen
2017-03-26 22:26:52 +02:00
Charl Wentzel
b823bd7ea7 Important Update: (incomplete)
- Split CConfigCore into two classes:
  - DataTreeCore.h - Tree data structure and access
  - JSONparseCore.h - JSON parsing functionality
- Renamed TConfigParam struct to TDataMember
- Renamed most of CDataTreeCore methods
2017-03-23 20:53:32 +02:00