mirror of
https://github.com/espressif/openthread.git
synced 2026-08-09 20:27:47 +00:00
[nexus] introduce simulation observer interface and hooks (#12894)
This commit introduces the `SimulationObserver` interface and integrates it into the Nexus core simulation logic. This allows external systems to observe node state changes, link updates, and packet events in real-time. Key changes: - Defined `SimulationObserver` interface to handle node state changes, link updates, packet events, and event clearing. - Added `SetObserver` and `GetObserver` methods to the `Core` class. - Implemented `Core::HandleNeighborTableChanged` to notify the observer of neighbor additions and removals. - Implemented `Core::HandleStateChanged` to track node role transitions and parent changes, updating links accordingly. - Integrated packet event notification in `Core::ProcessRadio`, including basic destination node ID resolution for unicast frames. - Added `Core::SetNodeEnabled` to allow enabling or disabling Thread and MLE on specific nodes at runtime. - Updated `Core::Reset` to clear events via the observer. - Increased `OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS` to accommodate the new nexus state change handler. - Added `mLastParentId` to `Node` class to correctly manage link updates during parent switches or detachment.
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
|
||||
#include "nexus_node.hpp"
|
||||
|
||||
#include "nexus_utils.hpp"
|
||||
|
||||
namespace ot {
|
||||
namespace Nexus {
|
||||
|
||||
@@ -133,9 +135,6 @@ void Node::SendEchoRequest(const Ip6::Address &aDestination,
|
||||
messageInfo.SetSockAddr(*aSrcAddress);
|
||||
}
|
||||
|
||||
Log("Sending Echo Request from Node %lu (%s) to %s (payload-size:%u)", ToUlong(GetId()), GetName(),
|
||||
aDestination.ToString().AsCString(), aPayloadSize);
|
||||
|
||||
SuccessOrQuit(Get<Ip6::Icmp>().SendEchoRequest(*message, messageInfo, aIdentifier));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user