Commands server
Use ICommandServer to implement low-level command protocol handling on the server side. The server publishes COMMAND_LONG and COMMAND_INT packets addressed to its system/component and can send COMMAND_ACK responses to the requester.
Use case
Register the service:
Then get the service:
Basic handling example:
Here we are using CommandResult to send a response.
API
ICommandServer
Represents a command server that receives and sends commands.
Property | Type | Description |
|---|---|---|
|
| Gets the event stream for receiving |
|
| Gets an observable sequence of |
Method | Return Type | Description |
|---|---|---|
|
| Sends a command acknowledgement with the specified parameters. |
ICommandServer.SendCommandAck
Parameter | Type | Description |
|---|---|---|
|
| The command being acknowledged. |
|
| The target device identity for the acknowledgement. |
|
| The result of the command execution. |
|
| Optional cancellation token. |
DeviceIdentity
Represents the identity of a device.
Constructor | Description |
|---|---|
| Represents a device identity. |
| Initializes a new instance of the |
Property | Type | Description |
|---|---|---|
|
| Static field representing system |
|
| Gets or sets the system ID. |
|
| Gets or sets the unique identifier for the component. |
CommandServerHelper
Helper class containing extension methods for ICommandServer interface.
Despite their name, both SendCommandAckAccepted overloads use the MavResult supplied by the caller; they are not limited to MavResultAccepted.
Method | Return Type | Description |
|---|---|---|
|
| Sends an acknowledgement for a |
|
| Sends an acknowledgement for a |
ICommandServer.SendCommandAckAccepted (CommandIntPacket overload)
Parameter | Type | Description |
|---|---|---|
|
| The command server. |
|
| The command request packet. |
|
| The mav result. |
|
| Optional cancel token argument. |
ICommandServer.SendCommandAckAccepted (CommandLongPacket overload)
Parameter | Type | Description |
|---|---|---|
|
| The command server. |
|
| The command long packet. |
|
| The result of the command. |
|
| Optional cancel token argument. |
CommandHelper
Provides helper methods for registering and accessing command-related microservices, including base command server and extended CommandLong/CommandInt handlers.
Property | Type | Description |
|---|---|---|
|
| Microservice type identifier ( |
Method | Return Type | Description |
|---|---|---|
|
| Registers |
|
| Registers |
|
| Registers |
|
| Resolves |
|
| Resolves |
|
| Resolves |