CmdMessenger 3.0 CmdMessenger is a serial port messaging library for the .Net / Mono Platform.

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Properties | Events
CommandMessenger.CmdMessenger Class Reference

Command messenger main class. More...

Inheritance diagram for CommandMessenger.CmdMessenger:

List of all members.

## Public Member Functions

delegate void | MessengerCallbackFunction (ReceivedCommand receivedCommand)
| Definition of the messenger callback function.
| CmdMessenger (ITransport transport)
| Constructor.
| CmdMessenger (ITransport transport, int sendBufferMaxLength)
| Constructor.
| CmdMessenger (ITransport transport, char fieldSeparator)
| Constructor.
| CmdMessenger (ITransport transport, char fieldSeparator, int sendBufferMaxLength)
| Constructor.
| CmdMessenger (ITransport transport, char fieldSeparator, char commandSeparator)
| Constructor.
| CmdMessenger (ITransport transport, char fieldSeparator, char commandSeparator, char escapeCharacter, int sendBufferMaxLength)
| Constructor.
void | SetSingleCore ()
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.
void | HandleMessage (ReceivedCommand receivedCommand)
| Handle message.
ReceivedCommand | SendCommand (SendCommand sendCommand)
| 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.
ReceivedCommand | SendCommand (SendCommand sendCommand, SendQueue sendQueueState, ReceiveQueue receiveQueueState)

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

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

## Properties

BoardType | BoardType `[get, set]`
| Embedded Processor type. Needed to translate variables between sides.
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.
long | LastReceivedCommandTimeStamp `[get]`
| Gets or sets the time stamp of the last command line received.

## Events

NewLineEvent.NewLineHandler | NewLineReceived
NewLineEvent.NewLineHandler | NewLineSent

## Detailed Description

Command messenger main class.

## Constructor & Destructor Documentation

CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport | ) |

Constructor.

Parameters:

  transport | The transport layer.

CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport,
|  | int | sendBufferMaxLength
| ) |  |

Constructor.

Parameters:

  transport | The transport layer.
  sendBufferMaxLength | The maximum size of the send buffer

CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport,
|  | char | fieldSeparator
| ) |  |

Constructor.

Parameters:

  transport | The transport layer.
  fieldSeparator | The field separator.

CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport,
|  | char | fieldSeparator,
|  | int | sendBufferMaxLength
| ) |  |

Constructor.

Parameters:

  transport | The transport layer.
  fieldSeparator | The field separator.
  sendBufferMaxLength | The maximum size of the send buffer

CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport,
|  | char | fieldSeparator,
|  | char | commandSeparator
| ) |  |

Constructor.

Parameters:

  transport | The transport layer.
  fieldSeparator | The field separator.
  commandSeparator | The command separator.

CommandMessenger.CmdMessenger.CmdMessenger | ( | ITransport | transport,
|  | char | fieldSeparator,
|  | char | commandSeparator,
|  | char | escapeCharacter,
|  | int | sendBufferMaxLength
| ) |  |

Constructor.

Parameters:

  transport | The transport layer.
  fieldSeparator | The field separator.
  commandSeparator | The command separator.
  escapeCharacter | The escape character.
  sendBufferMaxLength | The maximum size of the send buffer

## Member Function Documentation

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.

Parameters:

  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.

Parameters:

  generalStrategy | The general strategy for the send queue.

void CommandMessenger.CmdMessenger.Attach | ( | MessengerCallbackFunction | newFunction | ) |

Attaches default callback for unsupported commands.

Parameters:

  newFunction | The callback function.

void CommandMessenger.CmdMessenger.Attach | ( | int | messageId,
|  | MessengerCallbackFunction | newFunction
| ) |  |

Attaches default callback for certain Message ID.

Parameters:

  messageId | Command ID.
  newFunction | The callback function.

void CommandMessenger.CmdMessenger.ClearReceiveQueue | ( |  | ) |

Clears the receive queue.

void CommandMessenger.CmdMessenger.ClearSendQueue | ( |  | ) |

Clears the send queue.

bool CommandMessenger.CmdMessenger.Connect | ( |  | ) |

Starts serial port connection and start listening.

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

bool CommandMessenger.CmdMessenger.Disconnect | ( |  | ) |

Stop listening and end serial port connection.

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

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

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

Parameters:

  disposing | true if resources should be disposed, false if not.

Reimplemented from CommandMessenger.DisposableObject.

void CommandMessenger.CmdMessenger.HandleMessage | ( | ReceivedCommand | receivedCommand | ) |

Handle message.

Parameters:

  receivedCommand | The received command.

delegate void CommandMessenger.CmdMessenger.MessengerCallbackFunction | ( | ReceivedCommand | receivedCommand | ) |

Definition of the messenger callback function.

Parameters:

  receivedCommand | The received command.

void CommandMessenger.CmdMessenger.QueueCommand | ( | SendCommand | sendCommand | ) |

Put the command at the back of the sent queue.

Parameters:

  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.

Parameters:

  commandStrategy | The command strategy.

ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | SendCommand | sendCommand | ) |

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.

Parameters:

  sendCommand | The command to sent.

ReceivedCommand CommandMessenger.CmdMessenger.SendCommand | ( | SendCommand | sendCommand,
|  | SendQueue | sendQueueState,
|  | ReceiveQueue | receiveQueueState
| ) |  |

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.

Parameters:

  sendCommand | The command to sent.
  sendQueueState | Property to optionally clear/wait the send queue
  receiveQueueState | Property to optionally clear/wait the send queue

Returns:
  A received command. The received command will only be valid if the ReqAc of the command is true.

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.

Parameters:

  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

Returns:
  A received command. The received command will only be valid if the ReqAc of the command is true.

ReceivedCommand CommandMessenger.CmdMessenger.SendCommandSync | ( | SendCommand | sendCommand,
|  | SendQueue | sendQueueState
| ) |  |

Synchronized send a command.

Parameters:

  sendCommand | The command to sent.
  sendQueueState | Property to optionally clear/wait the send queue.

Returns:
  .

void CommandMessenger.CmdMessenger.SetControlToInvokeOn | ( | Control | controlToInvokeOn | ) |

Sets a control to invoke on.

Parameters:

  controlToInvokeOn | The control to invoke on.

## Property Documentation

BoardType CommandMessenger.CmdMessenger.BoardType `[get, set]`

Embedded Processor type. Needed to translate variables between sides.

The current received line.

String CommandMessenger.CmdMessenger.CurrentReceivedLine `[get, set]`

Gets or sets the current received command line.

The current received line.

long CommandMessenger.CmdMessenger.LastReceivedCommandTimeStamp `[get]`

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.

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

- D:/My Documents/Github/Arduino-Code-and-Libraries/Libraries/CmdMessenger/CSharp/CommandMessenger/CmdMessenger.cs