|
CmdMessenger
4.0.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 (ITransport transport, BoardType boardType=BoardType.Bit16) | |
| Constructor. | |
| CmdMessenger (ITransport transport, int sendBufferMaxLength, BoardType boardType=BoardType.Bit16) | |
| Constructor. | |
| CmdMessenger (ITransport transport, BoardType boardType, char fieldSeparator) | |
| Constructor. | |
| CmdMessenger (ITransport transport, BoardType boardType, char fieldSeparator, int sendBufferMaxLength) | |
| Constructor. | |
| CmdMessenger (ITransport transport, BoardType boardType, char fieldSeparator, char commandSeparator) | |
| Constructor. | |
| CmdMessenger (ITransport transport, BoardType boardType, char fieldSeparator, char commandSeparator, char escapeCharacter, int sendBufferMaxLength) | |
| Constructor. | |
| void | Dispose () |
| Disposal of CmdMessenger. | |
| void | SetControlToInvokeOn (Control controlToInvokeOn) |
| Sets a control to invoke on. | |
| bool | Disconnect () |
| Stop listening and end serial port connection. | |
| bool | Connect () |
| 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. | |
| ReceivedCommand | SendCommand (SendCommand sendCommand, SendQueue sendQueueState=SendQueue.InFrontQueue, ReceiveQueue receiveQueueState=ReceiveQueue.Default) |
| Sends a command. If no command acknowledge is requested, the command will be send asynchronously: it will be put on the top of the send queue If a command acknowledge is requested, the command will be send synchronously: the program will block until the acknowledge command has been received or the timeout has expired. Based on ClearQueueState, the send- and receive-queues are left intact or are cleared. | |
| ReceivedCommand | SendCommand (SendCommand sendCommand, SendQueue sendQueueState, ReceiveQueue receiveQueueState, UseQueue useQueue) |
| Sends a command. If no command acknowledge is requested, the command will be send asynchronously: it will be put on the top of the send queue If a command acknowledge is requested, the command will be send synchronously: the program will block until the acknowledge command has been received or the timeout has expired. Based on ClearQueueState, the send- and receive-queues are left intact or are cleared. | |
| ReceivedCommand | SendCommandSync (SendCommand sendCommand, SendQueue sendQueueState) |
| Synchronized send a command. | |
| void | QueueCommand (SendCommand sendCommand) |
| Put the command at the back of the sent queue. | |
| void | QueueCommand (CommandStrategy commandStrategy) |
| Put a command wrapped in a strategy at the back of the sent queue. | |
| void | AddReceiveCommandStrategy (GeneralStrategy generalStrategy) |
| Adds a general command strategy to the receive queue. This will be executed on every enqueued and dequeued command. | |
| void | AddSendCommandStrategy (GeneralStrategy generalStrategy) |
| Adds a general command strategy to the send queue. This will be executed on every enqueued and dequeued command. | |
| void | ClearReceiveQueue () |
| Clears the receive queue. | |
| void | ClearSendQueue () |
| Clears the send queue. | |
Protected Member Functions | |
| virtual void | Dispose (bool disposing) |
Properties | |
| bool | PrintLfCr [get, set] |
| Gets or sets a whether to print a line feed carriage return after each command. | |
| Control | ControlToInvokeOn [get, set] |
| The control to invoke the callback on. | |
| long | LastReceivedCommandTimeStamp [get] |
| Gets or sets the time stamp of the last command line received. | |
Events | |
| EventHandler< CommandEventArgs > | NewLineReceived |
| Event handler for one or more lines received. | |
| EventHandler< CommandEventArgs > | NewLineSent |
| Event handler for a new line sent. | |
Command messenger main class.
| CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport, |
| BoardType | boardType = BoardType.Bit16 |
||
| ) |
Constructor.
| transport | The transport layer. |
| boardType | Embedded Processor type. Needed to translate variables between sides. |
| CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport, |
| int | sendBufferMaxLength, | ||
| BoardType | boardType = BoardType.Bit16 |
||
| ) |
Constructor.
| transport | The transport layer. |
| sendBufferMaxLength | The maximum size of the send buffer |
| boardType | Embedded Processor type. Needed to translate variables between sides. |
| CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport, |
| BoardType | boardType, | ||
| char | fieldSeparator | ||
| ) |
Constructor.
| transport | The transport layer. |
| boardType | Embedded Processor type. Needed to translate variables between sides. |
| fieldSeparator | The field separator. |
| CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport, |
| BoardType | boardType, | ||
| char | fieldSeparator, | ||
| int | sendBufferMaxLength | ||
| ) |
Constructor.
| transport | The transport layer. |
| boardType | Embedded Processor type. Needed to translate variables between sides. |
| fieldSeparator | The field separator. |
| sendBufferMaxLength | The maximum size of the send buffer |
| CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport, |
| BoardType | boardType, | ||
| char | fieldSeparator, | ||
| char | commandSeparator | ||
| ) |
Constructor.
| transport | The transport layer. |
| boardType | Embedded Processor type. Needed to translate variables between sides. |
| fieldSeparator | The field separator. |
| commandSeparator | The command separator. |
| CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport, |
| BoardType | boardType, | ||
| char | fieldSeparator, | ||
| char | commandSeparator, | ||
| char | escapeCharacter, | ||
| int | sendBufferMaxLength | ||
| ) |
Constructor.
| transport | The transport layer. |
| boardType | Embedded Processor type. Needed to translate variables between sides. |
| fieldSeparator | The field separator. |
| commandSeparator | The command separator. |
| escapeCharacter | The escape character. |
| sendBufferMaxLength | The maximum size of the send buffer |
| void CommandMessenger.CmdMessenger.AddReceiveCommandStrategy | ( | GeneralStrategy | generalStrategy | ) |
Adds a general command strategy to the receive queue. This will be executed on every enqueued and dequeued command.
| generalStrategy | The general strategy for the receive queue. |
| void CommandMessenger.CmdMessenger.AddSendCommandStrategy | ( | GeneralStrategy | generalStrategy | ) |
Adds a general command strategy to the send queue. This will be executed on every enqueued and dequeued command.
| generalStrategy | The general strategy for the send queue. |
| 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. |
Clears the receive queue.
Clears the send queue.
Starts serial port connection and start listening.
Stop listening and end serial port connection.
Disposal of CmdMessenger.
| delegate void CommandMessenger.CmdMessenger.MessengerCallbackFunction | ( | ReceivedCommand | receivedCommand | ) |
Definition of the messenger callback function.
| receivedCommand | The received command. |
| void CommandMessenger.CmdMessenger.QueueCommand | ( | SendCommand | sendCommand | ) |
Put the command at the back of the sent queue.
| sendCommand | The command to sent. |
| void CommandMessenger.CmdMessenger.QueueCommand | ( | CommandStrategy | commandStrategy | ) |
Put a command wrapped in a strategy at the back of the sent queue.
| commandStrategy | The command strategy. |
| ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | SendCommand | sendCommand, |
| SendQueue | sendQueueState = SendQueue.InFrontQueue, |
||
| ReceiveQueue | receiveQueueState = ReceiveQueue.Default |
||
| ) |
Sends a command. If no command acknowledge is requested, the command will be send asynchronously: it will be put on the top of the send queue If a command acknowledge is requested, the command will be send synchronously: the program will block until the acknowledge command has been received or the timeout has expired. Based on ClearQueueState, the send- and receive-queues are left intact or are cleared.
| sendCommand | The command to sent. |
| sendQueueState | Property to optionally clear/wait the send queue |
| receiveQueueState | Property to optionally clear/wait the send queue |
| ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | SendCommand | sendCommand, |
| SendQueue | sendQueueState, | ||
| ReceiveQueue | receiveQueueState, | ||
| UseQueue | useQueue | ||
| ) |
Sends a command. If no command acknowledge is requested, the command will be send asynchronously: it will be put on the top of the send queue If a command acknowledge is requested, the command will be send synchronously: the program will block until the acknowledge command has been received or the timeout has expired. Based on ClearQueueState, the send- and receive-queues are left intact or are cleared.
| sendCommand | The command to sent. |
| sendQueueState | Property to optionally clear/wait the send queue |
| receiveQueueState | Property to optionally clear/wait the send queue |
| useQueue | Property to optionally bypass the queue |
| ReceivedCommand CommandMessenger.CmdMessenger.SendCommandSync | ( | SendCommand | sendCommand, |
| SendQueue | sendQueueState | ||
| ) |
Synchronized send a command.
| sendCommand | The command to sent. |
| sendQueueState | Property to optionally clear/wait the send queue. |
| void CommandMessenger.CmdMessenger.SetControlToInvokeOn | ( | Control | controlToInvokeOn | ) |
Sets a control to invoke on.
| controlToInvokeOn | The control to invoke on. |
Control CommandMessenger.CmdMessenger.ControlToInvokeOn [get, set] |
The control to invoke the callback on.
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.
Event handler for one or more lines received.
| EventHandler<CommandEventArgs> CommandMessenger.CmdMessenger.NewLineSent |
Event handler for a new line sent.
1.7.6.1