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
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
// redA Libraries
|
||||
#include "ApplicationCore.h"
|
||||
#include "WatchdogCore.h"
|
||||
#include "TimingCore.h"
|
||||
|
||||
// Standard C/C++ Libraries
|
||||
#include <stdio.h>
|
||||
@@ -19,12 +19,13 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global vars
|
||||
extern char * ProcessName;
|
||||
extern char * ProcessName;
|
||||
//extern CApplication * Application;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
CWatchdogCore::CWatchdogCore( const char * pName, CSelect * pSelect, CLogCore * pLog ) :
|
||||
CSelectableCore( pName, pSelect, pLog )
|
||||
CWatchdogCore::CWatchdogCore( const char * pName ) :
|
||||
CSelectableCore( pName, "WatchdogClient" )
|
||||
{
|
||||
// Create protocol
|
||||
Protocol = new CLiteProtocol( 50, '\x01', '\x02', '\x00' );
|
||||
@@ -34,8 +35,8 @@ CWatchdogCore::CWatchdogCore( const char * pName, CSelect * pSelect, CLogCore *
|
||||
PingInterval = 500;
|
||||
SetStartTime( &PingTimer );
|
||||
|
||||
// Create handle
|
||||
Ping = CreateHandle( "Ping", true );
|
||||
// Handle
|
||||
Ping = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -47,6 +48,18 @@ CWatchdogCore::~CWatchdogCore()
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool CWatchdogCore::LoadConfigData()
|
||||
{
|
||||
// Call Previous load config
|
||||
CSelectableCore::LoadConfigData();
|
||||
|
||||
// Set Auto Mange
|
||||
SetInterval( DataTree->GetInt( ConfigMember, "Parameters/PingInterval", 500, true ));
|
||||
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool CWatchdogCore::SetInterval( int pPingInterval )
|
||||
{
|
||||
PingInterval = pPingInterval;
|
||||
@@ -54,6 +67,17 @@ bool CWatchdogCore::SetInterval( int pPingInterval )
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool CWatchdogCore::Init()
|
||||
{
|
||||
// Create handle and set reference, if not done
|
||||
if (!(Ping = GetHandle( "Ping" )))
|
||||
Ping = CreateHandle( "Ping", false );
|
||||
|
||||
// Previous init
|
||||
return CSelectableCore::Init();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool CWatchdogCore::Process()
|
||||
{
|
||||
if (Timeout( PingTimer, PingInterval ))
|
||||
|
||||
Reference in New Issue
Block a user