CmdMessenger
3.0
CmdMessenger is a serial port messaging library for the Arduino
|
Command messenger main class More...
Public Member Functions | |
delegate void | MessengerCallbackFunction (ReceivedCommand receivedCommand) |
Definition of the messenger callback function. More... | |
CmdMessenger (SerialPortManager communications) | |
Constructor. More... | |
CmdMessenger (SerialPortManager communications, char fieldSeparator) | |
Constructor. More... | |
CmdMessenger (SerialPortManager communications, char fieldSeparator, char commandSeparator) | |
Constructor. More... | |
CmdMessenger (SerialPortManager communications, char fieldSeparator, char commandSeparator, char escapeCharacter) | |
Constructor. More... | |
void | SetControlToInvokeOn (Control controlToInvokeOn) |
Sets a control to invoke on. More... | |
bool | StopListening () |
Stop listening and end serial port connection. More... | |
bool | StartListening () |
Starts serial port connection and start listening. More... | |
void | Attach (MessengerCallbackFunction newFunction) |
Attaches default callback for unsupported commands. More... | |
void | Attach (int messageId, MessengerCallbackFunction newFunction) |
Attaches default callback for certain Message ID. More... | |
void | ProcessLines () |
Process the command lines and invokes callbacks. More... | |
void | HandleMessage (ReceivedCommand receivedCommand) |
Handle message. More... | |
ReceivedCommand | SendCommand (int cmdId) |
Sends a command. More... | |
ReceivedCommand | SendCommand (int cmdId, string argument) |
Sends a command. More... | |
ReceivedCommand | SendCommand (SendCommand sendCommand) |
Sends a command. More... | |
ReceivedCommand | SendCommand (int cmdId, string argument, bool reqAc, int ackCmdId, int timeout) |
Sends a command. More... | |
ReceivedCommand | SendCommand (int cmdId, string[] arguments, bool reqAc, int ackCmdId, int timeout) |
Sends a command. More... | |
void | Dispose () |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More... | |
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. More... | |
Properties | |
bool | PrintLfCr [get, set] |
Gets or sets a whether to print a line feed carriage return after each command. More... | |
String | CurrentReceivedLine [get, set] |
Gets or sets the current received command line. More... | |
ReceivedCommand | CurrentReceivedCommand [get, set] |
Gets or sets the current received command. More... | |
String | CurrentSentLine [get, set] |
Gets or sets the currently sent line. More... | |
long | LastLineTimeStamp [get, set] |
Gets or sets the time stamp of the last command line received. More... | |
Command messenger main class
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
inlineprotectedvirtual |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
disposing | true if resources should be disposed, false if not. |
|
inline |
Handle message.
receivedCommand | The received command. |
References CommandMessenger.ReceivedCommand.CommandId, and CommandMessenger.ReceivedCommand.Ok.
Referenced by CommandMessenger.CmdMessenger.ProcessLines().
delegate void CommandMessenger.CmdMessenger.MessengerCallbackFunction | ( | ReceivedCommand | receivedCommand | ) |
Definition of the messenger callback function.
receivedCommand | The received command. |
|
inline |
Process the command lines and invokes callbacks.
References CommandMessenger.CmdMessenger.CurrentReceivedCommand, CommandMessenger.CmdMessenger.CurrentReceivedLine, CommandMessenger.CmdMessenger.HandleMessage(), and CommandMessenger.CmdMessenger.LastLineTimeStamp.
|
inline |
Sends a command.
cmdId | Command ID. |
Referenced by CommandMessenger.CmdMessenger.SendCommand().
|
inline |
Sends a command.
cmdId | Command ID. |
argument | The command argument. |
References CommandMessenger.CmdMessenger.SendCommand().
|
inline |
Sends a command.
sendCommand | The command to sent. |
References CommandMessenger.SendCommand.AckCmdId, CommandMessenger.SendCommand.Arguments, CommandMessenger.SendCommand.CmdId, CommandMessenger.SendCommand.ReqAc, CommandMessenger.CmdMessenger.SendCommand(), and CommandMessenger.SendCommand.Timeout.
|
inline |
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. |
References CommandMessenger.CmdMessenger.SendCommand().
|
inline |
Sends a command.
cmdId | Command ID. |
arguments | The arguments. |
reqAc | true to request acknowledge command. |
ackCmdId | acknowledgement command ID |
timeout | Timeout on acknowlegde command. |
References CommandMessenger.CmdMessenger.CurrentSentLine, and CommandMessenger.CmdMessenger.PrintLfCr.
|
inline |
|
inline |
Starts serial port connection and start listening.
References CommandMessenger.CmdMessenger.LastLineTimeStamp, and CommandMessenger.SerialPortManager.StartListening().
|
inline |
|
getset |
Gets or sets the current received command.
The current received command.
Referenced by CommandMessenger.CmdMessenger.ProcessLines().
|
getset |
Gets or sets the current received command line.
The current received line.
Referenced by CommandMessenger.CmdMessenger.ProcessLines().
|
getset |
Gets or sets the currently sent line.
The currently sent line.
Referenced by CommandMessenger.CmdMessenger.SendCommand().
|
getset |
Gets or sets the time stamp of the last command line received.
The last line time stamp.
Referenced by CommandMessenger.CmdMessenger.ProcessLines(), and CommandMessenger.CmdMessenger.StartListening().
|
getset |
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.
Referenced by CommandMessenger.CmdMessenger.SendCommand().