Clean up error names. (#1764)

This commit is contained in:
Jonathan Hui
2017-05-23 09:34:35 -07:00
committed by GitHub
parent b3530deb76
commit 48b9299544
262 changed files with 6230 additions and 6204 deletions
+48 -48
View File
@@ -57,13 +57,13 @@ const uint8_t *otThreadGetExtendedPanId(otInstance *aInstance)
return aInstance->mThreadNetif.GetMac().GetExtendedPanId();
}
ThreadError otThreadSetExtendedPanId(otInstance *aInstance, const uint8_t *aExtendedPanId)
otError otThreadSetExtendedPanId(otInstance *aInstance, const uint8_t *aExtendedPanId)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
uint8_t mlPrefix[8];
VerifyOrExit(aInstance->mThreadNetif.GetMle().GetDeviceState() == Mle::kDeviceStateDisabled,
error = kThreadError_InvalidState);
error = OT_ERROR_INVALID_STATE);
aInstance->mThreadNetif.GetMac().SetExtendedPanId(aExtendedPanId);
@@ -80,11 +80,11 @@ exit:
return error;
}
ThreadError otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aAddress)
otError otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aAddress)
{
ThreadError error;
otError error;
VerifyOrExit(aAddress != NULL, error = kThreadError_InvalidArgs);
VerifyOrExit(aAddress != NULL, error = OT_ERROR_INVALID_ARGS);
error = aInstance->mThreadNetif.GetMle().GetLeaderAddress(*static_cast<Ip6::Address *>(aAddress));
@@ -122,7 +122,7 @@ otLinkModeConfig otThreadGetLinkMode(otInstance *aInstance)
return config;
}
ThreadError otThreadSetLinkMode(otInstance *aInstance, otLinkModeConfig aConfig)
otError otThreadSetLinkMode(otInstance *aInstance, otLinkModeConfig aConfig)
{
uint8_t mode = 0;
@@ -154,13 +154,13 @@ const otMasterKey *otThreadGetMasterKey(otInstance *aInstance)
return &aInstance->mThreadNetif.GetKeyManager().GetMasterKey();
}
ThreadError otThreadSetMasterKey(otInstance *aInstance, const otMasterKey *aKey)
otError otThreadSetMasterKey(otInstance *aInstance, const otMasterKey *aKey)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
VerifyOrExit(aKey != NULL, error = kThreadError_InvalidArgs);
VerifyOrExit(aKey != NULL, error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(aInstance->mThreadNetif.GetMle().GetDeviceState() == Mle::kDeviceStateDisabled,
error = kThreadError_InvalidState);
error = OT_ERROR_INVALID_STATE);
error = aInstance->mThreadNetif.GetKeyManager().SetMasterKey(*aKey);
aInstance->mThreadNetif.GetActiveDataset().Clear(false);
@@ -180,12 +180,12 @@ const uint8_t *otThreadGetMeshLocalPrefix(otInstance *aInstance)
return aInstance->mThreadNetif.GetMle().GetMeshLocalPrefix();
}
ThreadError otThreadSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLocalPrefix)
otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLocalPrefix)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
VerifyOrExit(aInstance->mThreadNetif.GetMle().GetDeviceState() == Mle::kDeviceStateDisabled,
error = kThreadError_InvalidState);
error = OT_ERROR_INVALID_STATE);
error = aInstance->mThreadNetif.GetMle().SetMeshLocalPrefix(aMeshLocalPrefix);
aInstance->mThreadNetif.GetActiveDataset().Clear(false);
@@ -200,12 +200,12 @@ const char *otThreadGetNetworkName(otInstance *aInstance)
return aInstance->mThreadNetif.GetMac().GetNetworkName();
}
ThreadError otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName)
otError otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
VerifyOrExit(aInstance->mThreadNetif.GetMle().GetDeviceState() == Mle::kDeviceStateDisabled,
error = kThreadError_InvalidState);
error = OT_ERROR_INVALID_STATE);
error = aInstance->mThreadNetif.GetMac().SetNetworkName(aNetworkName);
aInstance->mThreadNetif.GetActiveDataset().Clear(false);
@@ -235,21 +235,21 @@ void otThreadSetKeySwitchGuardTime(otInstance *aInstance, uint32_t aKeySwitchGua
aInstance->mThreadNetif.GetKeyManager().SetKeySwitchGuardTime(aKeySwitchGuardTime);
}
ThreadError otThreadBecomeDetached(otInstance *aInstance)
otError otThreadBecomeDetached(otInstance *aInstance)
{
return aInstance->mThreadNetif.GetMle().BecomeDetached();
}
ThreadError otThreadBecomeChild(otInstance *aInstance, otMleAttachFilter aFilter)
otError otThreadBecomeChild(otInstance *aInstance, otMleAttachFilter aFilter)
{
return aInstance->mThreadNetif.GetMle().BecomeChild(aFilter);
}
ThreadError otThreadGetNextNeighborInfo(otInstance *aInstance, otNeighborInfoIterator *aIterator, otNeighborInfo *aInfo)
otError otThreadGetNextNeighborInfo(otInstance *aInstance, otNeighborInfoIterator *aIterator, otNeighborInfo *aInfo)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
VerifyOrExit((aInfo != NULL) && (aIterator != NULL), error = kThreadError_InvalidArgs);
VerifyOrExit((aInfo != NULL) && (aIterator != NULL), error = OT_ERROR_INVALID_ARGS);
error = aInstance->mThreadNetif.GetMle().GetNextNeighborInfo(*aIterator, *aInfo);
@@ -287,11 +287,11 @@ otDeviceRole otThreadGetDeviceRole(otInstance *aInstance)
return rval;
}
ThreadError otThreadGetLeaderData(otInstance *aInstance, otLeaderData *aLeaderData)
otError otThreadGetLeaderData(otInstance *aInstance, otLeaderData *aLeaderData)
{
ThreadError error;
otError error;
VerifyOrExit(aLeaderData != NULL, error = kThreadError_InvalidArgs);
VerifyOrExit(aLeaderData != NULL, error = OT_ERROR_INVALID_ARGS);
error = aInstance->mThreadNetif.GetMle().GetLeaderData(*aLeaderData);
@@ -319,12 +319,12 @@ uint16_t otThreadGetRloc16(otInstance *aInstance)
return aInstance->mThreadNetif.GetMle().GetRloc16();
}
ThreadError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
otError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
Router *parent;
VerifyOrExit(aParentInfo != NULL, error = kThreadError_InvalidArgs);
VerifyOrExit(aParentInfo != NULL, error = OT_ERROR_INVALID_ARGS);
parent = aInstance->mThreadNetif.GetMle().GetParent();
memcpy(aParentInfo->mExtAddress.m8, &parent->GetExtAddress(), sizeof(aParentInfo->mExtAddress));
@@ -343,33 +343,33 @@ exit:
return error;
}
ThreadError otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi)
otError otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
Router *parent;
VerifyOrExit(aParentRssi != NULL, error = kThreadError_InvalidArgs);
VerifyOrExit(aParentRssi != NULL, error = OT_ERROR_INVALID_ARGS);
parent = aInstance->mThreadNetif.GetMle().GetParent();
*aParentRssi = parent->GetLinkInfo().GetAverageRss();
VerifyOrExit(*aParentRssi != LinkQualityInfo::kUnknownRss, error = kThreadError_Failed);
VerifyOrExit(*aParentRssi != LinkQualityInfo::kUnknownRss, error = OT_ERROR_FAILED);
exit:
return error;
}
ThreadError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi)
otError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
Router *parent;
VerifyOrExit(aLastRssi != NULL, error = kThreadError_InvalidArgs);
VerifyOrExit(aLastRssi != NULL, error = OT_ERROR_INVALID_ARGS);
parent = aInstance->mThreadNetif.GetMle().GetParent();
*aLastRssi = parent->GetLinkInfo().GetLastRss();
VerifyOrExit(*aLastRssi != LinkQualityInfo::kUnknownRss, error = kThreadError_Failed);
VerifyOrExit(*aLastRssi != LinkQualityInfo::kUnknownRss, error = OT_ERROR_FAILED);
exit:
return error;
@@ -421,8 +421,8 @@ void otThreadSetReceiveDiagnosticGetCallback(otInstance *aInstance, otReceiveDia
aInstance->mThreadNetif.GetNetworkDiagnostic().SetReceiveDiagnosticGetCallback(aCallback, aCallbackContext);
}
ThreadError otThreadSendDiagnosticGet(otInstance *aInstance, const otIp6Address *aDestination,
const uint8_t aTlvTypes[], uint8_t aCount)
otError otThreadSendDiagnosticGet(otInstance *aInstance, const otIp6Address *aDestination,
const uint8_t aTlvTypes[], uint8_t aCount)
{
return aInstance->mThreadNetif.GetNetworkDiagnostic().SendDiagnosticGet(*static_cast<const Ip6::Address *>
(aDestination),
@@ -430,8 +430,8 @@ ThreadError otThreadSendDiagnosticGet(otInstance *aInstance, const otIp6Address
aCount);
}
ThreadError otThreadSendDiagnosticReset(otInstance *aInstance, const otIp6Address *aDestination,
const uint8_t aTlvTypes[], uint8_t aCount)
otError otThreadSendDiagnosticReset(otInstance *aInstance, const otIp6Address *aDestination,
const uint8_t aTlvTypes[], uint8_t aCount)
{
return aInstance->mThreadNetif.GetNetworkDiagnostic().SendDiagnosticReset(*static_cast<const Ip6::Address *>
(aDestination),
@@ -440,16 +440,16 @@ ThreadError otThreadSendDiagnosticReset(otInstance *aInstance, const otIp6Addres
}
#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC
ThreadError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
{
ThreadError error = kThreadError_None;
otError error = OT_ERROR_NONE;
otLogFuncEntry();
if (aEnabled)
{
VerifyOrExit(aInstance->mThreadNetif.GetMac().GetPanId() != Mac::kPanIdBroadcast,
error = kThreadError_InvalidState);
error = OT_ERROR_INVALID_STATE);
error = aInstance->mThreadNetif.GetMle().Start(true, false);
}
else
@@ -469,7 +469,7 @@ bool otThreadGetAutoStart(otInstance *aInstance)
uint16_t autoStartLength = sizeof(autoStart);
if (otPlatSettingsGet(aInstance, Settings::kKeyThreadAutoStart, 0, &autoStart, &autoStartLength) !=
kThreadError_None)
OT_ERROR_NONE)
{
autoStart = 0;
}
@@ -481,7 +481,7 @@ bool otThreadGetAutoStart(otInstance *aInstance)
#endif
}
ThreadError otThreadSetAutoStart(otInstance *aInstance, bool aStartAutomatically)
otError otThreadSetAutoStart(otInstance *aInstance, bool aStartAutomatically)
{
#if OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT
uint8_t autoStart = aStartAutomatically ? 1 : 0;
@@ -489,7 +489,7 @@ ThreadError otThreadSetAutoStart(otInstance *aInstance, bool aStartAutomatically
#else
(void)aInstance;
(void)aStartAutomatically;
return kThreadError_NotImplemented;
return OT_ERROR_NOT_IMPLEMENTED;
#endif
}
@@ -498,8 +498,8 @@ bool otThreadIsSingleton(otInstance *aInstance)
return aInstance->mThreadNetif.GetMle().IsSingleton();
}
ThreadError otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanId, bool aJoiner,
bool aEnableEui64Filtering, otHandleActiveScanResult aCallback, void *aCallbackContext)
otError otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanId, bool aJoiner,
bool aEnableEui64Filtering, otHandleActiveScanResult aCallback, void *aCallbackContext)
{
return aInstance->mThreadNetif.GetMle().Discover(aScanChannels, aPanId, aJoiner, aEnableEui64Filtering, aCallback,
aCallbackContext);