Commands ex-server
ICommandServerEx<TArgPacket> is a higher-level command dispatcher over ICommandServer. It provides command handler registry by MavCmd.
Use case
Register required services:
Get services:
Register and remove handler:
The dispatcher sends an acknowledgement for every handled request:
a handler's
CommandResultwhen the handler completes;Unsupportedwhen no handler is registered;Failedwhen the handler throws;InProgressfor a repeatedCOMMAND_LONGwith non-zero confirmation while the busy flag is set and the same command is already running;TemporarilyRejectedfor other requests received while the busy flag is set.
The handler receives the sender's system/component IDs as DeviceIdentity, the original packet, and a cancellation token that is cancelled when the dispatcher is disposed. Setting an indexer entry to null removes the handler. SupportedCommands reflects the currently registered handlers.
Built-in implementations
CommandServerEx<TArgPacket>: abstract dispatcher implementation. Its protected constructor accepts the base server, command packet observable, command ID selector, and confirmation selector.CommandLongServerEx: dispatcher overICommandServer.OnCommandLong. Usespayload.confirmationto detect duplicate retries.CommandIntServerEx: dispatcher overICommandServer.OnCommandInt. Confirmation is always treated as0.
Both implementations have a single constructor that accepts their base ICommandServer instance.
API
ICommandServerEx<TArgPacket>
Represents an extended command server.
Property | Type | Description |
|---|---|---|
|
| Gets the |
|
| Commands supported by the server. |
|
| Sets the command delegate for the specified MAVLink command. |
CommandDelegate<TArgPacket>
Represents a delegate that defines a command handler.
Parameter | Type | Description |
|---|---|---|
|
| The identity of the device that sent the command. |
|
| The argument packet for the command handler. |
|
| The cancellation token that can be used to cancel the command execution. |
Return Type | Description |
|---|---|
| Result that the dispatcher sends to the requester in an ACK. |