CmdMessenger
3.0
CmdMessenger is a serial port messaging library for the .Net / Mono Platform.
|
Command messenger main class. More...
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. |
Command messenger main class.
CommandMessenger.CmdMessenger.CmdMessenger | ( | SerialPortManager | communications | ) |
Constructor.
communications | The Serial port object. |
CommandMessenger.CmdMessenger.CmdMessenger | ( | SerialPortManager | communications, |
char | fieldSeparator | ||
) |
Constructor.
communications | The Serial port object. |
fieldSeparator | The field separator. |
CommandMessenger.CmdMessenger.CmdMessenger | ( | SerialPortManager | communications, |
char | fieldSeparator, | ||
char | commandSeparator | ||
) |
Constructor.
communications | The Serial port object. |
fieldSeparator | The field separator. |
commandSeparator | The command separator. |
CommandMessenger.CmdMessenger.CmdMessenger | ( | SerialPortManager | communications, |
char | fieldSeparator, | ||
char | commandSeparator, | ||
char | escapeCharacter | ||
) |
Constructor.
communications | The Serial port object. |
fieldSeparator | The field separator. |
commandSeparator | The command separator. |
escapeCharacter | The escape character. |
void CommandMessenger.CmdMessenger.Attach | ( | MessengerCallbackFunction | newFunction | ) |
Attaches default callback for unsupported commands.
newFunction | The callback function. |
void CommandMessenger.CmdMessenger.Attach | ( | int | messageId, |
MessengerCallbackFunction | newFunction | ||
) |
Attaches default callback for certain Message ID.
messageId | Command ID. |
newFunction | The 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.
disposing | true if resources should be disposed, false if not. |
void CommandMessenger.CmdMessenger.HandleMessage | ( | ReceivedCommand | receivedCommand | ) |
Handle message.
receivedCommand | The received command. |
delegate void CommandMessenger.CmdMessenger.MessengerCallbackFunction | ( | ReceivedCommand | receivedCommand | ) |
Definition of the messenger callback function.
receivedCommand | The received command. |
Process the command lines and invokes callbacks.
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | int | cmdId | ) |
Sends a command.
cmdId | Command ID. |
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | int | cmdId, |
string | argument | ||
) |
Sends a command.
cmdId | Command ID. |
argument | The command argument. |
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | SendCommand | sendCommand | ) |
Sends a command.
sendCommand | The command to sent. |
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | int | cmdId, |
string | argument, | ||
bool | reqAc, | ||
int | ackCmdId, | ||
int | timeout | ||
) |
Sends a command.
cmdId | Command ID. |
argument | The command argument. |
reqAc | true to request acknowledge command. |
ackCmdId | acknowledgement command ID |
timeout | Timeout on acknowlegde command. |
ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | int | cmdId, |
string[] | arguments, | ||
bool | reqAc, | ||
int | ackCmdId, | ||
int | timeout | ||
) |
Sends a command.
cmdId | Command ID. |
arguments | The arguments. |
reqAc | true to request acknowledge command. |
ackCmdId | acknowledgement command ID |
timeout | Timeout on acknowlegde command. |
void CommandMessenger.CmdMessenger.SetControlToInvokeOn | ( | Control | controlToInvokeOn | ) |
Sets a control to invoke on.
controlToInvokeOn | The control to invoke on. |
Starts serial port connection and start listening.
Stop listening and end serial port connection.
Gets or sets the current received command.
The current received command.
String CommandMessenger.CmdMessenger.CurrentReceivedLine [get, set] |
Gets or sets the current received command line.
The current received line.
String CommandMessenger.CmdMessenger.CurrentSentLine [get, set] |
Gets or sets the currently sent line.
The currently sent line.
long CommandMessenger.CmdMessenger.LastLineTimeStamp [get, set] |
Gets or sets the time stamp of the last command line received.
The last line time stamp.
bool CommandMessenger.CmdMessenger.PrintLfCr [get, set] |
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.