-
Notifications
You must be signed in to change notification settings - Fork 7.7k
feat(openthread): native API extension #11598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(openthread): native API extension #11598
Conversation
👋 Hello SuGlider, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 76 files 76 suites 13m 9s ⏱️ Results for commit 0ae4855. ♻️ This comment has been updated with latest results. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the native OpenThread API by exposing operational dataset and network parameters to Arduino applications, adds caching for unicast and multicast IPv6 addresses, and updates examples and keyword lists to demonstrate the new functionality.
- Added getters for network name, extended PAN ID, network key, channel, PAN ID, RLOCs, and the current dataset.
- Introduced mutable caching for unicast and multicast addresses, with populate/clear APIs.
- Updated Arduino keywords and example sketches (RouterNode and LeaderNode) to use and showcase the new methods.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
libraries/OpenThread/src/OThread.h | Declared new getters for network info and address-cache methods |
libraries/OpenThread/src/OThread.cpp | Implemented dataset setters with null checks, getters, caching |
libraries/OpenThread/keywords.txt | Added new API methods and OnReceiveCb_t to the keyword list |
libraries/OpenThread/examples/.../RouterNode.ino | Updated example to display active dataset details |
libraries/OpenThread/examples/.../LeaderNode.ino | Updated example to list unicast/multicast addresses and handle role changes |
Comments suppressed due to low confidence (5)
libraries/OpenThread/src/OThread.h:153
- [nitpick] The member name
mCurrentDataset
differs from the originalmCurrentDataSet
naming. Align with the existing convention (e.g.,mCurrentDataSet
) for consistency.
static DataSet mCurrentDataset; // Current dataset being used by the OpenThread instance.
libraries/OpenThread/src/OThread.cpp:621
- The new address-caching APIs (
getUnicastAddressCount
,getUnicastAddress
,getAllUnicastAddresses
and multicast equivalents) currently lack unit tests. Add tests to verify cache population, clearing, and out-of-range behavior.
size_t OpenThread::getUnicastAddressCount() const {
libraries/OpenThread/src/OThread.cpp:142
- Using OT_NETWORK_KEY_SIZE may not match the actual network name buffer length and doesn’t guarantee null-termination. Use sizeof(mDataset.mNetworkName.m8) (or the correct OT_NETWORK_NAME_SIZE) and explicitly set the final byte to '\0' to avoid overflow.
strncpy(mDataset.mNetworkName.m8, name, OT_NETWORK_KEY_SIZE);
libraries/OpenThread/examples/Native/SimpleThreadNetwork/RouterNode/RouterNode.ino:26
- The example calls
otGetDeviceRole()
, but this wrapper isn’t declared in the updatedOThread.h
. Either expose this method in the header or use the correct existing API name to avoid a compile error.
ot_device_role_t currentRole = threadChildNode.otGetDeviceRole();
libraries/OpenThread/keywords.txt:16
- [nitpick]
OnReceiveCb_t
was added to the keyword list but isn’t introduced in these changes. If it’s not used in any new API, consider removing it to keep the keyword file focused.
OnReceiveCb_t KEYWORD1
Description of Change
This pull request introduces enhancements to the OpenThread library, focusing on improved network information retrieval, including caching mechanisms for unicast and multicast list of addresses.
It also adds new methods for accessing and managing Thread network data directly from node operational dataset.
Arduino Keywords are updated to cover all changes.
Current Native API examples were updated to demonstrate the new API application.
Tests scenarios
Using ESP32-C6 and ESP32-H2 with the provided examples.
Related links
None.