Minor Update:

- WatchdogCore:
  - Renamed FunctionType TYPE_WATCHDOG -> TYPE_WATCHDOGPING
- ApplicationCore:
  - Prevent overwriting existing Function Type
This commit is contained in:
Charl Wentzel
2018-11-25 10:19:52 +02:00
parent a972fb9101
commit 5dd0e88708
2 changed files with 11 additions and 6 deletions

View File

@@ -51,9 +51,9 @@ CApplication::CApplication( EDebugLevel pLogLevel )
// Add Core Function Types
//AddFunctionType( TYPE_FUNCTION, NewFunctionCore ); // <-- Can't add virtual function
AddFunctionType( TYPE_SELECTABLE, NewSelectableCore );
AddFunctionType( TYPE_WATCHDOG, NewWatchdogCore );
AddFunctionType( TYPE_FILE, NewFileCore );
AddFunctionType( TYPE_SELECTABLE, NewSelectableCore );
AddFunctionType( TYPE_WATCHDOGPING, NewWatchdogCore );
AddFunctionType( TYPE_FILE, NewFileCore );
//AddFunctionType( TYPE_DEVICE, NewDeviceCore ); // <-- Can't add virtual function
}
//---------------------------------------------------------------------------
@@ -381,8 +381,13 @@ bool CApplication::AddFunctionType( const char * Type, FFuncConstructor Construc
// Get end of list
FunctionType = &FirstFunctionType;
while (*FunctionType)
while (*FunctionType && strcasecmp(Type, (*FunctionType)->Name))
FunctionType = &((*FunctionType)->Next);
if (*FunctionType) {
if (Log) Log->Message( dlLow, dlLow, "%s: Cannot add FunctionType '%s' - Already exists",
ProcessName, Type );
return NULL;
}
// Add new Type
*FunctionType = (TFunctionType*)calloc( sizeof(TFunctionType), 1 );

View File

@@ -18,7 +18,7 @@
//---------------------------------------------------------------------------
// Function Constructor
#define TYPE_WATCHDOG "Watchdog"
#define TYPE_WATCHDOGPING "WatchdogPing"
CFunctionCore * NewWatchdogCore( const char * Name );
//---------------------------------------------------------------------------
@@ -38,7 +38,7 @@ private:
public:
// Life Cycle
CWatchdogCore( const char * pName, const char * pType = TYPE_WATCHDOG );
CWatchdogCore( const char * pName, const char * pType = TYPE_WATCHDOGPING );
virtual ~CWatchdogCore();
// Manually set Configuration