mirror of
https://github.com/espressif/openthread.git
synced 2026-09-21 00:17:37 +00:00
[mle] add config and test for discovery request callback (#12284)
Introduces `OPENTHREAD_CONFIG_MLE_DISCOVERY_SCAN_REQUEST_CALLBACK_ENABLE` to conditionally compile the MLE Discovery Request callback feature. Disabling this feature allows for code size reduction on builds where it is not needed. A new Nexus test (`test_discover_scan.cpp`) is added to directly validate the `otThreadSetDiscoveryRequestCallback()` API behavior. This new test replaces a now-removed CLI-based test which used (`discover reqcallback`). This CLI command was originally added for testing purposes. The CLI command is not helpful as an async event would produce unsolicited output in the CLI. The new direct C++ test is a cleaner approach.
This commit is contained in:
@@ -2749,9 +2749,10 @@ void Mle::HandleDiscoveryRequest(RxInfo &aRxInfo)
|
||||
|
||||
if (parsedDiscoveryRequestTlv)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_MLE_DISCOVERY_SCAN_REQUEST_CALLBACK_ENABLE
|
||||
if (mDiscoveryRequestCallback.IsSet())
|
||||
{
|
||||
otThreadDiscoveryRequestInfo info;
|
||||
DiscoveryRequestInfo info;
|
||||
|
||||
AsCoreType(&info.mExtAddress).SetFromIid(aRxInfo.mMessageInfo.GetPeerAddr().GetIid());
|
||||
info.mVersion = discoveryRequestTlvValue.GetVersion();
|
||||
@@ -2759,6 +2760,7 @@ void Mle::HandleDiscoveryRequest(RxInfo &aRxInfo)
|
||||
|
||||
mDiscoveryRequestCallback.Invoke(&info);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (discoveryRequestTlvValue.GetJoinerFlag())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user