mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[error] add 'ot::Error' and 'kError{Name}' for use by core modules (#6237)
This commit adds a new core header files `common/error.hpp` which
defines `ot::Error` (mirroring `otError`) and `kError{Name}` constants
(mirroring the public `OT_ERROR_{NAME}` definitions). The new (C++
style) definitions are used by core modules. This commit also moves
`otThreadErrorToString()` (from `logging.hpp` to `error.hpp`) and
renames it to `ErrorToString()` which is used as the internal (to
core) function to covert an `Error` to a string.
This commit is contained in:
committed by
GitHub
parent
e992b8461c
commit
7dca56e982
@@ -52,9 +52,9 @@ Notifier::Notifier(Instance &aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
otError Notifier::RegisterCallback(otStateChangedCallback aCallback, void *aContext)
|
||||
Error Notifier::RegisterCallback(otStateChangedCallback aCallback, void *aContext)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Error error = kErrorNone;
|
||||
ExternalCallback *unusedCallback = nullptr;
|
||||
|
||||
VerifyOrExit(aCallback != nullptr);
|
||||
@@ -71,10 +71,10 @@ otError Notifier::RegisterCallback(otStateChangedCallback aCallback, void *aCont
|
||||
continue;
|
||||
}
|
||||
|
||||
VerifyOrExit((callback.mHandler != aCallback) || (callback.mContext != aContext), error = OT_ERROR_ALREADY);
|
||||
VerifyOrExit((callback.mHandler != aCallback) || (callback.mContext != aContext), error = kErrorAlready);
|
||||
}
|
||||
|
||||
VerifyOrExit(unusedCallback != nullptr, error = OT_ERROR_NO_BUFS);
|
||||
VerifyOrExit(unusedCallback != nullptr, error = kErrorNoBufs);
|
||||
|
||||
unusedCallback->mHandler = aCallback;
|
||||
unusedCallback->mContext = aContext;
|
||||
|
||||
Reference in New Issue
Block a user