mirror of
https://github.com/espressif/openthread.git
synced 2026-09-02 15:20:07 +00:00
[commissioner] log commissioner state changes (#4207)
This commit is contained in:
committed by
Jonathan Hui
parent
900764d2ee
commit
51217542ba
@@ -89,6 +89,8 @@ void Commissioner::SetState(otCommissionerState aState)
|
||||
{
|
||||
VerifyOrExit(mState != aState);
|
||||
|
||||
otLogInfoMeshCoP("Commissioner State: %s -> %s", StateToString(mState), StateToString(aState));
|
||||
|
||||
mState = aState;
|
||||
|
||||
if (mStateCallback)
|
||||
@@ -1125,6 +1127,36 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
|
||||
#if (OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO) && (OPENTHREAD_CONFIG_LOG_MLE == 1)
|
||||
|
||||
const char *Commissioner::StateToString(otCommissionerState aState)
|
||||
{
|
||||
const char *str = "Unknown";
|
||||
|
||||
switch (aState)
|
||||
{
|
||||
case OT_COMMISSIONER_STATE_DISABLED:
|
||||
str = "disabled";
|
||||
break;
|
||||
case OT_COMMISSIONER_STATE_PETITION:
|
||||
str = "petition";
|
||||
break;
|
||||
case OT_COMMISSIONER_STATE_ACTIVE:
|
||||
str = "active";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
#endif // (OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO) && (OPENTHREAD_CONFIG_LOG_MLE == 1)
|
||||
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
} // namespace MeshCoP
|
||||
} // namespace ot
|
||||
|
||||
|
||||
@@ -323,6 +323,8 @@ private:
|
||||
void SetState(otCommissionerState aState);
|
||||
void SignalJoinerEvent(otCommissionerJoinerEvent aEvent, const Mac::ExtAddress &aJoinerId);
|
||||
|
||||
static const char *StateToString(otCommissionerState aState);
|
||||
|
||||
struct Joiner
|
||||
{
|
||||
Mac::ExtAddress mEui64;
|
||||
|
||||
Reference in New Issue
Block a user