CmdMessenger  3.0
CmdMessenger is a serial port messaging library for the .Net / Mono Platform.
Public Member Functions | Public Attributes | Protected Member Functions | Properties
CommandMessenger.CmdMessenger Class Reference

Command messenger main class. More...

List of all members.

Public Member Functions

delegate void MessengerCallbackFunction (ReceivedCommand receivedCommand)
 Definition of the messenger callback function.
 CmdMessenger (SerialPortManager communications)
 Constructor.
 CmdMessenger (SerialPortManager communications, char fieldSeparator)
 Constructor.
 CmdMessenger (SerialPortManager communications, char fieldSeparator, char commandSeparator)
 Constructor.
 CmdMessenger (SerialPortManager communications, char fieldSeparator, char commandSeparator, char escapeCharacter)
 Constructor.
void SetControlToInvokeOn (Control controlToInvokeOn)
 Sets a control to invoke on.
bool StopListening ()
 Stop listening and end serial port connection.
bool StartListening ()
 Starts serial port connection and start listening.
void Attach (MessengerCallbackFunction newFunction)
 Attaches default callback for unsupported commands.
void Attach (int messageId, MessengerCallbackFunction newFunction)
 Attaches default callback for certain Message ID.
void ProcessLines ()
 Process the command lines and invokes callbacks.
void HandleMessage (ReceivedCommand receivedCommand)
 Handle message.
ReceivedCommand SendCommand (int cmdId)
 Sends a command.
ReceivedCommand SendCommand (int cmdId, string argument)
 Sends a command.
ReceivedCommand SendCommand (SendCommand sendCommand)
 Sends a command.
ReceivedCommand SendCommand (int cmdId, string argument, bool reqAc, int ackCmdId, int timeout)
 Sends a command.
ReceivedCommand SendCommand (int cmdId, string[] arguments, bool reqAc, int ackCmdId, int timeout)
 Sends a command.
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Public Attributes

EventHandler NewLinesReceived
EventHandler NewLineReceived
EventHandler NewLineSent

Protected Member Functions

virtual void Dispose (bool disposing)
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Properties

bool PrintLfCr [get, set]
 Gets or sets a whether to print a line feed carriage return after each command.
String CurrentReceivedLine [get, set]
 Gets or sets the current received command line.
ReceivedCommand CurrentReceivedCommand [get, set]
 Gets or sets the current received command.
String CurrentSentLine [get, set]
 Gets or sets the currently sent line.
ConcurrencyPriority Priority [get, set]
long LastLineTimeStamp [get, set]
 Gets or sets the time stamp of the last command line received.

Detailed Description

Command messenger main class.


Constructor & Destructor Documentation

Constructor.

Parameters:
communicationsThe Serial port object.
CommandMessenger.CmdMessenger.CmdMessenger ( SerialPortManager  communications,
char  fieldSeparator 
)

Constructor.

Parameters:
communicationsThe Serial port object.
fieldSeparatorThe field separator.
CommandMessenger.CmdMessenger.CmdMessenger ( SerialPortManager  communications,
char  fieldSeparator,
char  commandSeparator 
)

Constructor.

Parameters:
communicationsThe Serial port object.
fieldSeparatorThe field separator.
commandSeparatorThe command separator.
CommandMessenger.CmdMessenger.CmdMessenger ( SerialPortManager  communications,
char  fieldSeparator,
char  commandSeparator,
char  escapeCharacter 
)

Constructor.

Parameters:
communicationsThe Serial port object.
fieldSeparatorThe field separator.
commandSeparatorThe command separator.
escapeCharacterThe escape character.

Member Function Documentation

Attaches default callback for unsupported commands.

Parameters:
newFunctionThe callback function.
void CommandMessenger.CmdMessenger.Attach ( int  messageId,
MessengerCallbackFunction  newFunction 
)

Attaches default callback for certain Message ID.

Parameters:
messageIdCommand ID.
newFunctionThe callback function.

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

virtual void CommandMessenger.CmdMessenger.Dispose ( bool  disposing) [protected, virtual]

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Parameters:
disposingtrue if resources should be disposed, false if not.

Handle message.

Parameters:
receivedCommandThe received command.

Definition of the messenger callback function.

Parameters:
receivedCommandThe received command.

Process the command lines and invokes callbacks.

Sends a command.

Parameters:
cmdIdCommand ID.
Returns:
.
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand ( int  cmdId,
string  argument 
)

Sends a command.

Parameters:
cmdIdCommand ID.
argumentThe command argument.
Returns:
.

Sends a command.

Parameters:
sendCommandThe command to sent.
Returns:
.
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand ( int  cmdId,
string  argument,
bool  reqAc,
int  ackCmdId,
int  timeout 
)

Sends a command.

Parameters:
cmdIdCommand ID.
argumentThe command argument.
reqActrue to request acknowledge command.
ackCmdIdacknowledgement command ID
timeoutTimeout on acknowlegde command.
Returns:
.
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand ( int  cmdId,
string[]  arguments,
bool  reqAc,
int  ackCmdId,
int  timeout 
)

Sends a command.

Parameters:
cmdIdCommand ID.
argumentsThe arguments.
reqActrue to request acknowledge command.
ackCmdIdacknowledgement command ID
timeoutTimeout on acknowlegde command.
Returns:
.
void CommandMessenger.CmdMessenger.SetControlToInvokeOn ( Control  controlToInvokeOn)

Sets a control to invoke on.

Parameters:
controlToInvokeOnThe control to invoke on.

Starts serial port connection and start listening.

Returns:
true if it succeeds, false if it fails.

Stop listening and end serial port connection.

Returns:
true if it succeeds, false if it fails.

Property Documentation

Gets or sets the current received command.

The current received command.

Gets or sets the current received command line.

The current received line.

Gets or sets the currently sent line.

The currently sent line.

Gets or sets the time stamp of the last command line received.

The last line time stamp.

Gets or sets a whether to print a line feed carriage return after each command.

true if print line feed carriage return, false if not.


The documentation for this class was generated from the following file: