Separate out interface up/down from Thread start/stop. (#278)

* Redefine otEnable/otDisable to just initialize/uninitialize the OpenThread stack.
* Remove otInit API since it is replaced by otEnable.
* Add otInterfaceUp/otInterfaceDown APIs to bring up/down IPv6 interface.
* Add otThreadStart/otThreadStop APIs to start/stop Thread protocol operation.
* Updated NCP implementation to utilize new APIs.
This commit is contained in:
Jonathan Hui
2016-07-25 17:52:47 -07:00
committed by GitHub
parent c595b240fb
commit 8c39011d9c
12 changed files with 271 additions and 91 deletions
+63 -9
View File
@@ -111,11 +111,6 @@ extern "C" {
*
*/
/**
* Initialize the OpenThread library.
*/
void otInit(void);
/**
* Run the next queued tasklet in OpenThread.
*/
@@ -151,19 +146,78 @@ extern void otSignalTaskletPending(void);
*/
/**
* Enable the Thread interface.
* This function initializes the OpenThread library.
*
* This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be
* called before any other calls to OpenThread.
*
* @retval kThreadError_None Successfully enabled the Thread interface.
*
* @retval kThreadErrorNone Successfully enabled the Thread interface.
*/
ThreadError otEnable(void);
/**
* Disable the Thread interface.
* This function disables the OpenThread library.
*
* Call this function when OpenThread is no longer in use. The client must call otEnable() to use OpenThread
* again.
*
* @retval kThreadError_None Successfully disabled the Thread interface.
*
* @retval kThreadErrorNone Successfully disabled the Thread interface.
*/
ThreadError otDisable(void);
/**
* This function brings up the IPv6 interface.
*
* Call this function to bring up the IPv6 interface and enables IPv6 communication.
*
* @retval kThreadError_None Successfully enabled the IPv6 interface.
* @retval kThreadError_InvalidState OpenThread is not enabled or the IPv6 interface is already up.
*
*/
ThreadError otInterfaceUp(void);
/**
* This function brings down the IPv6 interface.
*
* Call this function to bring down the IPv6 interface and disable all IPv6 communication.
*
* @retval kThreadError_None Successfully brought the interface down.
* @retval kThreadError_InvalidState The interface was not up.
*
*/
ThreadError otInterfaceDown(void);
/**
* This function indicates whether or not the IPv6 interface is up.
*
* @retval TRUE The IPv6 interface is up.
* @retval FALSE The IPv6 interface is down.
*
*/
bool otIsInterfaceUp(void);
/**
* This function starts Thread protocol operation.
*
* The interface must be up when calling this function.
*
* @retval kThreadError_None Successfully started Thread protocol operation.
* @retval kThreadError_InvalidState Thread protocol operation is already started or the interface is not up.
*
*/
ThreadError otThreadStart(void);
/**
* This function stops Thread protocol operation.
*
* @retval kThreadError_None Successfully stopped Thread protocol operation.
* @retval kThreadError_InvalidState The Thread protocol operation was not started.
*
*/
ThreadError otThreadStop(void);
/**
* This function pointer is called during an IEEE 802.15.4 Active Scan when an IEEE 802.15.4 Beacon is received or
* the scan completes.