Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
|
|
4.1.99 |
Go to the source code of this file.
Data Structures | |
struct | openthread_state_changed_callback |
OpenThread state change callback More... | |
Typedefs | |
typedef void(* | openthread_receive_cb) (struct otMessage *message, void *context) |
The common callback type for receiving IPv4 (translated by NAT64) and IPv6 datagrams. | |
Functions | |
int | openthread_state_changed_callback_register (struct openthread_state_changed_callback *cb) |
Register callbacks that will be called when a certain configuration or state changes occur within OpenThread. | |
int | openthread_state_changed_callback_unregister (struct openthread_state_changed_callback *cb) |
Unregister OpenThread configuration or state changed callbacks. | |
k_tid_t | openthread_thread_id_get (void) |
Get OpenThread thread identification. | |
struct otInstance * | openthread_get_default_instance (void) |
Get pointer to default OpenThread instance. | |
int | openthread_init (void) |
Initialize the OpenThread module. | |
int | openthread_run (void) |
Run the OpenThread network. | |
int | openthread_stop (void) |
Disable the OpenThread network. | |
void | openthread_set_receive_cb (openthread_receive_cb cb, void *context) |
Set the additional callback for receiving packets. | |
void | openthread_mutex_lock (void) |
Lock internal mutex before accessing OpenThread API. | |
int | openthread_mutex_try_lock (void) |
Try to lock internal mutex before accessing OpenThread API. | |
void | openthread_mutex_unlock (void) |
Unlock internal mutex after accessing OpenThread API. | |
typedef void(* openthread_receive_cb) (struct otMessage *message, void *context) |
The common callback type for receiving IPv4 (translated by NAT64) and IPv6 datagrams.
This callback is called when a datagram is received.
message | The message to receive. |
context | The context to pass to the callback. |
struct otInstance * openthread_get_default_instance | ( | void | ) |
Get pointer to default OpenThread instance.
!NULL | On success. |
NULL | On failure. |
int openthread_init | ( | void | ) |
Initialize the OpenThread module.
This function:
0 | On success. |
-EIO | On failure. |
void openthread_mutex_lock | ( | void | ) |
Lock internal mutex before accessing OpenThread API.
OpenThread API is not thread-safe. Therefore, before accessing any API function, you need to lock the internal mutex, to prevent the OpenThread thread from pre-empting the API call.
int openthread_mutex_try_lock | ( | void | ) |
Try to lock internal mutex before accessing OpenThread API.
This function behaves like openthread_mutex_lock(), provided that the internal mutex is unlocked. Otherwise, it returns a negative value without waiting.
void openthread_mutex_unlock | ( | void | ) |
Unlock internal mutex after accessing OpenThread API.
int openthread_run | ( | void | ) |
Run the OpenThread network.
Prepares the OpenThread network and enables it. Depends on active settings: it uses the stored network configuration, starts the joining procedure or uses the default network configuration. Additionally, when the device is MTD, it sets the SED mode to properly attach the network.
void openthread_set_receive_cb | ( | openthread_receive_cb | cb, |
void * | context ) |
Set the additional callback for receiving packets.
This callback is called once a packet is received and can be used to inject packets into the Zephyr networking stack. Setting this callback is optional.
cb | Callback to set. |
context | Context to pass to the callback. |
int openthread_state_changed_callback_register | ( | struct openthread_state_changed_callback * | cb | ) |
Register callbacks that will be called when a certain configuration or state changes occur within OpenThread.
cb | Callback struct to register. |
int openthread_state_changed_callback_unregister | ( | struct openthread_state_changed_callback * | cb | ) |
Unregister OpenThread configuration or state changed callbacks.
cb | Callback struct to unregister. |
int openthread_stop | ( | void | ) |
Disable the OpenThread network.
k_tid_t openthread_thread_id_get | ( | void | ) |
Get OpenThread thread identification.