|
7 | 7 | #define OT_COAP_RESOURCE_NAME "Lamp"
|
8 | 8 |
|
9 | 9 | const char *otSetupLeader[] = {
|
10 |
| - // clear/disable all |
11 |
| - "coap", "stop", "thread", "stop", "ifconfig", "down", "dataset", "clear", |
12 |
| - // set dataset |
13 |
| - "dataset", "init new", "dataset channel", OT_CHANNEL, "dataset networkkey", OT_NETWORK_KEY, "dataset", "commit active", |
14 |
| - // network start |
15 |
| - "ifconfig", "up", "thread", "start" |
| 10 | + // -- clear/disable all |
| 11 | + // stop CoAP |
| 12 | + "coap", "stop", |
| 13 | + // stop Thread |
| 14 | + "thread", "stop", |
| 15 | + // stop the interface |
| 16 | + "ifconfig", "down", |
| 17 | + // clear the dataset |
| 18 | + "dataset", "clear", |
| 19 | + // -- set dataset |
| 20 | + // create a new complete dataset with random data |
| 21 | + "dataset", "init new", |
| 22 | + // set the channel |
| 23 | + "dataset channel", OT_CHANNEL, |
| 24 | + // set the network key |
| 25 | + "dataset networkkey", OT_NETWORK_KEY, |
| 26 | + // commit the dataset |
| 27 | + "dataset", "commit active", |
| 28 | + // -- network start |
| 29 | + // start the interface |
| 30 | + "ifconfig", "up", |
| 31 | + // start the Thread network |
| 32 | + "thread", "start" |
16 | 33 | };
|
17 | 34 |
|
18 | 35 | const char *otCoapLamp[] = {
|
19 |
| - // create a multicast IPv6 Address for this device |
| 36 | + // -- create a multicast IPv6 Address for this device |
20 | 37 | "ipmaddr add", OT_MCAST_ADDR,
|
21 |
| - // start and create a CoAP resource |
22 |
| - "coap", "start", "coap resource", OT_COAP_RESOURCE_NAME, "coap set", "0" |
| 38 | + // -- start and create a CoAP resource |
| 39 | + // start CoAP as server |
| 40 | + "coap", "start", |
| 41 | + // create a CoAP resource |
| 42 | + "coap resource", OT_COAP_RESOURCE_NAME, |
| 43 | + // set the CoAP resource initial value |
| 44 | + "coap set", "0" |
23 | 45 | };
|
24 | 46 |
|
25 | 47 | bool otDeviceSetup(const char **otSetupCmds, uint8_t nCmds1, const char **otCoapCmds, uint8_t nCmds2, ot_device_role_t expectedRole) {
|
|
0 commit comments