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
This commit is contained in:
@@ -100,6 +100,7 @@ struct SHandle {
|
||||
struct addrinfo * AddressList; // List of resolved IP Addresses for host name
|
||||
struct addrinfo * AddressInfo; // Current selected IP Address
|
||||
bool AddressFailed; // Indicate failure to connect to address
|
||||
short Queue; // Max waiting connections
|
||||
long ResolveDelay; // Delay before resolving hostname via DNS
|
||||
|
||||
// Serial Port config
|
||||
@@ -173,6 +174,12 @@ public:
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Function Constructor
|
||||
#define TYPE_SELECTABLE "Selectable"
|
||||
CFunctionCore * NewSelectableCore( const char * Name );
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class CSelectableCore : public CFunctionCore
|
||||
{
|
||||
protected:
|
||||
@@ -182,9 +189,6 @@ protected:
|
||||
// Select interface
|
||||
CSelect * Selector;
|
||||
|
||||
// Configuration
|
||||
virtual bool LoadConfigData();
|
||||
|
||||
// Managing File Handles
|
||||
bool RemoveHandle( THandle * Handle );
|
||||
bool DestroyHandle( THandle * Handle );
|
||||
@@ -248,9 +252,12 @@ protected:
|
||||
|
||||
public:
|
||||
// Life Cycle
|
||||
CSelectableCore( const char * Name, const char * pType = "Selectable" );
|
||||
CSelectableCore( const char * Name, const char * Type = TYPE_SELECTABLE );
|
||||
virtual ~CSelectableCore();
|
||||
|
||||
// Configuration
|
||||
virtual bool Init( CDataMember * FunctionConfig );
|
||||
|
||||
// Finding Handles
|
||||
inline THandle * GetHandle( const char * HandleName )
|
||||
{
|
||||
@@ -281,8 +288,8 @@ public:
|
||||
bool SetSerialHandleConfig( THandle * Handle, int Baudrate, short DataBits, short Parity, short StopBits, short FlowCtrl, int DataWait );
|
||||
bool SetLinePrinterHandle( THandle * Handle, const char * FileName );
|
||||
bool SetForkPipeHandle( THandle * Handle, const char * ExecPath );
|
||||
bool SetUnixHandle( THandle * Handle, EConnectType Type, const char * FileName );
|
||||
bool SetSocketHandle( THandle * Handle, EConnectType Type, const char * HostName, const char * PortName, long ResolveDelay );
|
||||
bool SetUnixHandle( THandle * Handle, EConnectType Type, const char * FileName, short Queue );
|
||||
bool SetSocketHandle( THandle * Handle, EConnectType Type, const char * HostName, const char * PortName, short Queue, long ResolveDelay );
|
||||
bool ClearHandle( THandle * Handle );
|
||||
|
||||
// FD Operations
|
||||
|
||||
Reference in New Issue
Block a user