mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 15:17:46 +00:00
[topology] adding Neighbor::StateToString() (#4440)
The `Neighbor::StateToString()` converts a given `Neighbor::State` to a human-readable string.
This commit is contained in:
committed by
Jonathan Hui
parent
d23f3581ea
commit
61e77bf6ed
@@ -197,6 +197,22 @@ void Neighbor::RemoveAllForwardTrackingSeriesInfo(void)
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_ENABLE
|
||||
|
||||
const char *Neighbor::StateToString(State aState)
|
||||
{
|
||||
static const char *kStateStrings[] = {
|
||||
"Invalid", // kStateInvalid
|
||||
"Restored", // kStateRestored
|
||||
"ParentReq", // kStateParentRequest
|
||||
"ParentRes", // kStateParentResponse
|
||||
"ChildIdReq", // kStateChildIdRequest
|
||||
"LinkReq", // kStateLinkRequest
|
||||
"ChildUpdateReq", // kStateChildUpdateRequest
|
||||
"Valid", // kStateValid
|
||||
};
|
||||
|
||||
return static_cast<uint8_t>(aState) < OT_ARRAY_LENGTH(kStateStrings) ? kStateStrings[aState] : "Unknown";
|
||||
}
|
||||
|
||||
void Child::Info::SetFrom(const Child &aChild)
|
||||
{
|
||||
Clear();
|
||||
|
||||
@@ -645,6 +645,17 @@ public:
|
||||
void RemoveAllForwardTrackingSeriesInfo(void);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This method converts a given `State` to a human-readable string.
|
||||
*
|
||||
* @param[in] aState A neighbor state.
|
||||
*
|
||||
* @returns A string representation of given state.
|
||||
*
|
||||
*/
|
||||
static const char *StateToString(State aState);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* This method initializes the `Neighbor` object.
|
||||
|
||||
Reference in New Issue
Block a user