0.01.00
Instance

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

Typedefs

typedef void(OTCALLotStateChangedCallback) (uint32_t aFlags, void *aContext)
 This function pointer is called to notify certain configuration or state changes within OpenThread. More...
 

Functions

otInstanceotInstanceInit (void *aInstanceBuffer, size_t *aInstanceBufferSize)
 This function initializes the OpenThread library. More...
 
otInstanceotInstanceInitSingle (void)
 This function initializes the static single instance of the OpenThread library. More...
 
bool otInstanceIsInitialized (otInstance *aInstance)
 This function indicates whether or not the instance is valid/initialized. More...
 
void otInstanceFinalize (otInstance *aInstance)
 This function disables the OpenThread library. More...
 
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. More...
 
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. More...
 
OTAPI void OTCALL otInstanceReset (otInstance *aInstance)
 This method triggers a platform reset. More...
 
OTAPI void OTCALL otInstanceFactoryReset (otInstance *aInstance)
 This method deletes all the settings stored on non-volatile memory, and then triggers platform reset. More...
 
otError otInstanceErasePersistentInfo (otInstance *aInstance)
 This function erases all the OpenThread persistent info (network settings) stored on non-volatile memory. More...
 
otLogLevel otGetDynamicLogLevel (otInstance *aInstance)
 This function returns the current dynamic log level. More...
 
otError otSetDynamicLogLevel (otInstance *aInstance, otLogLevel aLogLevel)
 This function sets the dynamic log level. More...
 

Detailed Description

This module includes functions that control the OpenThread Instance.

Typedef Documentation

§ otStateChangedCallback

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

§ otGetDynamicLogLevel()

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.

§ otInstanceErasePersistentInfo()

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.

§ otInstanceFactoryReset()

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.

§ otInstanceFinalize()

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.

§ otInstanceInit()

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. By default, OpenThread is initialized in the 'enabled' state.

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.
Return values
otInstance*The new OpenThread instance structure.
See also
otContextFinalize

§ otInstanceInitSingle()

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. By default, OpenThread is initialized in the 'enabled' state.

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

Return values
Apointer to the single OpenThread instance structure.

§ otInstanceIsInitialized()

bool otInstanceIsInitialized ( otInstance aInstance)

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

For single-instance case, the instance is considered valid if it is acquired and initialized using otInstanceInitSingle(). A subsequent call to otInstanceFinalize() causes the instance to be considered as invalid (not initialized).

For multi-instance case, any non-NULL instance pointer is considered as valid/initialized.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
TRUE if the given instance is valid/initialized, FALSE otherwise.

§ otInstanceReset()

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.

§ otRemoveStateChangeCallback()

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.

§ otSetDynamicLogLevel()

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).

§ otSetStateChangedCallback()

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.