Important Update:
- FunctionCore
- So not set Function JSON "config" param to empty object by default
- Change TChannelLink to reference Channel direct
- Add Input/Output to TChannelLink
- Replace LinkChannel() Bidirectional param with Input/Output param
- Update JSON config as well
- Implement Channel "Ready" state and events
- Remove Input/OutputEnabled parameters and related methods
- Remove from JSON config as well
- Update AddChannel() method accordingly
- Add Ref param to struct TChannel
- SelectableCore:
- Convert inline ChangeState() to non-inline method
- Move ChangeState() to last step in open/close methods
- Add Channels in Not Ready state
- Change Channel state when Handle state changed
- DeviceCore:
- Add Channels in Ready state
- FileCore:
- Add Channel in Not Ready state
This commit is contained in:
@@ -194,6 +194,7 @@ protected:
|
||||
// Managing File Handles
|
||||
bool RemoveHandle( THandle * Handle );
|
||||
bool DestroyHandle( THandle * Handle );
|
||||
bool ChangeState( THandle * Handle, EConnectState State );
|
||||
|
||||
// Get Parameters
|
||||
inline int GetFD( const char * HandleName ) {
|
||||
@@ -201,15 +202,6 @@ protected:
|
||||
return ((Handle)? Handle->FD : -1);
|
||||
};
|
||||
|
||||
// General fucntions
|
||||
inline bool ChangeState( THandle * Handle, EConnectState State ) {
|
||||
if (!Handle || (Handle->State == State)) return false;
|
||||
if (Handle->StateCallback[ (int)State ])
|
||||
(Handle->StateCallback[ (int)State ])( this, Handle, State );
|
||||
Handle->State = State;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Mutual Operations
|
||||
int ReadFromFD( int FD, char * Data, int MaxLen );
|
||||
int WriteToFD( int FD, const char * Data, int Len, bool Force );
|
||||
@@ -230,19 +222,17 @@ public:
|
||||
virtual ~CSelectableBare();
|
||||
|
||||
// Configuration
|
||||
virtual bool Init( CDataMember * FunctionConfig ) = 0;
|
||||
virtual bool Init( CDataMember * FunctionConfig ) = 0;
|
||||
|
||||
// Finding Handles
|
||||
inline THandle * GetHandle( const char * HandleName )
|
||||
{
|
||||
inline THandle * GetHandle( const char * HandleName ) {
|
||||
if (!HandleName) return NULL;
|
||||
THandle * Handle = FirstHandle;
|
||||
while ( Handle && strcmp( HandleName, Handle->Name ))
|
||||
Handle = Handle->Next;
|
||||
return Handle;
|
||||
}
|
||||
inline THandle * GetHandle( int FD )
|
||||
{
|
||||
inline THandle * GetHandle( int FD ) {
|
||||
if (FD < 0) return NULL;
|
||||
THandle * Handle = FirstHandle;
|
||||
while ( Handle && (FD != Handle->FD))
|
||||
@@ -263,7 +253,7 @@ public:
|
||||
bool ClearHandle( THandle * Handle );
|
||||
|
||||
// FD Operations
|
||||
virtual int Open( THandle * Handle, bool DelayResolve = false ) = 0;
|
||||
virtual int Open( THandle * Handle, bool DelayResolve = false ) = 0;
|
||||
virtual bool Close( THandle * Handle, bool QuickReopen );
|
||||
virtual bool Read( THandle * Handle );
|
||||
virtual bool Write( THandle * Handle );
|
||||
|
||||
Reference in New Issue
Block a user