2424#include <zephyr/net/net_if.h>
2525#include <zephyr/kernel/thread.h>
2626
27- #include <openthread/instance.h>
28- #include <openthread/message.h>
27+ #include <openthread.h>
2928
3029#ifdef __cplusplus
3130extern "C" {
@@ -89,47 +88,8 @@ struct openthread_context {
8988 * INTERNAL_HIDDEN @endcond
9089 */
9190
92- /**
93- * @brief The common callback type for receiving IPv4 (translated by NAT64) and IPv6 datagrams.
94- *
95- * This callback is called when a datagram is received.
96- *
97- * @param message The message to receive.
98- * @param context The context to pass to the callback.
99- */
100- typedef void (* openthread_receive_cb )(otMessage * message , void * context );
101-
10291/** OpenThread state change callback */
10392
104- /**
105- * @brief OpenThread state change callback structure
106- *
107- * Used to register a callback in the callback list. As many
108- * callbacks as needed can be added as long as each of them
109- * are unique pointers of struct openthread_state_changed_cb.
110- *
111- * @note You may destroy the object only after it is unregistered from the callback list.
112- */
113- struct openthread_state_changed_callback {
114- /**
115- * @brief Callback for notifying configuration or state changes.
116- *
117- * @param otCallback OpenThread callback to register.
118- * See https://openthread.io/reference/group/api-instance#otstatechangedcallback for
119- * details.
120- */
121- otStateChangedCallback otCallback ;
122-
123- /** User data if required */
124- void * user_data ;
125-
126- /**
127- * Internally used field for list handling
128- * - user must not directly modify
129- */
130- sys_snode_t node ;
131- };
132-
13393/**
13494 * @deprecated use @ref openthread_state_changed_callback instead.
13595 *
@@ -162,21 +122,6 @@ struct openthread_state_changed_cb {
162122 sys_snode_t node ;
163123};
164124
165- /**
166- * @brief Register callbacks that will be called when a certain configuration
167- * or state changes occur within OpenThread.
168- *
169- * @param cb Callback struct to register.
170- */
171- int openthread_state_changed_callback_register (struct openthread_state_changed_callback * cb );
172-
173- /**
174- * @brief Unregister OpenThread configuration or state changed callbacks.
175- *
176- * @param cb Callback struct to unregister.
177- */
178- int openthread_state_changed_callback_unregister (struct openthread_state_changed_callback * cb );
179-
180125/**
181126 * @deprecated use @ref openthread_state_changed_callback_register instead.
182127 *
@@ -200,11 +145,6 @@ __deprecated int openthread_state_changed_cb_register(struct openthread_context
200145__deprecated int openthread_state_changed_cb_unregister (struct openthread_context * ot_context ,
201146 struct openthread_state_changed_cb * cb );
202147
203- /**
204- * @brief Get OpenThread thread identification.
205- */
206- k_tid_t openthread_thread_id_get (void );
207-
208148/**
209149 * @brief Get pointer to default OpenThread context.
210150 *
@@ -213,50 +153,6 @@ k_tid_t openthread_thread_id_get(void);
213153 */
214154struct openthread_context * openthread_get_default_context (void );
215155
216- /**
217- * @brief Get pointer to default OpenThread instance.
218- *
219- * @retval !NULL On success.
220- * @retval NULL On failure.
221- */
222- struct otInstance * openthread_get_default_instance (void );
223-
224- /**
225- * @brief Initialize the OpenThread module.
226- *
227- * This function:
228- * - Initializes the OpenThread module.
229- * - Creates an OpenThread single instance.
230- * - Starts the shell.
231- * - Enables the UART and NCP HDLC for coprocessor purposes.
232- * - Initializes the NAT64 translator.
233- * - Creates a work queue for the OpenThread module.
234- *
235- * @note This function is automatically called by Zephyr's networking layer.
236- * If you want to initialize the OpenThread independently, call this function
237- * in your application init code.
238- *
239- * @retval 0 On success.
240- * @retval -EIO On failure.
241- */
242- int openthread_init (void );
243-
244- /**
245- * @brief Run the OpenThread network.
246- *
247- * @details Prepares the OpenThread network and enables it.
248- * Depends on active settings: it uses the stored network configuration,
249- * starts the joining procedure or uses the default network configuration.
250- * Additionally, when the device is MTD, it sets the SED mode to properly
251- * attach the network.
252- */
253- int openthread_run (void );
254-
255- /**
256- * @brief Disable the OpenThread network.
257- */
258- int openthread_stop (void );
259-
260156/**
261157 * @deprecated use @ref openthread_run instead.
262158 *
@@ -270,41 +166,6 @@ int openthread_stop(void);
270166 */
271167__deprecated int openthread_start (struct openthread_context * ot_context );
272168
273- /**
274- * @brief Set the additional callback for receiving packets.
275- *
276- * @details This callback is called once a packet is received and can be
277- * used to inject packets into the Zephyr networking stack.
278- * Setting this callback is optional.
279- *
280- * @param cb Callback to set.
281- * @param context Context to pass to the callback.
282- */
283- void openthread_set_receive_cb (openthread_receive_cb cb , void * context );
284-
285- /**
286- * @brief Lock internal mutex before accessing OpenThread API.
287- *
288- * @details OpenThread API is not thread-safe. Therefore, before accessing any
289- * API function, you need to lock the internal mutex, to prevent the
290- * OpenThread thread from pre-empting the API call.
291- */
292- void openthread_mutex_lock (void );
293-
294- /**
295- * @brief Try to lock internal mutex before accessing OpenThread API.
296- *
297- * @details This function behaves like openthread_mutex_lock(), provided that
298- * the internal mutex is unlocked. Otherwise, it returns a negative value without
299- * waiting.
300- */
301- int openthread_mutex_try_lock (void );
302-
303- /**
304- * @brief Unlock internal mutex after accessing OpenThread API.
305- */
306- void openthread_mutex_unlock (void );
307-
308169/**
309170 * @deprecated use @ref openthread_mutex_lock.
310171 *
0 commit comments