/** * \page cmd_exterior Command Engine, Exterior Interface Protocols This page describes the command engine exterior interface protocols between a ScatterWeb and the outside world.
At the lower layer, the command engine is connected to available hardware interfaces of the ScatterWeb node.
Currently commands can be received and submitted through two hardware interfaces: radio and serial port. While the radio is used for forwarding and node to node communication, the serial port is used at gateways to allow human operators and applications access to the sensor network.
\section cmd_l1_serial Serial InterfaceThe serial interface is the main human-machine and machine-machine interface to the network. Input is interpreted line-wise. Lines may not contain NUL characters and are terminated by CR or CRLF.
Inbound lines are classified by the first character.
| Marker | Description |
|---|---|
> |
Inbound Binary-Mode Command Request. All following characters until LF are hex-encoded |
\@ |
Inbound ASCII-Mode Command Request with destination address |
| others | Inbound ASCII-Mode Command Request |
Outbound lines can be classified by the receiver by the the first character.
| Marker | Description |
|---|---|
< |
Outbound Binary-Mode Command Reply. All following characters until LF are hex-encoded |
[ |
Outbound ASCII-Mode Command Reply |
| others | Informative ASCII output |
Inbound ASCII command requests have the following format.
| Forward address (optional) | Command String | Argument String (optional) | Comment (optional) |
@(\\*|[0-9]+)\\s |
[a-zA-Z0-9]+ |
\\s[^$]* |
\\s+#[^$]* |
Examples:
| Example | Destination | Description |
|---|---|---|
id |
directly connected node | Command request with no arguments |
id 1 |
directly connected node | Command request with one argument |
\@* id |
all nodes in network | Broadcast command request with no arguments |
\@11 echoargs 1 2 3 |
11 | Unicast commad request with three arguments |
Outbound ASCII-Mode command responses have the following format. If no source address is given, the response was sent by the connected node.
| Source address (optional) | Command String | Argument String (optional) |
|---|---|---|
\\[[0-9]+\]\\s |
\\[[a-zA-Z0-9]+\\] |
\\s[^$]* |
To separate multiple arguments it is good practice to separate them by one or more spaces (0x20). If name shall be supplied with the arguments these should be precede the argument.
Outbound responses can be sent without previous request making them unsolicited responses.
| Example | Destination | Description |
|---|---|---|
[id] 1 |
directly connected node | Command response with unnamed argument |
[11] [echoargs] A:1 B:2 C:3 |
11 | Command response with three named arguments |