This module includes functions that control the OpenThread Instance.
More...
This module includes functions that control the OpenThread Instance.
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] | aFlags | A bit-field indicating specific state that has changed. |
[in] | aContext | A pointer to application-specific context. |
This function returns the current dynamic log level.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
- Returns
- the currently set dynamic log level.
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] | aInstance | A pointer to an OpenThread instance. |
- Return values
-
OT_ERROR_NONE | All persistent info/state was erased successfully. |
OT_ERROR_INVALID_STATE | Device is not in disabled state/role. |
This method deletes all the settings stored on non-volatile memory, and then triggers platform reset.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
This function disables the OpenThread library.
Call this function when OpenThread is no longer in use.
- Parameters
-
[in] | aInstance | A 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] | aInstanceBuffer | The buffer for OpenThread to use for allocating the otInstance structure. |
[in,out] | aInstanceBufferSize | On 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
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] | aInstance | A pointer to an OpenThread instance. |
- Returns
- TRUE if the given instance is valid/initialized, FALSE otherwise.
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] | aInstance | A pointer to an OpenThread instance. |
This function removes a callback to indicate when certain configuration or state changes within OpenThread.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aCallback | A pointer to a function that is called with certain configuration or state changes. |
[in] | aCallbackContext | A pointer to application-specific context. |
This function sets the dynamic log level.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aLogLevel | The dynamic log level. |
- Return values
-
OT_ERROR_NONE | The log level was changed successfully. |
OT_ERROR_DISABLED_FEATURE | The dynamic log level feature is disabled. ( |
- See Also
OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
configuration option).
This function registers a callback to indicate when certain configuration or state changes within OpenThread.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aCallback | A pointer to a function that is called with certain configuration or state changes. |
[in] | aContext | A pointer to application-specific context. |
- Return values
-
OT_ERROR_NONE | Added the callback to the list of callbacks. |
OT_ERROR_NO_BUFS | Could not add the callback due to resource constraints. |