- 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
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
/*
|
|
* WatchdogCore.h
|
|
*
|
|
* Created on: July 2017
|
|
* Author: wentzelc
|
|
*/
|
|
|
|
#ifndef REDACORE_WATCHDOGCORE_H_
|
|
#define REDACORE_WATCHDOGCORE_H_
|
|
|
|
// Standard C/C++ Libraries
|
|
/* none */
|
|
|
|
// redA Libraries
|
|
#include "SelectableCore.h"
|
|
#include "LiteProtocolCore.h"
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Function Constructor
|
|
#define TYPE_WATCHDOG "Watchdog"
|
|
CFunctionCore * NewWatchdogCore( const char * Name );
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
class CWatchdogCore : public CSelectableCore
|
|
{
|
|
private:
|
|
// Command
|
|
CLiteProtocol * Protocol;
|
|
|
|
// Timing
|
|
timeval PingTimer;
|
|
int PingInterval;
|
|
|
|
// Handle
|
|
THandle * Ping;
|
|
|
|
public:
|
|
// Life Cycle
|
|
CWatchdogCore( const char * pName, const char * pType = TYPE_WATCHDOG );
|
|
virtual ~CWatchdogCore();
|
|
|
|
// Manually set Configuration
|
|
bool SetInterval( int pPingInterval );
|
|
|
|
// Initialisation
|
|
virtual bool Init( CDataMember * FunctionConfig );
|
|
|
|
// Process
|
|
virtual bool Process();
|
|
};
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif /* REDACORE_WATCHDOGCORE_H_ */
|