nRF5 SDK for Thread v0.11.0
Typedefs | Functions
Instance

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

Typedefs

typedef void(OTCALLotStateChangedCallback )(uint32_t aFlags, void *aContext)
 

Functions

otInstanceotInstanceInit (void *aInstanceBuffer, size_t *aInstanceBufferSize)
 
otInstanceotInstanceInitSingle (void)
 
bool otInstanceIsInitialized (otInstance *aInstance)
 
void otInstanceFinalize (otInstance *aInstance)
 
OTAPI otError 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)
 
otError otInstanceErasePersistentInfo (otInstance *aInstance)
 
otLogLevel otGetDynamicLogLevel (otInstance *aInstance)
 
otError 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.
otError 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
OT_ERROR_NONEAll persistent info/state was erased successfully.
OT_ERROR_INVALID_STATEDevice 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 *  aInstanceBuffer,
size_t *  aInstanceBufferSize 
)

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.

This function is available and can only be used when support for multiple OpenThread instances is enabled.

Parameters
[in]aInstanceBufferThe buffer for OpenThread to use for allocating the otInstance structure.
[in,out]aInstanceBufferSizeOn input, the size of aInstanceBuffer. On output, if not enough space for otInstance, the number of bytes required for otInstance.
Returns
A pointer to the new OpenThread instance.
See Also
otInstanceFinalize
otInstance* otInstanceInitSingle ( void  )

This function initializes the static single 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.

This function is available and can only be used when support for multiple OpenThread instances is disabled.

Returns
A pointer to the single OpenThread instance.
bool otInstanceIsInitialized ( otInstance aInstance)

This function indicates whether or not the instance is valid/initialized.

The instance is considered valid if it is acquired and initialized using either otInstanceInitSingle() (in single instance case) or otInstanceInit() (in multi instance case). A subsequent call to otInstanceFinalize() causes the instance to be considered as uninitialized.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
TRUE if the given instance is valid/initialized, FALSE otherwise.
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]aCallbackContextA pointer to application-specific context.
otError 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
OT_ERROR_NONEThe log level was changed successfully.
OT_ERROR_DISABLED_FEATUREThe dynamic log level feature is disabled. (
See Also
OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL configuration option).
OTAPI otError 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
OT_ERROR_NONEAdded the callback to the list of callbacks.
OT_ERROR_NO_BUFSCould not add the callback due to resource constraints.

Documentation feedback | Developer Zone | Subscribe | Updated