2
2
#include " OThreadCLI_Util.h"
3
3
4
4
// Leader node shall use the same Network Key and channel
5
- #define CLI_NETWORK_KEY " dataset networkkey 00112233445566778899aabbccddeeff"
6
- #define CLI_NETWORK_CHANEL " dataset channel 24"
5
+ #define CLI_NETWORK_KEY " 00112233445566778899aabbccddeeff"
6
+ #define CLI_NETWORK_CHANEL " 24"
7
7
bool otStatus = true ;
8
8
9
9
void setup () {
@@ -12,14 +12,12 @@ void setup() {
12
12
Serial.println (" Setting up OpenThread Node as Router/Child" );
13
13
Serial.println (" Make sure the Leader Node is already running" );
14
14
15
- // This sketch will use CLI responses, therefore, it shall always process each CLI return
16
- char resp[256 ];
17
- otStatus &= otGetRespCmd (" dataset clear" , resp);
18
- otStatus &= otGetRespCmd (CLI_NETWORK_KEY, resp);
19
- otStatus &= otGetRespCmd (CLI_NETWORK_CHANEL, resp);
20
- otStatus &= otGetRespCmd (" dataset commit active" , resp);
21
- otStatus &= otGetRespCmd (" ifconfig up" , resp);
22
- otStatus &= otGetRespCmd (" thread start" , resp);
15
+ otStatus &= otExecCommand (" dataset" , " clear" );
16
+ otStatus &= otExecCommand (" dataset networkkey" , CLI_NETWORK_KEY);
17
+ otStatus &= otExecCommand (" dataset channel" , CLI_NETWORK_CHANEL);
18
+ otStatus &= otExecCommand (" dataset" , " commit active" );
19
+ otStatus &= otExecCommand (" ifconfig" , " up" );
20
+ otStatus &= otExecCommand (" thread" , " start" );
23
21
24
22
if (!otStatus) {
25
23
Serial.println (" \r\n\t ===> Failed starting Thread Network!" );
@@ -41,6 +39,7 @@ void setup() {
41
39
// print the PanID using 2 methods
42
40
43
41
// CLI
42
+ char resp[256 ];
44
43
if (otGetRespCmd (" panid" , resp)) {
45
44
Serial.printf (" \r\n PanID[using CLI]: %s\r\n " , resp);
46
45
} else {
0 commit comments