From 691243701faeffb6e4483189efb0a346f4e17b24 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 18:05:06 -0300 Subject: [PATCH 01/12] feat(openthread): add extended example Creates a new example that mixes different APIs --- .../ExtendedRoterNode/ExtendedRoterNode.ino | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino new file mode 100644 index 00000000000..4caa4712213 --- /dev/null +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino @@ -0,0 +1,66 @@ +#include "OThreadCLI.h" +#include "OThreadCLI_Util.h" + +// Leader node shall use the same Network Key and channel +#define CLI_NETWORK_KEY "dataset networkkey 00112233445566778899aabbccddeeff" +#define CLI_NETWORK_CHANEL "dataset channel 24" +bool otStatus = true; + +void setup() { + Serial.begin(115200); + OThreadCLI.begin(false); // No AutoStart - fresh start + Serial.println("Setting up OpenThread Node as Router/Child"); + Serial.println("Make sure the Leader Node is already running"); + + // This sketch will use CLI responses, therefore, it shall always process each CLI return + char resp[256]; + otStatus &= otGetRespCmd("dataset clear", resp); + otStatus &= otGetRespCmd(CLI_NETWORK_KEY, resp); + otStatus &= otGetRespCmd(CLI_NETWORK_CHANEL, resp); + otStatus &= otGetRespCmd("dataset commit active", resp); + otStatus &= otGetRespCmd("ifconfig up", resp); + otStatus &= otGetRespCmd("thread start", resp); + + if (!otStatus) { + Serial.println("\r\n\t===> Failed starting Thread Network!"); + return; + } + // wait for the node to enter in the router state + uint32_t timeout = millis() + 90000; // waits 90 seconds to + while (otGetDeviceRole() != OT_ROLE_CHILD && otGetDeviceRole() != OT_ROLE_ROUTER) { + Serial.print("."); + if (millis() > timeout) { + Serial.println("\r\n\t===> Timeout! Failed."); + otStatus = false; + break; + } + delay(500); + } + + if (otStatus) { + // print the PanID using 2 methods + + // CLI + if (otGetRespCmd("panid", resp)) { + Serial.printf("\r\nPanID[using CLI]: %s\r\n", resp); + } else { + Serial.printf("\r\nPanID[using CLI]: FAILED!\r\n"); + } + + // OpenThread API + Serial.printf("PanID[using OT API]: 0x%x\r\n", (uint16_t) otLinkGetPanId(esp_openthread_get_instance())); + } + Serial.println("\r\n"); +} + +void loop() { + if (otStatus) { + Serial.println("Thread NetworkInformation: "); + Serial.println("---------------------------"); + otPrintNetworkInformation(Serial); + Serial.println("---------------------------"); + } else { + Serial.println("Some OpenThread operation has failed..."); + } + delay(10000); +} From 00f0d0af8fc74713580e49b66eeb2bbee3c9429e Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 18:06:24 -0300 Subject: [PATCH 02/12] feat(openthread): create cj.json file Adds neessary CI file --- .../SimpleThreadNetwork/ExtendedRoterNode/cj.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json new file mode 100644 index 00000000000..10def841de0 --- /dev/null +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json @@ -0,0 +1,9 @@ +{ + "targets": { + "esp32": false, + "esp32c2": false, + "esp32c3": false, + "esp32s2": false, + "esp32s3": false + } + } From 417563843cf98cc3da82da6a22fbab9921f8b1e2 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 19:10:42 -0300 Subject: [PATCH 03/12] feat(openthread): improve the example Update ExtendedRoterNode.ino with more use of API --- .../ExtendedRoterNode/ExtendedRoterNode.ino | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino index 4caa4712213..e6f19c289a8 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino @@ -2,8 +2,8 @@ #include "OThreadCLI_Util.h" // Leader node shall use the same Network Key and channel -#define CLI_NETWORK_KEY "dataset networkkey 00112233445566778899aabbccddeeff" -#define CLI_NETWORK_CHANEL "dataset channel 24" +#define CLI_NETWORK_KEY "00112233445566778899aabbccddeeff" +#define CLI_NETWORK_CHANEL "24" bool otStatus = true; void setup() { @@ -12,14 +12,12 @@ void setup() { Serial.println("Setting up OpenThread Node as Router/Child"); Serial.println("Make sure the Leader Node is already running"); - // This sketch will use CLI responses, therefore, it shall always process each CLI return - char resp[256]; - otStatus &= otGetRespCmd("dataset clear", resp); - otStatus &= otGetRespCmd(CLI_NETWORK_KEY, resp); - otStatus &= otGetRespCmd(CLI_NETWORK_CHANEL, resp); - otStatus &= otGetRespCmd("dataset commit active", resp); - otStatus &= otGetRespCmd("ifconfig up", resp); - otStatus &= otGetRespCmd("thread start", resp); + otStatus &= otExecCommand("dataset", "clear"); + otStatus &= otExecCommand("dataset networkkey", CLI_NETWORK_KEY); + otStatus &= otExecCommand("dataset channel", CLI_NETWORK_CHANEL); + otStatus &= otExecCommand("dataset", "commit active"); + otStatus &= otExecCommand("ifconfig", "up"); + otStatus &= otExecCommand("thread", "start"); if (!otStatus) { Serial.println("\r\n\t===> Failed starting Thread Network!"); @@ -41,6 +39,7 @@ void setup() { // print the PanID using 2 methods // CLI + char resp[256]; if (otGetRespCmd("panid", resp)) { Serial.printf("\r\nPanID[using CLI]: %s\r\n", resp); } else { From 1b27f849f5d268d34a944efe67d6092b6f84e30a Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 20:20:46 -0300 Subject: [PATCH 04/12] feat(openthread): improve the example Adds OpenThread Native calls to the example --- .../RouterNode/RouterNode.ino | 70 ++++++++++++++++--- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino index 8b393893386..7b88a791c3f 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino @@ -1,14 +1,14 @@ /* - * OpenThread.begin(false) will not automatically start a node in a Thread Network - * A Router/Child node is the device that will join an existing Thread Network - * - * In order to allow this node to join the network, - * it shall use the same network master key as used by the Leader Node - * The network master key is a 16-byte key that is used to secure the network - * - * Using the same channel will make the process faster - * - */ + OpenThread.begin(false) will not automatically start a node in a Thread Network + A Router/Child node is the device that will join an existing Thread Network + + In order to allow this node to join the network, + it shall use the same network master key as used by the Leader Node + The network master key is a 16-byte key that is used to secure the network + + Using the same channel will make the process faster + +*/ #include "OThreadCLI.h" #include "OThreadCLI_Util.h" @@ -16,11 +16,15 @@ #define CLI_NETWORK_KEY "dataset networkkey 00112233445566778899aabbccddeeff" #define CLI_NETWORK_CHANEL "dataset channel 24" +otInstance *aInstance = NULL; + void setup() { Serial.begin(115200); OThreadCLI.begin(false); // No AutoStart - fresh start + Serial.println(); Serial.println("Setting up OpenThread Node as Router/Child"); Serial.println("Make sure the Leader Node is already running"); + aInstance = esp_openthread_get_instance(); OThreadCLI.println("dataset clear"); OThreadCLI.println(CLI_NETWORK_KEY); @@ -31,7 +35,53 @@ void setup() { } void loop() { + Serial.println("============================================="); Serial.print("Thread Node State: "); Serial.println(otGetStringDeviceRole()); + + // Native OpenThread API calls: + // wait until the node become Child or Router + if (otGetDeviceRole() == OT_ROLE_CHILD || otGetDeviceRole() == OT_ROLE_ROUTER) { + // Network Name + const char *networkName = otThreadGetNetworkName(aInstance); + Serial.printf("Network Name: %s\r\n", networkName); + // Channel + uint8_t channel = otLinkGetChannel(aInstance); + Serial.printf("Channel: %d\r\n", channel); + // PAN ID + uint16_t panId = otLinkGetPanId(aInstance); + Serial.printf("PanID: 0x%04x\r\n", panId); + // Extended PAN ID + const otExtendedPanId *extPanId = otThreadGetExtendedPanId(aInstance); + Serial.printf("Extended PAN ID: "); + for (int i = 0; i < OT_EXT_PAN_ID_SIZE; i++) { + Serial.printf("%02x", extPanId->m8[i]); + } + Serial.println(); + // Nettwork Key + otNetworkKey networkKey; + otThreadGetNetworkKey(aInstance, &networkKey); + Serial.printf("Network Key: "); + for (int i = 0; i < OT_NETWORK_KEY_SIZE; i++) { + Serial.printf("%02x", networkKey.m8[i]); + } + Serial.println(); + // IP Addresses + char buf[OT_IP6_ADDRESS_STRING_SIZE]; + const otNetifAddress *address = otIp6GetUnicastAddresses(aInstance); + while (address != NULL) { + otIp6AddressToString(&address->mAddress, buf, sizeof(buf)); + Serial.printf("IP Address: %s\r\n", buf); + address = address->mNext; + } + // Multicast IP Addresses + const otNetifMulticastAddress *mAddress = otIp6GetMulticastAddresses(aInstance); + while (mAddress != NULL) { + otIp6AddressToString(&mAddress->mAddress, buf, sizeof(buf)); + printf("Multicast IP Address: %s\n", buf); + mAddress = mAddress->mNext; + } + } + delay(5000); } From 0c49edde1b288506df0b90dd626510ef168bdcd1 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 20:27:45 -0300 Subject: [PATCH 05/12] feat(openthread): improve the example Update LeaderNode.ino example to add OpenThread Native calls. --- .../LeaderNode/LeaderNode.ino | 72 ++++++++++++++++--- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino index 6439c5ec4bd..de7d86fb3e1 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino @@ -1,15 +1,15 @@ /* - * OpenThread.begin(false) will not automatically start a node in a Thread Network - * A Leader node is the first device, that has a complete dataset, to start Thread - * A complete dataset is easily achieved by using the OpenThread CLI command "dataset init new" - * - * In order to allow other node to join the network, - * all of them shall use the same network master key - * The network master key is a 16-byte key that is used to secure the network - * - * Using the same channel will make the process faster - * - */ + OpenThread.begin(false) will not automatically start a node in a Thread Network + A Leader node is the first device, that has a complete dataset, to start Thread + A complete dataset is easily achieved by using the OpenThread CLI command "dataset init new" + + In order to allow other node to join the network, + all of them shall use the same network master key + The network master key is a 16-byte key that is used to secure the network + + Using the same channel will make the process faster + +*/ #include "OThreadCLI.h" #include "OThreadCLI_Util.h" @@ -17,10 +17,14 @@ #define CLI_NETWORK_KEY "dataset networkkey 00112233445566778899aabbccddeeff" #define CLI_NETWORK_CHANEL "dataset channel 24" +otInstance *aInstance = NULL; + void setup() { Serial.begin(115200); OThreadCLI.begin(false); // No AutoStart - fresh start + Serial.println(); Serial.println("Setting up OpenThread Node as Leader"); + aInstance = esp_openthread_get_instance(); OThreadCLI.println("dataset init new"); OThreadCLI.println(CLI_NETWORK_KEY); @@ -31,7 +35,53 @@ void setup() { } void loop() { + Serial.println("============================================="); Serial.print("Thread Node State: "); Serial.println(otGetStringDeviceRole()); + + // Native OpenThread API calls: + // wait until the node become Child or Router + if (otGetDeviceRole() == OT_ROLE_LEADER) { + // Network Name + const char *networkName = otThreadGetNetworkName(aInstance); + Serial.printf("Network Name: %s\r\n", networkName); + // Channel + uint8_t channel = otLinkGetChannel(aInstance); + Serial.printf("Channel: %d\r\n", channel); + // PAN ID + uint16_t panId = otLinkGetPanId(aInstance); + Serial.printf("PanID: 0x%04x\r\n", panId); + // Extended PAN ID + const otExtendedPanId *extPanId = otThreadGetExtendedPanId(aInstance); + Serial.printf("Extended PAN ID: "); + for (int i = 0; i < OT_EXT_PAN_ID_SIZE; i++) { + Serial.printf("%02x", extPanId->m8[i]); + } + Serial.println(); + // Nettwork Key + otNetworkKey networkKey; + otThreadGetNetworkKey(aInstance, &networkKey); + Serial.printf("Network Key: "); + for (int i = 0; i < OT_NETWORK_KEY_SIZE; i++) { + Serial.printf("%02x", networkKey.m8[i]); + } + Serial.println(); + // IP Addresses + char buf[OT_IP6_ADDRESS_STRING_SIZE]; + const otNetifAddress *address = otIp6GetUnicastAddresses(aInstance); + while (address != NULL) { + otIp6AddressToString(&address->mAddress, buf, sizeof(buf)); + Serial.printf("IP Address: %s\r\n", buf); + address = address->mNext; + } + // Multicast IP Addresses + const otNetifMulticastAddress *mAddress = otIp6GetMulticastAddresses(aInstance); + while (mAddress != NULL) { + otIp6AddressToString(&mAddress->mAddress, buf, sizeof(buf)); + printf("Multicast IP Address: %s\n", buf); + mAddress = mAddress->mNext; + } + } + delay(5000); } From 323d4a86ac65a5a828064ab03dd4bc111c86efbf Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 20:40:38 -0300 Subject: [PATCH 06/12] fix(openthread): bad formatting using space Update keywords.txt to use TAB instead of SPACE in order to recognize correctly the keywords. --- libraries/OpenThread/keywords.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/OpenThread/keywords.txt b/libraries/OpenThread/keywords.txt index b7135522d05..d7193de188d 100644 --- a/libraries/OpenThread/keywords.txt +++ b/libraries/OpenThread/keywords.txt @@ -31,10 +31,10 @@ peek KEYWORD2 flush KEYWORD2 otGetDeviceRole KEYWORD2 otGetStringDeviceRole KEYWORD2 -otGetRespCmd KEYWORD2 +otGetRespCmd KEYWORD2 otExecCommand KEYWORD2 -otPrintRespCLI KEYWORD2 -otPrintNetworkInformation KEYWORD2 +otPrintRespCLI KEYWORD2 +otPrintNetworkInformation KEYWORD2 ####################################### # Constants (LITERAL1) From d21d0bc39942474988e9c6fd35f3796c84f0676b Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 21:14:36 -0300 Subject: [PATCH 07/12] fix(openthread): bad example file name - typo Changed ExtendedRoterNode to ExtendedRouterNode - Typo error. --- .../ExtendedRouterNode/ExtendedRouterNode.ino | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino new file mode 100644 index 00000000000..e6f19c289a8 --- /dev/null +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino @@ -0,0 +1,65 @@ +#include "OThreadCLI.h" +#include "OThreadCLI_Util.h" + +// Leader node shall use the same Network Key and channel +#define CLI_NETWORK_KEY "00112233445566778899aabbccddeeff" +#define CLI_NETWORK_CHANEL "24" +bool otStatus = true; + +void setup() { + Serial.begin(115200); + OThreadCLI.begin(false); // No AutoStart - fresh start + Serial.println("Setting up OpenThread Node as Router/Child"); + Serial.println("Make sure the Leader Node is already running"); + + otStatus &= otExecCommand("dataset", "clear"); + otStatus &= otExecCommand("dataset networkkey", CLI_NETWORK_KEY); + otStatus &= otExecCommand("dataset channel", CLI_NETWORK_CHANEL); + otStatus &= otExecCommand("dataset", "commit active"); + otStatus &= otExecCommand("ifconfig", "up"); + otStatus &= otExecCommand("thread", "start"); + + if (!otStatus) { + Serial.println("\r\n\t===> Failed starting Thread Network!"); + return; + } + // wait for the node to enter in the router state + uint32_t timeout = millis() + 90000; // waits 90 seconds to + while (otGetDeviceRole() != OT_ROLE_CHILD && otGetDeviceRole() != OT_ROLE_ROUTER) { + Serial.print("."); + if (millis() > timeout) { + Serial.println("\r\n\t===> Timeout! Failed."); + otStatus = false; + break; + } + delay(500); + } + + if (otStatus) { + // print the PanID using 2 methods + + // CLI + char resp[256]; + if (otGetRespCmd("panid", resp)) { + Serial.printf("\r\nPanID[using CLI]: %s\r\n", resp); + } else { + Serial.printf("\r\nPanID[using CLI]: FAILED!\r\n"); + } + + // OpenThread API + Serial.printf("PanID[using OT API]: 0x%x\r\n", (uint16_t) otLinkGetPanId(esp_openthread_get_instance())); + } + Serial.println("\r\n"); +} + +void loop() { + if (otStatus) { + Serial.println("Thread NetworkInformation: "); + Serial.println("---------------------------"); + otPrintNetworkInformation(Serial); + Serial.println("---------------------------"); + } else { + Serial.println("Some OpenThread operation has failed..."); + } + delay(10000); +} From eb243f9f0dc6a9062ac837503bb5d1c540cc39e6 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 21:16:56 -0300 Subject: [PATCH 08/12] feat(openthread): add extended example ci.json file Added CI file to the example. --- .../SimpleThreadNetwork/ExtendedRouterNode/ci.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ci.json diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ci.json b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ci.json new file mode 100644 index 00000000000..10def841de0 --- /dev/null +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ci.json @@ -0,0 +1,9 @@ +{ + "targets": { + "esp32": false, + "esp32c2": false, + "esp32c3": false, + "esp32s2": false, + "esp32s3": false + } + } From 40ae94fb766e9261a937d3a80c801f24b08d6143 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 5 Sep 2024 21:18:10 -0300 Subject: [PATCH 09/12] fix(openthread): deleted bad file names in the example Delete libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode directory --- .../ExtendedRoterNode/ExtendedRoterNode.ino | 65 ------------------- .../ExtendedRoterNode/cj.json | 9 --- 2 files changed, 74 deletions(-) delete mode 100644 libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino delete mode 100644 libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino deleted file mode 100644 index e6f19c289a8..00000000000 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/ExtendedRoterNode.ino +++ /dev/null @@ -1,65 +0,0 @@ -#include "OThreadCLI.h" -#include "OThreadCLI_Util.h" - -// Leader node shall use the same Network Key and channel -#define CLI_NETWORK_KEY "00112233445566778899aabbccddeeff" -#define CLI_NETWORK_CHANEL "24" -bool otStatus = true; - -void setup() { - Serial.begin(115200); - OThreadCLI.begin(false); // No AutoStart - fresh start - Serial.println("Setting up OpenThread Node as Router/Child"); - Serial.println("Make sure the Leader Node is already running"); - - otStatus &= otExecCommand("dataset", "clear"); - otStatus &= otExecCommand("dataset networkkey", CLI_NETWORK_KEY); - otStatus &= otExecCommand("dataset channel", CLI_NETWORK_CHANEL); - otStatus &= otExecCommand("dataset", "commit active"); - otStatus &= otExecCommand("ifconfig", "up"); - otStatus &= otExecCommand("thread", "start"); - - if (!otStatus) { - Serial.println("\r\n\t===> Failed starting Thread Network!"); - return; - } - // wait for the node to enter in the router state - uint32_t timeout = millis() + 90000; // waits 90 seconds to - while (otGetDeviceRole() != OT_ROLE_CHILD && otGetDeviceRole() != OT_ROLE_ROUTER) { - Serial.print("."); - if (millis() > timeout) { - Serial.println("\r\n\t===> Timeout! Failed."); - otStatus = false; - break; - } - delay(500); - } - - if (otStatus) { - // print the PanID using 2 methods - - // CLI - char resp[256]; - if (otGetRespCmd("panid", resp)) { - Serial.printf("\r\nPanID[using CLI]: %s\r\n", resp); - } else { - Serial.printf("\r\nPanID[using CLI]: FAILED!\r\n"); - } - - // OpenThread API - Serial.printf("PanID[using OT API]: 0x%x\r\n", (uint16_t) otLinkGetPanId(esp_openthread_get_instance())); - } - Serial.println("\r\n"); -} - -void loop() { - if (otStatus) { - Serial.println("Thread NetworkInformation: "); - Serial.println("---------------------------"); - otPrintNetworkInformation(Serial); - Serial.println("---------------------------"); - } else { - Serial.println("Some OpenThread operation has failed..."); - } - delay(10000); -} diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json deleted file mode 100644 index 10def841de0..00000000000 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRoterNode/cj.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "targets": { - "esp32": false, - "esp32c2": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } - } From 20f7c4d68191da11b693eb954dfbe39c525aef2f Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Mon, 9 Sep 2024 08:04:54 -0300 Subject: [PATCH 10/12] fix(openthread): typo in commentaries --- .../examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino index de7d86fb3e1..2215a42a862 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino @@ -58,7 +58,7 @@ void loop() { Serial.printf("%02x", extPanId->m8[i]); } Serial.println(); - // Nettwork Key + // Network Key otNetworkKey networkKey; otThreadGetNetworkKey(aInstance, &networkKey); Serial.printf("Network Key: "); From 79827b767d67031f439f8a00b45f6a6136f0262e Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Mon, 9 Sep 2024 08:05:25 -0300 Subject: [PATCH 11/12] fix(openthread): typo in commentaries --- .../examples/SimpleThreadNetwork/RouterNode/RouterNode.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino index 7b88a791c3f..3a1c609408e 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino @@ -58,7 +58,7 @@ void loop() { Serial.printf("%02x", extPanId->m8[i]); } Serial.println(); - // Nettwork Key + // Network Key otNetworkKey networkKey; otThreadGetNetworkKey(aInstance, &networkKey); Serial.printf("Network Key: "); From 52b3cb7c53e1474b004547df1500908fd89fac46 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:55:55 +0000 Subject: [PATCH 12/12] ci(pre-commit): Apply automatic fixes --- .../ExtendedRouterNode/ExtendedRouterNode.ino | 4 ++-- .../examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino | 2 +- .../examples/SimpleThreadNetwork/RouterNode/RouterNode.ino | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino index e6f19c289a8..249ba2a3fe0 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.ino @@ -24,7 +24,7 @@ void setup() { return; } // wait for the node to enter in the router state - uint32_t timeout = millis() + 90000; // waits 90 seconds to + uint32_t timeout = millis() + 90000; // waits 90 seconds to while (otGetDeviceRole() != OT_ROLE_CHILD && otGetDeviceRole() != OT_ROLE_ROUTER) { Serial.print("."); if (millis() > timeout) { @@ -47,7 +47,7 @@ void setup() { } // OpenThread API - Serial.printf("PanID[using OT API]: 0x%x\r\n", (uint16_t) otLinkGetPanId(esp_openthread_get_instance())); + Serial.printf("PanID[using OT API]: 0x%x\r\n", (uint16_t)otLinkGetPanId(esp_openthread_get_instance())); } Serial.println("\r\n"); } diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino index 2215a42a862..e2342426a7a 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/LeaderNode/LeaderNode.ino @@ -40,7 +40,7 @@ void loop() { Serial.println(otGetStringDeviceRole()); // Native OpenThread API calls: - // wait until the node become Child or Router + // wait until the node become Child or Router if (otGetDeviceRole() == OT_ROLE_LEADER) { // Network Name const char *networkName = otThreadGetNetworkName(aInstance); diff --git a/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino b/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino index 3a1c609408e..8ec01344d7a 100644 --- a/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino +++ b/libraries/OpenThread/examples/SimpleThreadNetwork/RouterNode/RouterNode.ino @@ -40,7 +40,7 @@ void loop() { Serial.println(otGetStringDeviceRole()); // Native OpenThread API calls: - // wait until the node become Child or Router + // wait until the node become Child or Router if (otGetDeviceRole() == OT_ROLE_CHILD || otGetDeviceRole() == OT_ROLE_ROUTER) { // Network Name const char *networkName = otThreadGetNetworkName(aInstance);