nRF5 SDK for Thread v0.9.0
Typedefs | Functions
Instance

This module includes functions that control the OpenThread Instance. More...

Typedefs

typedef void(OTCALL * otStateChangedCallback )(uint32_t aFlags, void *aContext)
 

Functions

otInstance * otInstanceInit (void)
 
void otInstanceFinalize (otInstance *aInstance)
 
OTAPI ThreadError OTCALL otSetStateChangedCallback (otInstance *aInstance, otStateChangedCallback aCallback, void *aContext)
 
OTAPI void OTCALL otRemoveStateChangeCallback (otInstance *aInstance, otStateChangedCallback aCallback, void *aCallbackContext)
 
OTAPI void OTCALL otInstanceReset (otInstance *aInstance)
 
OTAPI void OTCALL otInstanceFactoryReset (otInstance *aInstance)
 
ThreadError otInstanceErasePersistentInfo (otInstance *aInstance)
 
otLogLevel otGetDynamicLogLevel (otInstance *aInstance)
 
ThreadError otSetDynamicLogLevel (otInstance *aInstance, otLogLevel aLogLevel)
 

Detailed Description

This module includes functions that control the OpenThread Instance.

Typedef Documentation

typedef void(OTCALL * otStateChangedCallback)(uint32_t aFlags, void *aContext)

This function pointer is called to notify certain configuration or state changes within OpenThread.

Parameters
[in]aFlagsA bit-field indicating specific state that has changed.
[in]aContextA pointer to application-specific context.

Function Documentation

otLogLevel otGetDynamicLogLevel ( otInstance *  aInstance)

This function returns the current dynamic log level.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
the currently set dynamic log level.
ThreadError otInstanceErasePersistentInfo ( otInstance *  aInstance)

This function erases all the OpenThread persistent info (network settings) stored on non-volatile memory. Erase is successful only if the device is in disabled state/role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
kThreadError_NoneAll persistent info/state was erased successfully.
kThreadError_InvalidStateDevice is not in disabled state/role.
OTAPI void OTCALL otInstanceFactoryReset ( otInstance *  aInstance)

This method deletes all the settings stored on non-volatile memory, and then triggers platform reset.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
void otInstanceFinalize ( otInstance *  aInstance)

This function disables the OpenThread library.

Call this function when OpenThread is no longer in use.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
otInstance* otInstanceInit ( void  )

This function initializes the static instance of 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. By default, OpenThread is initialized in the 'enabled' state.

Return values
otInstance*The new OpenThread instance structure.
OTAPI void OTCALL otInstanceReset ( otInstance *  aInstance)

This method triggers a platform reset.

The reset process ensures that all the OpenThread state/info (stored in volatile memory) is erased. Note that the otPlatformReset does not erase any persistent state/info saved in non-volatile memory.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
OTAPI void OTCALL otRemoveStateChangeCallback ( otInstance *  aInstance,
otStateChangedCallback  aCallback,
void *  aCallbackContext 
)

This function removes a callback to indicate when certain configuration or state changes within OpenThread.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aCallbackA pointer to a function that is called with certain configuration or state changes.
[in]aContextA pointer to application-specific context.
ThreadError otSetDynamicLogLevel ( otInstance *  aInstance,
otLogLevel  aLogLevel 
)

This function sets the dynamic log level.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aLogLevelThe dynamic log level.
Return values
kThreadError_NoneThe log level was changed successfully.
kThreadError_NotCapableThe dynamic log level is not supported.
OTAPI ThreadError OTCALL otSetStateChangedCallback ( otInstance *  aInstance,
otStateChangedCallback  aCallback,
void *  aContext 
)

This function registers a callback to indicate when certain configuration or state changes within OpenThread.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aCallbackA pointer to a function that is called with certain configuration or state changes.
[in]aContextA pointer to application-specific context.
Return values
kThreadError_NoneAdded the callback to the list of callbacks.
kThreadError_NoBufsCould not add the callback due to resource constraints.

Documentation feedback | Developer Zone | Subscribe | Updated