Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ci(pre-commit): Apply automatic fixes
  • Loading branch information
pre-commit-ci-lite[bot] authored Jun 16, 2025
commit a0e01f46b33c2a3b243a772d5639627ef7ca2bea
4 changes: 2 additions & 2 deletions libraries/OpenThread/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class OpenThread {

OpenThread();
~OpenThread();

// Returns true if the OpenThread stack is running.
operator bool() const;

Expand Down Expand Up @@ -258,4 +258,4 @@ extern OpenThreadCLI OThreadCLI;
- It works seamlessly with the `OThread` and `DataSet` classes for managing Thread networks.
- Ensure that the OpenThread stack is initialized (`OThreadCLI.begin()`) before starting the CLI console.

This documentation provides a comprehensive overview of the `OThreadCLI` class, its methods, and example usage. It is designed to help developers easily integrate OpenThread CLI functionality into their Arduino projects.
This documentation provides a comprehensive overview of the `OThreadCLI` class, its methods, and example usage. It is designed to help developers easily integrate OpenThread CLI functionality into their Arduino projects.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void setup() {
Serial.begin(115200);
// LED starts RED, indicating not connected to Thread network.
rgbLedWrite(RGB_BUILTIN, 64, 0, 0);
OThread.begin(false); // No AutoStart is necessary
OThread.begin(false); // No AutoStart is necessary
OThreadCLI.begin();
OThreadCLI.setTimeout(250); // waits 250ms for the OpenThread CLI response
setupNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void setup() {
Serial.begin(115200);
// LED starts RED, indicating not connected to Thread network.
rgbLedWrite(RGB_BUILTIN, 64, 0, 0);
OThread.begin(false); // No AutoStart is necessary
OThread.begin(false); // No AutoStart is necessary
OThreadCLI.begin();
OThreadCLI.setTimeout(250); // waits 250ms for the OpenThread CLI response
setupNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

void setup() {
Serial.begin(115200);
OThread.begin(); // AutoStart using Thread default settings
OThread.begin(); // AutoStart using Thread default settings
OThreadCLI.begin();
OThread.otPrintNetworkInformation(Serial); // Print Current Thread Network Information
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ void loop() {
}

delay(5000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

void setup() {
Serial.begin(115200);
OThread.begin(true); // For scanning, AutoStart must be active, any setup
OThread.begin(true); // For scanning, AutoStart must be active, any setup
OThreadCLI.begin();
OThreadCLI.setTimeout(100); // Set a timeout for the CLI response
Serial.println();
Expand Down
2 changes: 1 addition & 1 deletion libraries/OpenThread/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ OT_ROLE_CHILD LITERAL1
OT_ROLE_ROUTER LITERAL1
OT_ROLE_LEADER LITERAL1
OT_EXT_PAN_ID_SIZE LITERAL1
OT_NETWORK_KEY_SIZE LITERAL1
OT_NETWORK_KEY_SIZE LITERAL1
1 change: 0 additions & 1 deletion libraries/OpenThread/src/OThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp) {
}
#endif


static void ot_task_worker(void *aContext) {
esp_vfs_eventfd_config_t eventfd_config = {
.max_fds = 3,
Expand Down
102 changes: 51 additions & 51 deletions libraries/OpenThread/src/OThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,69 +36,69 @@ typedef enum {
extern const char *otRoleString[];

class DataSet {
public:
DataSet();
void clear();
void initNew();
const otOperationalDataset &getDataset() const;

// Setters
void setNetworkName(const char *name);
void setExtendedPanId(const uint8_t *extPanId);
void setNetworkKey(const uint8_t *key);
void setChannel(uint8_t channel);
void setPanId(uint16_t panId);

// Getters
const char *getNetworkName() const;
const uint8_t *getExtendedPanId() const;
const uint8_t *getNetworkKey() const;
uint8_t getChannel() const;
uint16_t getPanId() const;

// Apply the dataset to the OpenThread instance
void apply(otInstance *instance);

private:
otOperationalDataset mDataset;
public:
DataSet();
void clear();
void initNew();
const otOperationalDataset &getDataset() const;

// Setters
void setNetworkName(const char *name);
void setExtendedPanId(const uint8_t *extPanId);
void setNetworkKey(const uint8_t *key);
void setChannel(uint8_t channel);
void setPanId(uint16_t panId);

// Getters
const char *getNetworkName() const;
const uint8_t *getExtendedPanId() const;
const uint8_t *getNetworkKey() const;
uint8_t getChannel() const;
uint16_t getPanId() const;

// Apply the dataset to the OpenThread instance
void apply(otInstance *instance);

private:
otOperationalDataset mDataset;
};

class OpenThread {
public:
static bool otStarted;
static ot_device_role_t otGetDeviceRole();
static const char *otGetStringDeviceRole();
static void otPrintNetworkInformation(Stream &output);
public:
static bool otStarted;
static ot_device_role_t otGetDeviceRole();
static const char *otGetStringDeviceRole();
static void otPrintNetworkInformation(Stream &output);

OpenThread();
~OpenThread();
// returns true if OpenThread Stack is running
operator bool() const;
OpenThread();
~OpenThread();
// returns true if OpenThread Stack is running
operator bool() const;

// Initialize OpenThread
static void begin(bool OThreadAutoStart = true);
// Initialize OpenThread
static void begin(bool OThreadAutoStart = true);

// Initialize OpenThread
static void end();
// Initialize OpenThread
static void end();

// Start the Thread network
void start();
// Start the Thread network
void start();

// Stop the Thread network
void stop();
// Stop the Thread network
void stop();

// Start Thread Network Interface
void networkInterfaceUp();
// Start Thread Network Interface
void networkInterfaceUp();

// Stop Thread Network Interface
void networkInterfaceDown();
// Stop Thread Network Interface
void networkInterfaceDown();

// Set the dataset
void commitDataSet(const DataSet &dataset);
// Set the dataset
void commitDataSet(const DataSet &dataset);

private:
static otInstance *mInstance;
DataSet mCurrentDataSet;
private:
static otInstance *mInstance;
DataSet mCurrentDataSet;
};

extern OpenThread OThread;
Expand Down
Loading