Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
OpenThread l2 stack api. More...
Macros | |
#define | OPENTHREAD_L2_CTX_TYPE struct openthread_context |
Functions | |
void | openthread_set_state_changed_cb (otStateChangedCallback cb) |
Sets function which will be called when certain configuration or state changes within OpenThread. More... | |
k_tid_t | openthread_thread_id_get (void) |
Get OpenThread thread identification. More... | |
struct openthread_context * | openthread_get_default_context (void) |
Get pointer to default OpenThread context. More... | |
struct otInstance * | openthread_get_default_instance (void) |
Get pointer to default OpenThread instance. More... | |
int | openthread_start (struct openthread_context *ot_context) |
Starts the OpenThread network. More... | |
void | openthread_api_mutex_lock (struct openthread_context *ot_context) |
Lock internal mutex before accessing OT API. More... | |
int | openthread_api_mutex_try_lock (struct openthread_context *ot_context) |
Try to lock internal mutex before accessing OT API. More... | |
void | openthread_api_mutex_unlock (struct openthread_context *ot_context) |
Unlock internal mutex after accessing OT API. More... | |
OpenThread l2 stack api.
#define OPENTHREAD_L2_CTX_TYPE struct openthread_context |
#include <include/net/openthread.h>
void openthread_api_mutex_lock | ( | struct openthread_context * | ot_context | ) |
#include <include/net/openthread.h>
Lock internal mutex before accessing OT API.
OpenThread API is not thread-safe, therefore before accessing any API function, it's needed to lock the internal mutex, to prevent the OpenThread thread from prempting the API call.
ot_context | Context to lock. |
int openthread_api_mutex_try_lock | ( | struct openthread_context * | ot_context | ) |
#include <include/net/openthread.h>
Try to lock internal mutex before accessing OT API.
This function behaves like openthread_api_mutex_lock() provided that the internal mutex is unlocked. Otherwise, it exists immediately and returns a negative value.
ot_context | Context to lock. |
0 | On success. |
<0 | On failure. |
void openthread_api_mutex_unlock | ( | struct openthread_context * | ot_context | ) |
#include <include/net/openthread.h>
Unlock internal mutex after accessing OT API.
ot_context | Context to unlock. |
struct openthread_context * openthread_get_default_context | ( | void | ) |
#include <include/net/openthread.h>
Get pointer to default OpenThread context.
!NULL | On success. |
NULL | On failure. |
struct otInstance * openthread_get_default_instance | ( | void | ) |
#include <include/net/openthread.h>
Get pointer to default OpenThread instance.
!NULL | On success. |
NULL | On failure. |
void openthread_set_state_changed_cb | ( | otStateChangedCallback | cb | ) |
#include <include/net/openthread.h>
Sets function which will be called when certain configuration or state changes within OpenThread.
cb | function to call in callback procedure. |
int openthread_start | ( | struct openthread_context * | ot_context | ) |
#include <include/net/openthread.h>
Starts the OpenThread network.
Depends on active settings: it uses stored network configuration, start joining procedure or uses default network configuration. Additionally when the device is MTD, it sets the SED mode to properly attach the network.
ot_context |
#include <include/net/openthread.h>
Get OpenThread thread identification.