mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 11:17:46 +00:00
[thread-netif] change Up()/Down() to void (no return) (#3513)
This commit is contained in:
committed by
Jonathan Hui
parent
f13e35d5f7
commit
6d0bce85a0
@@ -183,15 +183,16 @@ typedef struct otMessageInfo
|
||||
} otMessageInfo;
|
||||
|
||||
/**
|
||||
* This function brings up the IPv6 interface.
|
||||
* This function brings up/down the IPv6 interface.
|
||||
*
|
||||
* Call this function to enable/disable IPv6 communication.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE to enable IPv6, FALSE otherwise.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully enabled the IPv6 interface,
|
||||
* or the interface was already enabled.
|
||||
* @retval OT_ERROR_NONE Successfully brought the IPv6 interface up/down.
|
||||
* @retval OT_ERROR_INVALID_STATE IPv6 interface is not available since device is operating in raw-link mode
|
||||
* (applicable only when `OPENTHREAD_ENABLE_RAW_LINK_API` feature is enabled).
|
||||
*
|
||||
*/
|
||||
OTAPI otError OTCALL otIp6SetEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
@@ -48,24 +48,22 @@ otError otIp6SetEnabled(otInstance *aInstance, bool aEnabled)
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
VerifyOrExit(!instance.GetLinkRaw().IsEnabled(), error = OT_ERROR_INVALID_STATE);
|
||||
#endif
|
||||
|
||||
if (aEnabled)
|
||||
{
|
||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
VerifyOrExit(!instance.GetLinkRaw().IsEnabled(), error = OT_ERROR_INVALID_STATE);
|
||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
error = instance.GetThreadNetif().Up();
|
||||
instance.GetThreadNetif().Up();
|
||||
}
|
||||
else
|
||||
{
|
||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
VerifyOrExit(!instance.GetLinkRaw().IsEnabled(), error = OT_ERROR_INVALID_STATE);
|
||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
error = instance.GetThreadNetif().Down();
|
||||
instance.GetThreadNetif().Down();
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
exit:
|
||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ ThreadNetif::ThreadNetif(Instance &aInstance)
|
||||
memset(mSlaacAddresses, 0, sizeof(mSlaacAddresses));
|
||||
}
|
||||
|
||||
otError ThreadNetif::Up(void)
|
||||
void ThreadNetif::Up(void)
|
||||
{
|
||||
VerifyOrExit(!mIsUp);
|
||||
|
||||
@@ -139,10 +139,10 @@ otError ThreadNetif::Up(void)
|
||||
GetNotifier().Signal(OT_CHANGED_THREAD_NETIF_STATE);
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
otError ThreadNetif::Down(void)
|
||||
void ThreadNetif::Down(void)
|
||||
{
|
||||
VerifyOrExit(mIsUp);
|
||||
|
||||
@@ -171,7 +171,7 @@ otError ThreadNetif::Down(void)
|
||||
GetNotifier().Signal(OT_CHANGED_THREAD_NETIF_STATE);
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
otError ThreadNetif::GetLinkAddress(Ip6::LinkAddress &address) const
|
||||
|
||||
@@ -109,13 +109,13 @@ public:
|
||||
* This method enables the Thread network interface.
|
||||
*
|
||||
*/
|
||||
otError Up(void);
|
||||
void Up(void);
|
||||
|
||||
/**
|
||||
* This method disables the Thread network interface.
|
||||
*
|
||||
*/
|
||||
otError Down(void);
|
||||
void Down(void);
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the Thread network interface is enabled.
|
||||
|
||||
Reference in New Issue
Block a user