Important Update:
- DataTreeCore: - Rename all Get/SetChild...() methods to Get/SetMem...() - Update all other objects with new methods
This commit is contained in:
@@ -152,7 +152,7 @@ bool CApplication::LoadConfigData()
|
|||||||
|
|
||||||
// Get debug level
|
// Get debug level
|
||||||
pLogLevel = dlNone;
|
pLogLevel = dlNone;
|
||||||
TempStr = (char*)ConfigMember->GetChildStr( "Log/Level", "Medium", true );
|
TempStr = (char*)ConfigMember->GetMemStr( "Log/Level", "Medium", true );
|
||||||
if (TempStr)
|
if (TempStr)
|
||||||
{
|
{
|
||||||
if (!strcasecmp( TempStr, "Low" ))
|
if (!strcasecmp( TempStr, "Low" ))
|
||||||
@@ -193,7 +193,7 @@ bool CApplication::LoadConfigData()
|
|||||||
SetLogParam( pLogLevel, pLogOutput );
|
SetLogParam( pLogLevel, pLogOutput );
|
||||||
|
|
||||||
// Load Address List
|
// Load Address List
|
||||||
if ((AddressFile = (char*)ConfigMember->GetChildStr( "AddressList/Path", NULL )))
|
if ((AddressFile = (char*)ConfigMember->GetMemStr( "AddressList/Path", NULL )))
|
||||||
{
|
{
|
||||||
if (JSONparser->ReadFromFile( "address", AddressFile )) {
|
if (JSONparser->ReadFromFile( "address", AddressFile )) {
|
||||||
if (Log) Log->Message( dlLow, dlLow, "%s: Address file loaded (%s)", ProcessName, AddressFile );
|
if (Log) Log->Message( dlLow, dlLow, "%s: Address file loaded (%s)", ProcessName, AddressFile );
|
||||||
@@ -207,7 +207,7 @@ bool CApplication::LoadConfigData()
|
|||||||
if ((TempMember = ConfigMember->GetMember( "Selector" )))
|
if ((TempMember = ConfigMember->GetMember( "Selector" )))
|
||||||
{
|
{
|
||||||
// Create Selector
|
// Create Selector
|
||||||
Selector = new CSelect( (int)TempMember->GetChildInt( "Wait", 5, true ), LogLevel );
|
Selector = new CSelect( (int)TempMember->GetMemInt( "Wait", 5, true ), LogLevel );
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,7 @@ bool CApplication::InitFunctions( const char * pConfigPath )
|
|||||||
while (TempMember)
|
while (TempMember)
|
||||||
{
|
{
|
||||||
// Get function parameters
|
// Get function parameters
|
||||||
Type = (char*)TempMember->GetChildStr( "Type", "Custom", true );
|
Type = (char*)TempMember->GetMemStr( "Type", "Custom", true );
|
||||||
|
|
||||||
// Get or create function
|
// Get or create function
|
||||||
if (!strcasecmp( Type, "WatchdogClient" )) {
|
if (!strcasecmp( Type, "WatchdogClient" )) {
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ CDataMember * CDataMember::GetMember( const char * Path, bool Create )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
CDataMember * CDataMember::GetFirstChild( const char * Path )
|
CDataMember * CDataMember::GetMemFirstChild( const char * Path )
|
||||||
{
|
{
|
||||||
CDataMember * Member = NULL;
|
CDataMember * Member = NULL;
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ CDataMember * CDataMember::GetFirstChild( const char * Path )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
CDataMember * CDataMember::GetElement( const char * Path, const int Index )
|
CDataMember * CDataMember::GetMemElement( const char * Path, const int Index )
|
||||||
{
|
{
|
||||||
CDataMember * Member = NULL;
|
CDataMember * Member = NULL;
|
||||||
CDataMember * Child = NULL;
|
CDataMember * Child = NULL;
|
||||||
@@ -348,7 +348,7 @@ bool CDataMember::SetValue( EDataType pType, const char * pValue, int pLen )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CDataMember::SetChildObject( const char * Path )
|
bool CDataMember::SetMemObject( const char * Path )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ bool CDataMember::SetChildObject( const char * Path )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CDataMember::SetChildArray( const char * Path )
|
bool CDataMember::SetMemArray( const char * Path )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ bool CDataMember::SetChildArray( const char * Path )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CDataMember::SetChildStr( const char * Path, const char * Value, const int Len )
|
bool CDataMember::SetMemStr( const char * Path, const char * Value, const int Len )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ bool CDataMember::SetChildStr( const char * Path, const char * Value, const int
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CDataMember::SetChildInt( const char * Path, const long Value, const char * Mask )
|
bool CDataMember::SetMemInt( const char * Path, const long Value, const char * Mask )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
char ValueStr[20];
|
char ValueStr[20];
|
||||||
@@ -415,7 +415,7 @@ bool CDataMember::SetChildInt( const char * Path, const long Value, const char
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CDataMember::SetChildFloat( const char * Path, const double Value, const char * Mask )
|
bool CDataMember::SetMemFloat( const char * Path, const double Value, const char * Mask )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
char ValueStr[20];
|
char ValueStr[20];
|
||||||
@@ -432,7 +432,7 @@ bool CDataMember::SetChildFloat( const char * Path, const double Value, const c
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CDataMember::SetChildBool( const char * Path, const bool Value )
|
bool CDataMember::SetMemBool( const char * Path, const bool Value )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ bool CDataMember::SetChildBool( const char * Path, const bool Value )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CDataMember::SetChildNull( const char * Path )
|
bool CDataMember::SetMemNull( const char * Path )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ const int CDataMember::GetLen( const char * Path )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
const char * CDataMember::GetChildStr( const char * Path, const char * Default, bool Create )
|
const char * CDataMember::GetMemStr( const char * Path, const char * Default, bool Create )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ const char * CDataMember::GetChildStr( const char * Path, const char * Default,
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
const char * CDataMember::GetChildStr( const char * Path, int &Len, const char * Default, bool Create )
|
const char * CDataMember::GetMemStr( const char * Path, int &Len, const char * Default, bool Create )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ const char * CDataMember::GetChildStr( const char * Path, int &Len, const char *
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
const long CDataMember::GetChildInt( const char * Path, long Default, bool Create, const char * Mask )
|
const long CDataMember::GetMemInt( const char * Path, long Default, bool Create, const char * Mask )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ const long CDataMember::GetChildInt( const char * Path, long Default, bool Crea
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
const double CDataMember::GetChildFloat( const char * Path, double Default, bool Create, const char * Mask )
|
const double CDataMember::GetMemFloat( const char * Path, double Default, bool Create, const char * Mask )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ const double CDataMember::GetChildFloat( const char * Path, double Default, boo
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
const bool CDataMember::GetChildBool( const char * Path, bool Default, bool Create )
|
const bool CDataMember::GetMemBool( const char * Path, bool Default, bool Create )
|
||||||
{
|
{
|
||||||
CDataMember * Member;
|
CDataMember * Member;
|
||||||
|
|
||||||
|
|||||||
@@ -66,45 +66,45 @@ public:
|
|||||||
const int GetLen( const char * Path );
|
const int GetLen( const char * Path );
|
||||||
|
|
||||||
CDataMember * GetMember( const char * Path, bool Create = false );
|
CDataMember * GetMember( const char * Path, bool Create = false );
|
||||||
CDataMember * GetFirstChild( const char * Path );
|
CDataMember * GetMemFirstChild( const char * Path );
|
||||||
CDataMember * GetElement( const char * Path, const int Index );
|
CDataMember * GetMemElement( const char * Path, const int Index );
|
||||||
|
|
||||||
inline CDataMember * GetFirstChild() { return FirstChild; };
|
inline CDataMember * GetFirstChild() { return FirstChild; };
|
||||||
inline CDataMember * GetElement( const int Index ) { return GetElement( NULL, Index ); };
|
inline CDataMember * GetElement( const int Index ) { return GetMemElement( NULL, Index ); };
|
||||||
|
|
||||||
inline CDataMember * GetParent() { return Parent; };
|
inline CDataMember * GetParent() { return Parent; };
|
||||||
inline CDataMember * GetPrevPeer() { return PrevPeer; };
|
inline CDataMember * GetPrevPeer() { return PrevPeer; };
|
||||||
inline CDataMember * GetNextPeer() { return NextPeer; };
|
inline CDataMember * GetNextPeer() { return NextPeer; };
|
||||||
|
|
||||||
const char * GetChildStr( const char * Path, const char * Default = NULL, bool Create = false );
|
const char * GetMemStr( const char * Path, const char * Default = NULL, bool Create = false );
|
||||||
const char * GetChildStr( const char * Path, int &Len, const char * Default = NULL, bool Create = false );
|
const char * GetMemStr( const char * Path, int &Len, const char * Default = NULL, bool Create = false );
|
||||||
const bool GetChildBool( const char * Path, bool Default = false, bool Create = false );
|
const bool GetMemBool( const char * Path, bool Default = false, bool Create = false );
|
||||||
const long GetChildInt( const char * Path, long Default = 0, bool Create = false, const char * Mask = NULL );
|
const long GetMemInt( const char * Path, long Default = 0, bool Create = false, const char * Mask = NULL );
|
||||||
const double GetChildFloat( const char * Path, double Default = 0.0, bool Create = false, const char * Mask = NULL );
|
const double GetMemFloat( const char * Path, double Default = 0.0, bool Create = false, const char * Mask = NULL );
|
||||||
|
|
||||||
inline const char * GetStr( const char * Default = NULL, bool Create = false ) { return GetChildStr( NULL, Default, Create ); };
|
inline const char * GetStr( const char * Default = NULL, bool Create = false ) { return GetMemStr( NULL, Default, Create ); };
|
||||||
inline const char * GetStr( int &Len, const char * Default = NULL, bool Create = false ) { return GetChildStr( NULL, Len, Default, Create ); };
|
inline const char * GetStr( int &Len, const char * Default = NULL, bool Create = false ) { return GetMemStr( NULL, Len, Default, Create ); };
|
||||||
inline const bool GetBool( bool Default = false, bool Create = false ) { return GetChildBool( NULL, Default, Create ); };
|
inline const bool GetBool( bool Default = false, bool Create = false ) { return GetMemBool( NULL, Default, Create ); };
|
||||||
inline const long GetInt( long Default = 0, bool Create = false, const char * Mask = NULL ) { return GetChildInt( NULL, Default, Create, Mask ); };
|
inline const long GetInt( long Default = 0, bool Create = false, const char * Mask = NULL ) { return GetMemInt( NULL, Default, Create, Mask ); };
|
||||||
inline const double GetFloat( double Default = 0.0, bool Create = false, const char * Mask = NULL ) { return GetChildFloat( NULL, Default, Create, Mask ); };
|
inline const double GetFloat( double Default = 0.0, bool Create = false, const char * Mask = NULL ) { return GetMemFloat( NULL, Default, Create, Mask ); };
|
||||||
|
|
||||||
bool SetChildBool( const char * Path, const bool Value );
|
bool SetMemBool( const char * Path, const bool Value );
|
||||||
bool SetChildInt( const char * Path, const long Value, const char * Mask = NULL );
|
bool SetMemInt( const char * Path, const long Value, const char * Mask = NULL );
|
||||||
bool SetChildFloat( const char * Path, const double Value, const char * Mask = NULL );
|
bool SetMemFloat( const char * Path, const double Value, const char * Mask = NULL );
|
||||||
bool SetChildStr( const char * Path, const char * Value = NULL, const int Len = -1 ); // Use Len param if Value contains NULL values
|
bool SetMemStr( const char * Path, const char * Value = NULL, const int Len = -1 ); // Use Len param if Value contains NULL values
|
||||||
|
|
||||||
inline bool SetBool( const bool Value ) { return SetChildBool( NULL, Value ); };
|
inline bool SetBool( const bool Value ) { return SetMemBool( NULL, Value ); };
|
||||||
inline bool SetInt( const long Value, const char * Mask = NULL ) { return SetChildInt( NULL, Value, Mask ); };
|
inline bool SetInt( const long Value, const char * Mask = NULL ) { return SetMemInt( NULL, Value, Mask ); };
|
||||||
inline bool SetFloat( const double Value, const char * Mask = NULL ) { return SetChildFloat( NULL, Value, Mask ); };
|
inline bool SetFloat( const double Value, const char * Mask = NULL ) { return SetMemFloat( NULL, Value, Mask ); };
|
||||||
inline bool SetStr( const char * Value = NULL, const int Len = -1 ) { return SetChildStr( NULL, Value, Len ); };
|
inline bool SetStr( const char * Value = NULL, const int Len = -1 ) { return SetMemStr( NULL, Value, Len ); };
|
||||||
|
|
||||||
bool SetChildNull( const char * Path );
|
bool SetMemNull( const char * Path );
|
||||||
bool SetChildObject( const char * Path );
|
bool SetMemObject( const char * Path );
|
||||||
bool SetChildArray( const char * Path );
|
bool SetMemArray( const char * Path );
|
||||||
|
|
||||||
inline bool SetNull() { return SetChildNull( NULL ); };
|
inline bool SetNull() { return SetMemNull( NULL ); };
|
||||||
inline bool SetObject() { return SetChildObject( NULL ); };
|
inline bool SetObject() { return SetMemObject( NULL ); };
|
||||||
inline bool SetArray() { return SetChildArray( NULL ); };
|
inline bool SetArray() { return SetMemArray( NULL ); };
|
||||||
|
|
||||||
bool Clear();
|
bool Clear();
|
||||||
bool Delete( const char * Path );
|
bool Delete( const char * Path );
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ bool CFunctionCore::LoadConfigData()
|
|||||||
|
|
||||||
// Get debug level
|
// Get debug level
|
||||||
pLogLevel = dlNone;
|
pLogLevel = dlNone;
|
||||||
TempStr = (char*)ConfigMember->GetChildStr( "Log/Level", "Medium", true );
|
TempStr = (char*)ConfigMember->GetMemStr( "Log/Level", "Medium", true );
|
||||||
if (TempStr)
|
if (TempStr)
|
||||||
{
|
{
|
||||||
if (!strcasecmp( TempStr, "Low" ))
|
if (!strcasecmp( TempStr, "Low" ))
|
||||||
@@ -163,13 +163,13 @@ bool CFunctionCore::LoadConfigData()
|
|||||||
SetLogParam( pLogLevel, pLogOutput );
|
SetLogParam( pLogLevel, pLogOutput );
|
||||||
|
|
||||||
// Load Channels
|
// Load Channels
|
||||||
TempMember = ConfigMember->GetFirstChild( "Channels" );
|
TempMember = ConfigMember->GetMemFirstChild( "Channels" );
|
||||||
while (TempMember)
|
while (TempMember)
|
||||||
{
|
{
|
||||||
if (TempMember->GetName()) {
|
if (TempMember->GetName()) {
|
||||||
AddChannel( TempMember->GetName(),
|
AddChannel( TempMember->GetName(),
|
||||||
TempMember->GetChildBool( "InputEnabled", true, true ),
|
TempMember->GetMemBool( "InputEnabled", true, true ),
|
||||||
TempMember->GetChildBool( "OutputEnabled", false, true ));
|
TempMember->GetMemBool( "OutputEnabled", false, true ));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
@@ -197,9 +197,9 @@ bool CFunctionCore::LoadChannelLinkData()
|
|||||||
{
|
{
|
||||||
// Get Parameters
|
// Get Parameters
|
||||||
LinkOutputChannel( Channel->Name,
|
LinkOutputChannel( Channel->Name,
|
||||||
FunctionMember->GetChildStr( "Function" ),
|
FunctionMember->GetMemStr( "Function" ),
|
||||||
FunctionMember->GetChildStr( "Channel" ),
|
FunctionMember->GetMemStr( "Channel" ),
|
||||||
FunctionMember->GetChildBool( "Bidirectional" ) );
|
FunctionMember->GetMemBool( "Bidirectional" ) );
|
||||||
// Next
|
// Next
|
||||||
FunctionMember = FunctionMember->GetNextPeer();
|
FunctionMember = FunctionMember->GetNextPeer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,24 +94,24 @@ bool CSelectableCore::LoadConfigData()
|
|||||||
|
|
||||||
// Create Handle and channel link
|
// Create Handle and channel link
|
||||||
Handle = CreateHandle( TempMember->GetName(), false );
|
Handle = CreateHandle( TempMember->GetName(), false );
|
||||||
Handle->Channel = GetChannel( TempMember->GetChildStr( "Channel" ) );
|
Handle->Channel = GetChannel( TempMember->GetMemStr( "Channel" ) );
|
||||||
|
|
||||||
Type = (char*)TempMember->GetChildStr( "Type", "TCPclient", true );
|
Type = (char*)TempMember->GetMemStr( "Type", "TCPclient", true );
|
||||||
if (!strcasecmp( Type, "Serial" ))
|
if (!strcasecmp( Type, "Serial" ))
|
||||||
{
|
{
|
||||||
if ((Name = (char*)TempMember->GetChildStr( "Port/Name", NULL ))) {
|
if ((Name = (char*)TempMember->GetMemStr( "Port/Name", NULL ))) {
|
||||||
sprintf( Path, "Address/%s/Address", Name );
|
sprintf( Path, "Address/%s/Address", Name );
|
||||||
Address = (char*)DataTree->GetChildStr( Path, NULL, true ); // Get address list value
|
Address = (char*)DataTree->GetMemStr( Path, NULL, true ); // Get address list value
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Address = (char*)TempMember->GetChildStr( "Port/Address", NULL, true ); // Get default value
|
Address = (char*)TempMember->GetMemStr( "Port/Address", NULL, true ); // Get default value
|
||||||
}
|
}
|
||||||
SetSerialHandle( Handle, Address );
|
SetSerialHandle( Handle, Address );
|
||||||
|
|
||||||
// Update configuration if specified
|
// Update configuration if specified
|
||||||
if ((SerialConfig = TempMember->GetMember( "Port/SerialConfig", false )))
|
if ((SerialConfig = TempMember->GetMember( "Port/SerialConfig", false )))
|
||||||
{
|
{
|
||||||
ParityText = (char*)SerialConfig->GetChildStr( "Parity", "none", true );
|
ParityText = (char*)SerialConfig->GetMemStr( "Parity", "none", true );
|
||||||
if (!strcasecmp( ParityText, "none" ))
|
if (!strcasecmp( ParityText, "none" ))
|
||||||
Parity = NO_PARITY;
|
Parity = NO_PARITY;
|
||||||
else if (!strcasecmp( ParityText, "odd" ))
|
else if (!strcasecmp( ParityText, "odd" ))
|
||||||
@@ -121,7 +121,7 @@ bool CSelectableCore::LoadConfigData()
|
|||||||
else if (!strcasecmp( ParityText, "mark" ))
|
else if (!strcasecmp( ParityText, "mark" ))
|
||||||
Parity = MARK_PARITY;
|
Parity = MARK_PARITY;
|
||||||
|
|
||||||
FlowCtrlText = (char*)SerialConfig->GetChildStr( "FlowCtrl", "none", true );
|
FlowCtrlText = (char*)SerialConfig->GetMemStr( "FlowCtrl", "none", true );
|
||||||
if (!strcasecmp( FlowCtrlText, "none" ))
|
if (!strcasecmp( FlowCtrlText, "none" ))
|
||||||
FlowCtrl = NO_FLOWCTRL;
|
FlowCtrl = NO_FLOWCTRL;
|
||||||
else if (!strcasecmp( FlowCtrlText, "hardware" ))
|
else if (!strcasecmp( FlowCtrlText, "hardware" ))
|
||||||
@@ -130,70 +130,70 @@ bool CSelectableCore::LoadConfigData()
|
|||||||
FlowCtrl = SW_FLOWCTRL;
|
FlowCtrl = SW_FLOWCTRL;
|
||||||
|
|
||||||
Handle->SerialConfig = true;
|
Handle->SerialConfig = true;
|
||||||
SetSerialHandleConfig( Handle, SerialConfig->GetChildInt( "BaudRate", 19200, true ),
|
SetSerialHandleConfig( Handle, SerialConfig->GetMemInt( "BaudRate", 19200, true ),
|
||||||
SerialConfig->GetChildInt( "DataBits", 8, true ),
|
SerialConfig->GetMemInt( "DataBits", 8, true ),
|
||||||
Parity, SerialConfig->GetChildInt( "StopBits", 1, true ),
|
Parity, SerialConfig->GetMemInt( "StopBits", 1, true ),
|
||||||
FlowCtrl, SerialConfig->GetChildInt( "DataWait", 0, true ));
|
FlowCtrl, SerialConfig->GetMemInt( "DataWait", 0, true ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcasecmp( Type, "LinePrinter" ))
|
else if (!strcasecmp( Type, "LinePrinter" ))
|
||||||
{
|
{
|
||||||
if ((Name = (char*)TempMember->GetChildStr( "Port/Name", NULL ))) {
|
if ((Name = (char*)TempMember->GetMemStr( "Port/Name", NULL ))) {
|
||||||
sprintf( Path, "Address/%s/Address", Name );
|
sprintf( Path, "Address/%s/Address", Name );
|
||||||
Address = (char*)DataTree->GetChildStr( Path, NULL, true ); // Get address list value
|
Address = (char*)DataTree->GetMemStr( Path, NULL, true ); // Get address list value
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Address = (char*)TempMember->GetChildStr( "Port/Address", NULL, true ); // Get default value
|
Address = (char*)TempMember->GetMemStr( "Port/Address", NULL, true ); // Get default value
|
||||||
}
|
}
|
||||||
SetLinePrinterHandle( Handle, Address );
|
SetLinePrinterHandle( Handle, Address );
|
||||||
}
|
}
|
||||||
else if (!strcasecmp( Type, "TCPserver" ))
|
else if (!strcasecmp( Type, "TCPserver" ))
|
||||||
{
|
{
|
||||||
if ((Name = (char*)TempMember->GetChildStr( "Socket/Name", NULL ))) {
|
if ((Name = (char*)TempMember->GetMemStr( "Socket/Name", NULL ))) {
|
||||||
sprintf( Path, "Address/%s/Address", Name );
|
sprintf( Path, "Address/%s/Address", Name );
|
||||||
Address = (char*)DataTree->GetChildStr( Path, NULL, true ); // Get AddressList Address value
|
Address = (char*)DataTree->GetMemStr( Path, NULL, true ); // Get AddressList Address value
|
||||||
sprintf( Path, "Address/%s/Port", Name );
|
sprintf( Path, "Address/%s/Port", Name );
|
||||||
Port = (char*)DataTree->GetChildStr( Path, "0", true ); // Get AddressList Port value
|
Port = (char*)DataTree->GetMemStr( Path, "0", true ); // Get AddressList Port value
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Address = (char*)TempMember->GetChildStr( "Socket/Address", NULL, true ); // Get default Address value
|
Address = (char*)TempMember->GetMemStr( "Socket/Address", NULL, true ); // Get default Address value
|
||||||
Port = (char*)TempMember->GetChildStr( "Socket/Port", "0", true ); // Get default Port value
|
Port = (char*)TempMember->GetMemStr( "Socket/Port", "0", true ); // Get default Port value
|
||||||
}
|
}
|
||||||
Delay = TempMember->GetChildInt( "Socket/ResolveDelay", 0, true );
|
Delay = TempMember->GetMemInt( "Socket/ResolveDelay", 0, true );
|
||||||
SetSocketHandle( Handle, ctServer, Address, strlcase(Port), Delay );
|
SetSocketHandle( Handle, ctServer, Address, strlcase(Port), Delay );
|
||||||
}
|
}
|
||||||
else if (!strcasecmp( Type, "TCPclient" ))
|
else if (!strcasecmp( Type, "TCPclient" ))
|
||||||
{
|
{
|
||||||
if ((Name = (char*)TempMember->GetChildStr( "Socket/Name", NULL ))) {
|
if ((Name = (char*)TempMember->GetMemStr( "Socket/Name", NULL ))) {
|
||||||
sprintf( Path, "Address/%s/Address", Name );
|
sprintf( Path, "Address/%s/Address", Name );
|
||||||
Address = (char*)DataTree->GetChildStr( Path, NULL, true ); // Get AddressList Address value
|
Address = (char*)DataTree->GetMemStr( Path, NULL, true ); // Get AddressList Address value
|
||||||
sprintf( Path, "Address/%s/Port", Name );
|
sprintf( Path, "Address/%s/Port", Name );
|
||||||
Port = (char*)DataTree->GetChildStr( Path, "0", true ); // Get AddressList Port value
|
Port = (char*)DataTree->GetMemStr( Path, "0", true ); // Get AddressList Port value
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Address = (char*)TempMember->GetChildStr( "Socket/Address", NULL, true ); // Get default Address value
|
Address = (char*)TempMember->GetMemStr( "Socket/Address", NULL, true ); // Get default Address value
|
||||||
Port = (char*)TempMember->GetChildStr( "Socket/Port", "0", true ); // Get default Port value
|
Port = (char*)TempMember->GetMemStr( "Socket/Port", "0", true ); // Get default Port value
|
||||||
}
|
}
|
||||||
Delay = TempMember->GetChildInt( "Socket/ResolveDelay", 0, true );
|
Delay = TempMember->GetMemInt( "Socket/ResolveDelay", 0, true );
|
||||||
SetSocketHandle( Handle, ctClient, Address, strlcase(Port), Delay );
|
SetSocketHandle( Handle, ctClient, Address, strlcase(Port), Delay );
|
||||||
}
|
}
|
||||||
else if (!strcasecmp( Type, "ForkPipe" )) {
|
else if (!strcasecmp( Type, "ForkPipe" )) {
|
||||||
Address = (char*)TempMember->GetChildStr( "Fork/ExecPath", NULL, true ); // Get default value
|
Address = (char*)TempMember->GetMemStr( "Fork/ExecPath", NULL, true ); // Get default value
|
||||||
SetForkPipeHandle( Handle, Address );
|
SetForkPipeHandle( Handle, Address );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Auto Mange
|
// Set Auto Mange
|
||||||
SetAutoManage( Handle, TempMember->GetChildBool( "AutoManage/Enabled", true, true ),
|
SetAutoManage( Handle, TempMember->GetMemBool( "AutoManage/Enabled", true, true ),
|
||||||
TempMember->GetChildBool( "AutoManage/Persistent", false, true ),
|
TempMember->GetMemBool( "AutoManage/Persistent", false, true ),
|
||||||
TempMember->GetChildInt( "AutoManage/ReopenDelay", 2000, true ),
|
TempMember->GetMemInt( "AutoManage/ReopenDelay", 2000, true ),
|
||||||
TempMember->GetChildInt( "AutoManage/CloseTimeout", 2000, true ));
|
TempMember->GetMemInt( "AutoManage/CloseTimeout", 2000, true ));
|
||||||
|
|
||||||
// Input buffer
|
// Input buffer
|
||||||
SetInBuffer( Handle, TempMember->GetChildInt( "InputBuffer/Size", 0 ),
|
SetInBuffer( Handle, TempMember->GetMemInt( "InputBuffer/Size", 0 ),
|
||||||
TempMember->GetChildInt( "InputBuffer/Timeout", 250 ),
|
TempMember->GetMemInt( "InputBuffer/Timeout", 250 ),
|
||||||
TempMember->GetChildStr( "InputBuffer/Marker", "" ),
|
TempMember->GetMemStr( "InputBuffer/Marker", "" ),
|
||||||
TempMember->GetChildInt( "InputBuffer/MarkerLen", 0 ) );
|
TempMember->GetMemInt( "InputBuffer/MarkerLen", 0 ) );
|
||||||
SetOutBuffer( Handle, TempMember->GetChildInt( "OutputBuffer/Size", 0 ) );
|
SetOutBuffer( Handle, TempMember->GetMemInt( "OutputBuffer/Size", 0 ) );
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
TempMember = TempMember->GetNextPeer();
|
TempMember = TempMember->GetNextPeer();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ bool CWatchdogCore::LoadConfigData()
|
|||||||
CSelectableCore::LoadConfigData();
|
CSelectableCore::LoadConfigData();
|
||||||
|
|
||||||
// Set specific parameters
|
// Set specific parameters
|
||||||
SetInterval( ConfigMember->GetChildInt( "Parameters/PingInterval", 500, true ));
|
SetInterval( ConfigMember->GetMemInt( "Parameters/PingInterval", 500, true ));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user