Major update:

- Rename Function LocalIO -> Channel (Parameters & Methods)
This commit is contained in:
Charl Wentzel
2016-08-23 13:19:43 +02:00
parent 5ea05d119e
commit 7564e6a288
6 changed files with 146 additions and 147 deletions

View File

@@ -63,7 +63,7 @@ CFileCore::~CFileCore()
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
TFileHandle * CFileCore::AddFile( const char * Name, const char * Path, bool Append, bool CreateLocalIO ) TFileHandle * CFileCore::AddFile( const char * Name, const char * Path, bool Append, bool CreateChannel )
{ {
TFileHandle ** FileHandle = NULL; TFileHandle ** FileHandle = NULL;
@@ -91,9 +91,9 @@ TFileHandle * CFileCore::AddFile( const char * Name, const char * Path, bool Ap
strcpy( (*FileHandle)->Path, Path ); strcpy( (*FileHandle)->Path, Path );
} }
// Create IO if necessary // Create Channel if necessary
if (CreateLocalIO) { if (CreateChannel) {
AddLocalIO( Name ); AddChannel( Name );
} }
// Set Parameters // Set Parameters
@@ -265,29 +265,29 @@ int CFileCore::WriteToFD( int FD, const char * Data, int Len )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Manual Data Input/Output // Manual Data Input/Output
int CFileCore::Input( const char * IOName, const char * Data, int MaxLen ) int CFileCore::Input( const char * ChannelName, const char * Data, int MaxLen )
{ {
TFileHandle * FileHandle = NULL; TFileHandle * FileHandle = NULL;
int BytesWritten = 0; int BytesWritten = 0;
// Validate // Validate
if (!IOName || !Data) { if (!ChannelName || !Data) {
return 0; return 0;
} }
else if (MaxLen == -1) { else if (MaxLen == -1) {
MaxLen = strlen( Data ); MaxLen = strlen( Data );
}; };
// Get IO // Get Channel
if (!(FileHandle = GetFile( IOName ))) if (!(FileHandle = GetFile( ChannelName )))
{ {
// Log event // Log event
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Local IO '%s' - Input rejected, Local IO not found", Name, IOName ); if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Channel not found", Name, ChannelName );
return 0; return 0;
} }
// Log event // Log event
//ShowOutput( DebugLevel, dlHigh, OutputDisplay, Data, MaxLen, "%s: Local IO '%s' - IN:", Name, IOName ); //ShowOutput( DebugLevel, dlHigh, OutputDisplay, Data, MaxLen, "%s: Channel '%s' - IN:", Name, ChannelName );
// Open file // Open file
if (!OpenFile( FileHandle )) { if (!OpenFile( FileHandle )) {

View File

@@ -69,11 +69,11 @@ public:
~CFileCore(); ~CFileCore();
// Manage files // Manage files
virtual TFileHandle * AddFile( const char * Name, const char * Path, bool Append = true, bool CreateLocalIO = true ); virtual TFileHandle * AddFile( const char * Name, const char * Path, bool Append = true, bool CreateChannel = true );
virtual bool SetFilePersistence( TFileHandle * FileHandle, bool Persistent, int PersistTimeout ); virtual bool SetFilePersistence( TFileHandle * FileHandle, bool Persistent, int PersistTimeout );
// Data Input // Data Input
virtual int Input( const char * IOName, const char * Data, int MaxLen = -1 ); virtual int Input( const char * ChannelName, const char * Data, int MaxLen = -1 );
// Processing data // Processing data
virtual bool Process(); virtual bool Process();

View File

@@ -33,8 +33,8 @@ CFunctionCore::CFunctionCore( const char * FunctionName, CLogCore * pLog, EDebug
Name = NULL; Name = NULL;
} }
// IO Functions // Channels
FirstIO = NULL; FirstChannel = NULL;
// Output // Output
Log = pLog; Log = pLog;
@@ -48,42 +48,41 @@ CFunctionCore::CFunctionCore( const char * FunctionName, CLogCore * pLog, EDebug
CFunctionCore::~CFunctionCore() CFunctionCore::~CFunctionCore()
{ {
TLocalIO * NextIO = NULL; TChannel * NextChannel = NULL;
TLinkedIO * NextLinkedIO = NULL; TChannelLink * NextLinkedChannel = NULL;
// Destroy IO // Destroy Channels
while (FirstIO) while (FirstChannel)
{ {
// Destroy Parameters // Destroy Parameters
if (FirstIO->Name) { if (FirstChannel->Name) {
free( FirstIO->Name ); free( FirstChannel->Name );
} }
// Destroy Linked Inputs // Destroy Linked Inputs
while (FirstIO->FirstInput) { while (FirstChannel->FirstInput) {
if (FirstIO->FirstInput->IOName) { if (FirstChannel->FirstInput->Name) {
free( FirstIO->FirstInput->IOName ); free( FirstChannel->FirstInput->Name );
} }
NextLinkedIO = FirstIO->FirstInput->Next; NextLinkedChannel = FirstChannel->FirstInput->Next;
free( FirstIO->FirstInput ); free( FirstChannel->FirstInput );
FirstIO->FirstInput = NextLinkedIO; FirstChannel->FirstInput = NextLinkedChannel;
} }
// Destroy Linked Outputs // Destroy Linked Outputs
while (FirstIO->FirstOutput) { while (FirstChannel->FirstOutput) {
if (FirstIO->FirstOutput->IOName) { if (FirstChannel->FirstOutput->Name) {
free( FirstIO->FirstOutput->IOName ); free( FirstChannel->FirstOutput->Name );
} }
NextLinkedIO = FirstIO->FirstOutput->Next; NextLinkedChannel = FirstChannel->FirstOutput->Next;
free( FirstIO->FirstOutput ); free( FirstChannel->FirstOutput );
FirstIO->FirstOutput = NextLinkedIO; FirstChannel->FirstOutput = NextLinkedChannel;
} }
// Destroy Local IO // Destroy Channel
// Destroy Local IO NextChannel = FirstChannel->Next;
NextIO = FirstIO->Next; free( FirstChannel );
free( FirstIO ); FirstChannel = NextChannel;
FirstIO = NextIO;
} }
// Report status // Report status
@@ -97,116 +96,116 @@ CFunctionCore::~CFunctionCore()
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
TLocalIO * CFunctionCore::AddLocalIO( const char * IOName ) TChannel * CFunctionCore::AddChannel( const char * ChannelName )
{ {
TLocalIO ** LocalIO = NULL; TChannel ** Channel = NULL;
// Validate // Validate
if (!IOName) { if (!ChannelName) {
return NULL; return NULL;
} }
// Check if exists // Check if exists
LocalIO = &FirstIO; Channel = &FirstChannel;
while (*LocalIO && strcmp( IOName, (*LocalIO)->Name )) { while (*Channel && strcmp( ChannelName, (*Channel)->Name )) {
LocalIO = &((*LocalIO)->Next); Channel = &((*Channel)->Next);
} }
// Create if not exist // Create if not exist
if (!*LocalIO) { if (!*Channel) {
// Create // Create
*LocalIO = (TLocalIO*)malloc( sizeof(TLocalIO) ); *Channel = (TChannel*)malloc( sizeof(TChannel) );
memset( *LocalIO, 0, sizeof(TLocalIO) ); memset( *Channel, 0, sizeof(TChannel) );
// Set Name // Set Name
(*LocalIO)->Name = (char*)malloc( strlen(IOName)+1 ); (*Channel)->Name = (char*)malloc( strlen(ChannelName)+1 );
strcpy( (*LocalIO)->Name, IOName ); strcpy( (*Channel)->Name, ChannelName );
// Log Event // Log Event
if (Log) Log->Message( DebugLevel, dlLow, "%s: Local IO '%s' - Created", Name, IOName ); if (Log) Log->Message( DebugLevel, dlLow, "%s: Channel '%s' - Created", Name, ChannelName );
} }
return *LocalIO; return *Channel;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Automated Data Input/Output // Automated Data Input/Output
bool CFunctionCore::AddInput( const char * IOName, CFunctionCore * OutFunction, const char * OutputName, bool Bidirectional ) bool CFunctionCore::LinkInputChannel( const char * ChannelName, CFunctionCore * OutFunction, const char * OutChannelName, bool Bidirectional )
{ {
TLocalIO * LocalIO = NULL; TChannel * Channel = NULL;
TLinkedIO ** LinkedIO = NULL; TChannelLink ** LinkedChannel = NULL;
// Get IO // Get Channel
if (!OutFunction || !OutFunction || !(LocalIO = GetLocalIO( IOName ))) { if (!OutFunction || !OutFunction || !(Channel = GetChannel( ChannelName ))) {
return false; return false;
} }
// Check if linked IO exists // Check if linked Channel exists
LinkedIO = &(LocalIO->FirstInput); LinkedChannel = &(Channel->FirstInput);
while (*LinkedIO && (((*LinkedIO)->Function != OutFunction) || strcmp( (*LinkedIO)->IOName, OutputName ) )) { while (*LinkedChannel && (((*LinkedChannel)->Function != OutFunction) || strcmp( (*LinkedChannel)->Name, OutChannelName ) )) {
LinkedIO = &((*LinkedIO)->Next); LinkedChannel = &((*LinkedChannel)->Next);
} }
// Create if not found // Create if not found
if (!*LinkedIO) if (!*LinkedChannel)
{ {
// Create // Create
*LinkedIO = (TLinkedIO*)malloc( sizeof(TLinkedIO) ); *LinkedChannel = (TChannelLink*)malloc( sizeof(TChannelLink) );
memset( *LinkedIO, 0, sizeof( TLinkedIO )); memset( *LinkedChannel, 0, sizeof( TChannelLink ));
// Set Parameters // Set Parameters
(*LinkedIO)->Function = OutFunction; (*LinkedChannel)->Function = OutFunction;
(*LinkedIO)->IOName = (char*)malloc( strlen(OutputName)+1 ); (*LinkedChannel)->Name = (char*)malloc( strlen(OutChannelName)+1 );
strcpy( (*LinkedIO)->IOName, OutputName ); strcpy( (*LinkedChannel)->Name, OutChannelName );
// Log Event // Log Event
if (Log) Log->Message( DebugLevel, dlLow, "%s: Input Linked - '%s'/'%s' <-- '%s'/'%s'", Name, Name, IOName, OutFunction->GetName(), OutputName ); if (Log) Log->Message( DebugLevel, dlLow, "%s: Input Linked - '%s'/'%s' <-- '%s'/'%s'", Name, Name, ChannelName, OutFunction->GetName(), OutChannelName );
} }
// Link Return direction as well // Link Return direction as well
if (Bidirectional) { if (Bidirectional) {
return OutFunction->AddInput( OutputName, this, IOName, false ); return OutFunction->LinkInputChannel( OutChannelName, this, ChannelName, false );
} }
return true; return true;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool CFunctionCore::AddOutput( const char * IOName, CFunctionCore * InFunction, const char * InputName, bool Bidirectional ) bool CFunctionCore::LinkOutputChannel( const char * ChannelName, CFunctionCore * InFunction, const char * InChannelName, bool Bidirectional )
{ {
TLocalIO * LocalIO = NULL; TChannel * Channel = NULL;
TLinkedIO ** LinkedIO = NULL; TChannelLink ** LinkedChannel = NULL;
// Get IO // Get Channel
if (!InFunction || !InputName || !(LocalIO = GetLocalIO( IOName ))) { if (!InFunction || !InChannelName || !(Channel = GetChannel( ChannelName ))) {
return false; return false;
} }
// Check if linked IO exists // Check if linked Channel exists
LinkedIO = &(LocalIO->FirstOutput); LinkedChannel = &(Channel->FirstOutput);
while (*LinkedIO && (((*LinkedIO)->Function != InFunction) || strcmp( (*LinkedIO)->IOName, InputName ) )) { while (*LinkedChannel && (((*LinkedChannel)->Function != InFunction) || strcmp( (*LinkedChannel)->Name, InChannelName ) )) {
LinkedIO = &((*LinkedIO)->Next); LinkedChannel = &((*LinkedChannel)->Next);
} }
// Create if not found // Create if not found
if (!*LinkedIO) if (!*LinkedChannel)
{ {
// Create // Create
*LinkedIO = (TLinkedIO*)malloc( sizeof(TLinkedIO) ); *LinkedChannel = (TChannelLink*)malloc( sizeof(TChannelLink) );
memset( *LinkedIO, 0, sizeof( TLinkedIO )); memset( *LinkedChannel, 0, sizeof( TChannelLink ));
// Set Parameters // Set Parameters
(*LinkedIO)->Function = InFunction; (*LinkedChannel)->Function = InFunction;
(*LinkedIO)->IOName = (char*)malloc( strlen(InputName)+1 ); (*LinkedChannel)->Name = (char*)malloc( strlen(InChannelName)+1 );
strcpy( (*LinkedIO)->IOName, InputName ); strcpy( (*LinkedChannel)->Name, InChannelName );
// Log Event // Log Event
if (Log) Log->Message( DebugLevel, dlLow, "%s: Output Linked - '%s'/'%s' --> '%s'/'%s'", Name, Name, IOName, InFunction->GetName(), InputName ); if (Log) Log->Message( DebugLevel, dlLow, "%s: Output Linked - '%s'/'%s' --> '%s'/'%s'", Name, Name, ChannelName, InFunction->GetName(), InChannelName );
} }
// Link return direction as well // Link return direction as well
if (Bidirectional) { if (Bidirectional) {
return InFunction->AddOutput( InputName, this, IOName, false ); return InFunction->LinkOutputChannel( InChannelName, this, ChannelName, false );
} }
return true; return true;
@@ -214,77 +213,77 @@ bool CFunctionCore::AddOutput( const char * IOName, CFunctionCore * InFunction,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Manual Data Input/Output // Manual Data Input/Output
int CFunctionCore::Input( const char * IOName, const char * Data, int MaxLen ) int CFunctionCore::Input( const char * ChannelName, const char * Data, int MaxLen )
{ {
TLocalIO * LocalIO = NULL; TChannel * Channel = NULL;
// Validate // Validate
if (!IOName || !Data) { if (!ChannelName || !Data) {
return 0; return 0;
} }
else if (MaxLen == -1) { else if (MaxLen == -1) {
MaxLen = strlen( Data ); MaxLen = strlen( Data );
} }
// Get IO // Get Channel
if (!(LocalIO = GetLocalIO( IOName ))) if (!(Channel = GetChannel( ChannelName )))
{ {
// Log event // Log event
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Local IO '%s' - Input rejected, Local IO not found", Name, IOName ); if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Channel not found", Name, ChannelName );
return 0; return 0;
} }
// Log event // Log event
if (Log) Log->Output( DebugLevel, dlHigh, OutputDisplay, Data, MaxLen, "%s: Local IO '%s' - IN:", Name, IOName ); if (Log) Log->Output( DebugLevel, dlHigh, OutputDisplay, Data, MaxLen, "%s: Channel '%s' - IN:", Name, ChannelName );
// Return processed bytes // Return processed bytes
return MaxLen; return MaxLen;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int CFunctionCore::Output( const char * IOName, const char * Data, int Len ) int CFunctionCore::Output( const char * ChanelName, const char * Data, int Len )
{ {
TLocalIO * LocalIO = NULL; TChannel * Channel = NULL;
// Validate // Validate
if (!IOName || !Data) { if (!ChanelName || !Data) {
return 0; return 0;
} else if (Len == -1) { } else if (Len == -1) {
Len = strlen( Data ); Len = strlen( Data );
} }
// Get IO // Get Channel
if (!(LocalIO = GetLocalIO( IOName ))) if (!(Channel = GetChannel( ChanelName )))
{ {
// Log Event // Log Event
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Local IO '%s' - Output rejected, Local IO not found", Name, IOName ); if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Output rejected, Channel not found", Name, ChanelName );
return 0; return 0;
} }
// Return processed bytes // Return processed bytes
return Output( LocalIO, Data, Len ); return Output( Channel, Data, Len );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int CFunctionCore::Output( const TLocalIO * LocalIO, const char * Data, int Len ) int CFunctionCore::Output( const TChannel * Channel, const char * Data, int Len )
{ {
TLinkedIO * Output = NULL; TChannelLink * OutChannel = NULL;
// Validate // Validate
if (!LocalIO || !Data) { if (!Channel || !Data) {
return 0; return 0;
} else if (Len == -1) { } else if (Len == -1) {
Len = strlen( Data ); Len = strlen( Data );
} }
// Log event // Log event
if (Log) Log->Output( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Local IO '%s' - OUT:", Name, LocalIO->Name ); if (Log) Log->Output( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Channel '%s' - OUT:", Name, Channel->Name );
// Pass output to all linked inputs // Pass output to all linked inputs
Output = LocalIO->FirstOutput; OutChannel = Channel->FirstOutput;
while (Output) { while (OutChannel) {
Output->Function->Input( Output->IOName, Data, Len ); OutChannel->Function->Input( OutChannel->Name, Data, Len );
Output = Output->Next; OutChannel = OutChannel->Next;
} }
// Return processed bytes // Return processed bytes

View File

@@ -19,30 +19,30 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Preview // Preview
typedef struct SLocalIO TLocalIO; typedef struct SChannel TChannel;
typedef struct SLinkedIO TLinkedIO; typedef struct SChannelLink TChannelLink;
class CFunctionCore; class CFunctionCore;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct SLocalIO struct SChannel
{ {
char * Name; char * Name;
TLinkedIO * FirstInput; TChannelLink * FirstInput;
TLinkedIO * FirstOutput; TChannelLink * FirstOutput;
TLocalIO * Next; TChannel * Next;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct SLinkedIO struct SChannelLink
{ {
CFunctionCore * Function; CFunctionCore * Function;
char * IOName; char * Name;
SLinkedIO * Next; SChannelLink * Next;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -52,25 +52,25 @@ protected:
// Function Definition // Function Definition
char * Name; char * Name;
// IOs // Channels
TLocalIO * FirstIO; TChannel * FirstChannel;
// Output // Output
CLogCore * Log; CLogCore * Log;
EDebugLevel DebugLevel; EDebugLevel DebugLevel;
int OutputDisplay; int OutputDisplay;
// Manage IO // Manage Channel
inline TLocalIO * GetLocalIO( const char * Name ) { inline TChannel * GetChannel( const char * Name ) {
TLocalIO * LocalIO = FirstIO; TChannel * Channel = FirstChannel;
while (LocalIO && strcmp( Name, LocalIO->Name )) { while (Channel && strcmp( Name, Channel->Name )) {
LocalIO = LocalIO->Next; Channel = Channel->Next;
} }
return LocalIO; return Channel;
} }
// Manual Data Input/Output // Manual Data Input/Output
virtual int Output( const TLocalIO * LocalIO, const char * Data, int Len ); virtual int Output( const TChannel * Channel, const char * Data, int Len );
public: public:
// Life cycle // Life cycle
@@ -80,16 +80,16 @@ public:
// Miscellaneous // Miscellaneous
inline const char * GetName() { return Name; }; inline const char * GetName() { return Name; };
// Manage IOs // Manage Channels
virtual TLocalIO * AddLocalIO( const char * IOName ); virtual TChannel * AddChannel( const char * ChannelName );
// Manual Data Input/Output // Manual Data Input/Output
virtual int Input( const char * IOName, const char * Data, int MaxLen = -1 ); virtual int Input( const char * ChannelName, const char * Data, int MaxLen = -1 );
virtual int Output( const char * IOName, const char * Data, int Len = -1 ); virtual int Output( const char * ChannelName, const char * Data, int Len = -1 );
// Automated Data Input/Output // Automated Data Input/Output
virtual bool AddInput( const char * IOName, CFunctionCore * OutFunction, const char * OutputName, bool Bidirectional ); virtual bool LinkInputChannel( const char * ChannelName, CFunctionCore * OutFunction, const char * OutChannelName, bool Bidirectional );
virtual bool AddOutput( const char * IOName, CFunctionCore * InFunction, const char * InputName, bool Bidirectional ); virtual bool LinkOutputChannel( const char * ChannelName, CFunctionCore * InFunction, const char * InChannelName, bool Bidirectional );
virtual bool Process() = 0; virtual bool Process() = 0;
}; };

View File

@@ -60,7 +60,7 @@ CSelectableCore::~CSelectableCore()
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
THandle * CSelectableCore::CreateHandle( const char * HandleName, bool CreateLocalIO ) THandle * CSelectableCore::CreateHandle( const char * HandleName, bool CreateChannel )
{ {
THandle ** Handle = NULL; THandle ** Handle = NULL;
@@ -88,9 +88,9 @@ THandle * CSelectableCore::CreateHandle( const char * HandleName, bool CreateLo
if (Log) Log->Message( DebugLevel, dlMedium, "%s: Handle '%s' - Created", Name, HandleName ); if (Log) Log->Message( DebugLevel, dlMedium, "%s: Handle '%s' - Created", Name, HandleName );
} }
// Create Matching IO point // Create Matching Channel
if (CreateLocalIO) { if (CreateChannel) {
(*Handle)->LocalIO = AddLocalIO( HandleName ); (*Handle)->Channel = AddChannel( HandleName );
} }
return *Handle; return *Handle;
@@ -1037,9 +1037,9 @@ bool CSelectableCore::ProcessBuffer( THandle * Handle, bool Force )
// Write buffer to Outputs // Write buffer to Outputs
if (Handle->Type == ctRemoteClient) { if (Handle->Type == ctRemoteClient) {
Output( Handle->Parent->LocalIO, Data, Len ); Output( Handle->Parent->Channel, Data, Len );
} else { } else {
Output( Handle->LocalIO, Data, Len ); Output( Handle->Channel, Data, Len );
} }
// Clear processed bytes from buffer // Clear processed bytes from buffer
@@ -1056,9 +1056,9 @@ bool CSelectableCore::ProcessBuffer( THandle * Handle, bool Force )
// Write buffer to Outputs // Write buffer to Outputs
if (Handle->Type == ctRemoteClient) { if (Handle->Type == ctRemoteClient) {
Output( Handle->Parent->LocalIO, Data, Len ); Output( Handle->Parent->Channel, Data, Len );
} else { } else {
Output( Handle->LocalIO, Data, Len ); Output( Handle->Channel, Data, Len );
} }
// Clear processed bytes from buffer // Clear processed bytes from buffer
@@ -1127,14 +1127,14 @@ int CSelectableCore::WriteToFD( int FD, const char * Data, int Len, bool Force )
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int CSelectableCore::Input( const char * IOName, const char * Data, int Len ) int CSelectableCore::Input( const char * ChannelName, const char * Data, int Len )
{ {
THandle * Handle = NULL; THandle * Handle = NULL;
THandle * ChildHandle = NULL; THandle * ChildHandle = NULL;
int BytesWritten = 0; int BytesWritten = 0;
// Validate // Validate
if (!IOName || !Data) { if (!ChannelName || !Data) {
return 0; return 0;
} }
else if (Len == -1) { else if (Len == -1) {
@@ -1142,22 +1142,22 @@ int CSelectableCore::Input( const char * IOName, const char * Data, int Len )
} }
// Get File handle // Get File handle
if (!(Handle = GetHandle( IOName ))) if (!(Handle = GetHandle( ChannelName )))
{ {
// Log event // Log event
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Local IO '%s' - Input rejected, Input not found", Name, IOName ); if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Input not found", Name, ChannelName );
return 0; return 0;
} }
// Check that handle is open // Check that handle is open
else if (Handle->State != csOpen) else if (Handle->State != csOpen)
{ {
// Log event // Log event
if (Log) Log->Message( DebugLevel, dlHigh, "%s: Local IO '%s' - Input rejected, Handle not Open", Name, IOName ); if (Log) Log->Message( DebugLevel, dlHigh, "%s: Channel '%s' - Input rejected, Handle not Open", Name, ChannelName );
return 0; return 0;
} }
// Log event // Log event
if (Log) Log->Output( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Local IO '%s' - IN:", Name, IOName ); if (Log) Log->Output( DebugLevel, dlHigh, OutputDisplay, Data, Len, "%s: Channel '%s' - IN:", Name, ChannelName );
if (Handle->Type == ctServer) if (Handle->Type == ctServer)
{ {

View File

@@ -102,7 +102,7 @@ struct SHandle {
long ReopenTimeout; // millisecs long ReopenTimeout; // millisecs
// List / Tree // List / Tree
TLocalIO * LocalIO; TChannel * Channel;
THandle * Parent; THandle * Parent;
THandle * Next; THandle * Next;
}; };
@@ -224,7 +224,7 @@ public:
} }
// Configuration // Configuration
THandle * CreateHandle( const char * HandleName, bool CreateIO ); THandle * CreateHandle( const char * HandleName, bool CreateChannel );
bool SetAutoManage( THandle * Handle, bool AutoManage, int ReopenTime = 0 ); bool SetAutoManage( THandle * Handle, bool AutoManage, int ReopenTime = 0 );
bool SetBuffers( THandle * Handle, int InBufSize, int OutBufSize, int InTimeout, const char * InMarker, int InMarkerLen ); bool SetBuffers( THandle * Handle, int InBufSize, int OutBufSize, int InTimeout, const char * InMarker, int InMarkerLen );
bool SerialConfig( THandle * Handle, int Baud, short DataBits, short StopBits, short Parity, short FlowCtrl, int Wait ); bool SerialConfig( THandle * Handle, int Baud, short DataBits, short StopBits, short Parity, short FlowCtrl, int Wait );
@@ -248,7 +248,7 @@ public:
inline virtual bool Write( int FD ) { return (Write( GetHandle( FD ))); }; inline virtual bool Write( int FD ) { return (Write( GetHandle( FD ))); };
// Function Interface // Function Interface
virtual int Input( const char *IOName, const char * Buffer, int BufLen = -1 ); virtual int Input( const char *ChannelName, const char * Buffer, int BufLen = -1 );
virtual bool Process(); virtual bool Process();
}; };