2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __TIZEN_NETWORK_THREAD_H__
19 #define __TIZEN_NETWORK_THREAD_H__
24 #include <tizen_error.h>
27 #include <thread-type.h>
29 #ifndef TIZEN_DEPRECATED_API
30 #define TIZEN_DEPRECATED_API __attribute__((__visibility__("default"), deprecated))
36 #endif /* __cplusplus */
40 * @brief API to control the Thread adapter and devices and communications.
41 * @ingroup CAPI_NETWORK_THREAD_MODULE
46 * @ingroup CAPI_NETWORK_THREAD_MODULE
47 * @brief Initializes the thread API.
50 * @remarks This function must be called before thread API starts. \n
52 * @return 0 on success, otherwise a negative error value.
53 * @retval #THREAD_ERROR_NONE Successful
54 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
55 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
57 * @see thread_deinitialize()
59 int thread_initialize(void);
62 * @ingroup CAPI_NETWORK_THREAD_MODULE
63 * @brief Releases all resources of the thread API.
66 * @remarks This function must be called if thread API is no longer needed.
68 * @return 0 on success, otherwise a negative error value.
69 * @retval #THREAD_ERROR_NONE Successful
70 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
71 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
72 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
74 * @pre thread API must be initialized with thread_initialize().
76 * @see thread_initialize()
78 int thread_deinitialize(void);
81 * @ingroup CAPI_NETWORK_THREAD_MODULE
82 * @brief Enable thread Module
85 * @return 0 on success, otherwise a negative error value.
86 * @retval #THREAD_ERROR_NONE Successful
87 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
88 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
89 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
91 * @pre thread API must be initialized with thread_initialize().
93 * @see thread_initialize()
95 int thread_enable(thread_instance_h *instance);
98 * @ingroup CAPI_NETWORK_THREAD_MODULE
99 * @brief Disable thread Module
102 * @return 0 on success, otherwise a negative error value.
103 * @retval #THREAD_ERROR_NONE Successful
104 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
105 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
106 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
108 * @pre thread API must be initialized with thread_initialize().
110 * @see thread_enable()
112 int thread_disable(thread_instance_h instance);
115 * @ingroup CAPI_NETWORK_THREAD_MODULE
116 * @brief Start Thread
119 * @return 0 on success, otherwise a negative error value.
120 * @retval #THREAD_ERROR_NONE Successful
121 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
122 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
123 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
125 * @pre thread API must be initialized with thread_initialize().
128 int thread_start(thread_instance_h instance);
131 * @ingroup CAPI_NETWORK_THREAD_MODULE
135 * @return 0 on success, otherwise a negative error value.
136 * @retval #THREAD_ERROR_NONE Successful
137 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
138 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
139 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
141 * @pre thread API must be initialized with thread_initialize().
142 * @see thread_start()
144 int thread_stop(thread_instance_h instance);
147 * @ingroup CAPI_NETWORK_THREAD_MODULE
148 * @brief Perform reset of OT hardware, tries to resume the network after reset
151 * @return 0 on success, otherwise a negative error value.
152 * @retval #THREAD_ERROR_NONE Successful
153 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
154 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
155 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
157 * @pre thread API must be initialized with thread_initialize().
159 * @see thread_enable()
161 int thread_reset(thread_instance_h instance);
164 * @ingroup CAPI_NETWORK_THREAD_MODULE
165 * @brief Perform Factory reset of OT hardware, wipes all Thread persistent data
168 * @return 0 on success, otherwise a negative error value.
169 * @retval #THREAD_ERROR_NONE Successful
170 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
171 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
172 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
174 * @pre thread API must be initialized with thread_initialize().
176 * @see thread_enable()
178 int thread_factoryreset(thread_instance_h instance);
181 * @ingroup CAPI_NETWORK_THREAD_MODULE
182 * @brief Get Thread Device Role
185 * @return 0 on success, otherwise a negative error value.
186 * @retval #THREAD_ERROR_NONE Successful
187 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
188 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
189 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
191 * @pre thread API must be initialized with thread_initialize().
193 int thread_get_device_role(thread_instance_h instance, thread_device_role_e *device_role);
196 * @ingroup CAPI_NETWORK_THREAD_MODULE
197 * @brief Set Thread Device Role changed callback
200 * @return 0 on success, otherwise a negative error value.
201 * @retval #THREAD_ERROR_NONE Successful
202 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
203 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
204 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
206 * @pre thread API must be initialized with thread_initialize().
208 int thread_set_device_role_changed_cb(thread_instance_h instance,
209 thread_device_role_cb callback, void *user_data);
212 * @ingroup CAPI_NETWORK_THREAD_MODULE
213 * @brief Set Thread Device Type
216 * @return 0 on success, otherwise a negative error value.
217 * @retval #THREAD_ERROR_NONE Successful
218 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
219 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
220 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
222 * @pre thread API must be initialized with thread_initialize().
224 int thread_set_device_type(thread_instance_h instance, thread_device_type_e device_type);
227 * @ingroup CAPI_NETWORK_THREAD_MODULE
228 * @brief Get Thread Device Type
231 * @return 0 on success, otherwise a negative error value.
232 * @retval #THREAD_ERROR_NONE Successful
233 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
234 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
235 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
237 * @pre thread API must be initialized with thread_initialize().
239 int thread_get_device_type(thread_instance_h instance, thread_device_type_e *device_type);
242 * @ingroup CAPI_NETWORK_THREAD_MODULE
243 * @brief Create Thread Network Scan param
246 * @return 0 on success, otherwise a negative error value.
247 * @retval #THREAD_ERROR_NONE Successful
248 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
249 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
250 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
252 * @pre thread API must be initialized with thread_initialize().
254 * @see thread_network_scan_result_cb()
256 int thread_scan_param_create(thread_instance_h instance,
257 uint16_t duration, thread_scan_param_h *param_handle);
260 * @ingroup CAPI_NETWORK_THREAD_MODULE
261 * @brief Destroys Thread Network Scan param
264 * @return 0 on success, otherwise a negative error value.
265 * @retval #THREAD_ERROR_NONE Successful
266 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
267 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
268 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
270 * @pre thread API must be initialized with thread_initialize().
272 * @see thread_network_scan_result_cb()
274 int thread_scan_param_destroy(thread_instance_h instance,
275 thread_scan_param_h param_handle);
278 * @ingroup CAPI_NETWORK_THREAD_MODULE
279 * @brief Scan Thread Network
282 * @return 0 on success, otherwise a negative error value.
283 * @retval #THREAD_ERROR_NONE Successful
284 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
285 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
286 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
288 * @pre thread API must be initialized with thread_initialize().
290 * @see thread_network_scan_result_cb()
292 int thread_scan(thread_instance_h instance, thread_scan_param_h handle,
293 thread_network_scan_result_cb callback, void *user_data);
296 * @ingroup CAPI_NETWORK_THREAD_MODULE
297 * @brief Gets the extended address
300 * @return 0 on success, otherwise a negative error value.
301 * @retval #THREAD_ERROR_NONE Successful
302 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
303 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
304 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
306 * @pre thread API must be initialized with thread_initialize().
308 int thread_get_extended_address(thread_instance_h instance, uint64_t *extended_address);
311 * @ingroup CAPI_NETWORK_THREAD_MODULE
312 * @brief Gets the extended uuid(EUI-64) of the Thread Device
315 * @return 0 on success, otherwise a negative error value.
316 * @retval #THREAD_ERROR_NONE Successful
317 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
318 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
319 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
321 * @pre thread API must be initialized with thread_initialize().
323 int thread_get_extended_uuid(thread_instance_h instance, const char **uuid);
326 * @ingroup CAPI_NETWORK_THREAD_MODULE
327 * @brief Set Active operational Network dataset
330 * @return 0 on success, otherwise a negative error value.
331 * @retval #THREAD_ERROR_NONE Successful
332 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
333 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
334 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
336 * @pre thread API must be initialized with thread_initialize().
338 * @see thread_active_dataset_tlvs_s
340 int thread_network_set_active_dataset_tlvs(thread_instance_h instance,
341 const uint8_t *tlvs_buffer, int length);
344 * @ingroup CAPI_NETWORK_THREAD_MODULE
345 * @brief Get Active operational Network dataset
348 * @return 0 on success, otherwise a negative error value.
349 * @retval #THREAD_ERROR_NONE Successful
350 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
351 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
352 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
354 * @remarks copy the data returned by buffer. It will go out of scope after API returns
356 * @pre thread API must be initialized with thread_initialize().
358 * @see thread_active_dataset_tlvs_s
359 * @see thread_set_active_dataset_tlvs()
361 int thread_network_get_active_dataset_tlvs(thread_instance_h instance,
362 uint8_t **tlvs_buffer, int *buf_len);
365 * @ingroup CAPI_NETWORK_THREAD_MODULE
366 * @brief Get the PanId from Operational Network
369 * @param[out] panid The PanId
371 * @return 0 on success, otherwise a negative error value.
372 * @retval #THREAD_ERROR_NONE Successful
373 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
374 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
375 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
377 * @pre thread API must be initialized with thread_initialize().
378 * @pre Active Operational Dataset must be set using thread_set_active_dataset_tlvs().
380 * @see thread_network_create()
381 * @see thread_set_operational_network()
382 * @see thread_set_active_dataset_tlvs()
384 int thread_network_get_panid(thread_instance_h instance, uint16_t *panid);
387 * @ingroup CAPI_NETWORK_THREAD_MODULE
388 * @brief Attach the OT hardware to the active Operational Network, which is pre-set
391 * @return 0 on success, otherwise a negative error value.
392 * @retval #THREAD_ERROR_NONE Successful
393 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
394 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
395 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
397 * @pre thread API must be initialized with thread_initialize().
398 * @pre Active Operational Dataset must be set using thread_set_active_dataset_tlvs().
400 * @see thread_set_active_dataset_tlvs()
402 int thread_network_attach(thread_instance_h instance);
405 * @ingroup CAPI_NETWORK_THREAD_MODULE
406 * @brief Detach the OT hardware from the active Operational Network
409 * @return 0 on success, otherwise a negative error value.
410 * @retval #THREAD_ERROR_NONE Successful
411 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
412 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
413 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
415 * @pre thread API must be initialized with thread_initialize().
416 * @pre Active Operational Dataset must be attached.
418 * @see thread_network_attach()
420 int thread_network_detach(thread_instance_h instance);
423 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
424 * @brief Enable OT Border Routing
427 * @return 0 on success, otherwise a negative error value.
428 * @retval #THREAD_ERROR_NONE Successful
429 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
430 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
431 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
433 * @pre thread API must be initialized with thread_initialize().
435 * @see thread_br_disable()
437 int thread_br_enable(thread_instance_h instance);
440 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
441 * @brief Disable OT Border Routing
444 * @return 0 on success, otherwise a negative error value.
445 * @retval #THREAD_ERROR_NONE Successful
446 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
447 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
448 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
450 * @pre thread API must be initialized with thread_initialize().
452 * @see thread_br_enable()
454 int thread_br_disable(thread_instance_h instance);
457 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
458 * @brief Get All External Route informations
461 * @return 0 on success, otherwise a negative error value.
462 * @retval #THREAD_ERROR_NONE Successful
463 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
464 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
465 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
467 * @pre thread API must be initialized with thread_initialize().
469 * @see thread_external_route_foreach_cb()
471 int thread_br_get_external_routes(thread_instance_h instance,
472 thread_external_route_foreach_cb callback, void *user_data);
475 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
476 * @brief Get Route informations
479 * @return 0 on success, otherwise a negative error value.
480 * @retval #THREAD_ERROR_NONE Successful
481 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
482 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
483 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
485 * @pre thread API must be initialized with thread_initialize().
487 * @see thread_external_route_foreach_cb()
489 int thread_br_get_route_info(thread_route_info_h route, uint8_t *ipv6_prefix,
490 uint8_t *ipv6_prefix_len, uint16_t *rloc16, int8_t *preference,
491 bool *is_stable, bool *is_device_nexthop);
494 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
495 * @brief Add an external border routing rule to the network.
498 * @return 0 on success, otherwise a negative error value.
499 * @retval #THREAD_ERROR_NONE Successful
500 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
501 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
502 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
504 * @pre thread API must be initialized with thread_initialize().
506 * @see thread_remove_external_route()
508 int thread_br_add_external_route(thread_instance_h instance,
509 const uint8_t *ipv6_prefix, uint8_t ipv6_prefix_len,
510 uint16_t rloc16, int8_t preference,
511 bool is_stable, bool is_device_nexthop,
512 thread_route_info_h *route_handle);
515 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
516 * @brief Remove an external border routing rule from the network
519 * @return 0 on success, otherwise a negative error value.
520 * @retval #THREAD_ERROR_NONE Successful
521 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
522 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
523 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
525 * @pre thread API must be initialized with thread_initialize().
527 * @see thread_add_external_route()
529 int thread_br_remove_external_route(thread_instance_h instance, thread_route_info_h route_handle);
532 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
533 * @brief Add an on-mesh prefix to the network
536 * @return 0 on success, otherwise a negative error value.
537 * @retval #THREAD_ERROR_NONE Successful
538 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
539 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
540 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
542 * @pre thread API must be initialized with thread_initialize().
544 * @see thread_remove_onmesh_prefix()
546 int thread_br_add_onmesh_prefix(thread_instance_h instance,
547 const uint8_t *ipv6_prefix, int ipv6_prefix_len, int8_t preference,
548 bool preferred, bool slaac, bool dhcp, bool configure, bool default_route,
549 bool on_mesh, bool stable, thread_onmesh_prefix_info_h *onmesh_prefix);
552 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
553 * @brief Remove on-mesh prefix from the network
556 * @return 0 on success, otherwise a negative error value.
557 * @retval #THREAD_ERROR_NONE Successful
558 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
559 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
560 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
562 * @pre thread API must be initialized with thread_initialize().
564 * @see thread_add_onmesh_prefix()
566 int thread_br_remove_onmesh_prefix(thread_instance_h instance, thread_onmesh_prefix_info_h prefix_info);
569 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
570 * @brief Create thread network
573 * @return 0 on success, otherwise a negative error value.
574 * @retval #THREAD_ERROR_NONE Successful
575 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
576 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
577 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
579 * @pre thread API must be initialized with thread_initialize().
581 int thread_network_create(thread_network_h *network);
584 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
585 * @brief Destroy thread network
588 * @return 0 on success, otherwise a negative error value.
589 * @retval #THREAD_ERROR_NONE Successful
590 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
591 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
592 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
594 * @pre thread API must be initialized with thread_initialize().
596 int thread_network_destroy(thread_network_h network);
599 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
600 * @brief Set the thread network name
603 * @return 0 on success, otherwise a negative error value.
604 * @retval #THREAD_ERROR_NONE Successful
605 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
606 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
607 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
609 * @pre thread API must be initialized with thread_initialize().
611 int thread_network_set_name(thread_network_h network, const char *name);
614 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
615 * @brief Set the thread network key
618 * @return 0 on success, otherwise a negative error value.
619 * @retval #THREAD_ERROR_NONE Successful
620 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
621 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
622 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
624 * @pre thread API must be initialized with thread_initialize().
626 int thread_network_set_key(thread_network_h network, const char *key);
629 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
630 * @brief Set the thread network pskc
633 * @return 0 on success, otherwise a negative error value.
634 * @retval #THREAD_ERROR_NONE Successful
635 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
636 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
637 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
639 * @pre thread API must be initialized with thread_initialize().
641 int thread_network_set_pskc(thread_network_h network, const char *pskc);
644 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
645 * @brief Set the thread network channel
648 * @return 0 on success, otherwise a negative error value.
649 * @retval #THREAD_ERROR_NONE Successful
650 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
651 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
652 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
654 * @pre thread API must be initialized with thread_initialize().
656 int thread_network_set_channel(thread_network_h network, uint32_t channel);
659 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
660 * @brief Set the thread network extended pan id
663 * @return 0 on success, otherwise a negative error value.
664 * @retval #THREAD_ERROR_NONE Successful
665 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
666 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
667 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
669 * @pre thread API must be initialized with thread_initialize().
671 int thread_network_set_extended_panid(thread_network_h network, uint64_t extended_panid);
674 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
675 * @brief Set the thread network pan id
678 * @return 0 on success, otherwise a negative error value.
679 * @retval #THREAD_ERROR_NONE Successful
680 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
681 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
682 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
684 * @pre thread API must be initialized with thread_initialize().
686 int thread_network_set_panid(thread_network_h network, uint16_t panid);
689 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
690 * @brief Set the thread network to instance
693 * @return 0 on success, otherwise a negative error value.
694 * @retval #THREAD_ERROR_NONE Successful
695 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
696 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
697 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
699 * @pre thread API must be initialized with thread_initialize().
701 int thread_set_operational_network(thread_instance_h instance, thread_network_h network);
704 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
705 * @brief Unset the thread network from instance
708 * @return 0 on success, otherwise a negative error value.
709 * @retval #THREAD_ERROR_NONE Successful
710 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
711 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
712 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
714 * @pre thread API must be initialized with thread_initialize().
716 int thread_unset_operational_network(thread_instance_h instance);
719 * @ingroup CAPI_NETWORK_THREAD_JOINER_MODULE
720 * @brief Start Thread joining with detailed informations
723 * @return 0 on success, otherwise a negative error value.
724 * @retval #THREAD_ERROR_NONE Successful
725 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
726 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
727 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
729 * @pre thread API must be initialized with thread_initialize().
730 * @see thread_joiner_stop()
732 int thread_joiner_start(thread_instance_h instance,
733 const char *pskd, const char *prov_url,
734 const char *vendor_name, const char *vendor_model,
735 const char *vendor_sw_ver, const char *vendor_data,
736 thread_joiner_result_cb callback, void *user_data);
739 * @ingroup CAPI_NETWORK_THREAD_JOINER_MODULE
740 * @brief Stop Thread Joining
743 * @return 0 on success, otherwise a negative error value.
744 * @retval #THREAD_ERROR_NONE Successful
745 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
746 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
747 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
749 * @pre thread API must be initialized with thread_initialize().
750 * @see thread_joiner_start()
752 int thread_joiner_stop(thread_instance_h instance);
755 * @ingroup CAPI_NETWORK_THREAD_JOINER_MODULE
756 * @brief Join Thread Network by Network key (Out-Of-Band Commisioning)
757 * network key must be obtained by the commissioner via any trusted Out-Of-Band method
760 * @return 0 on success, otherwise a negative error value.
761 * @retval #THREAD_ERROR_NONE Successful
762 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
763 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
764 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
766 * @pre thread API must be initialized with thread_initialize().
768 int thread_joiner_join_by_network_key(thread_instance_h instance, const char *network_key, const char *panid);
771 * @ingroup CAPI_NETWORK_THREAD_COMMISSIONER_MODULE
772 * @brief Start thread commissioner (In-Band Commissioning)
775 * @return 0 on success, otherwise a negative error value.
776 * @retval #THREAD_ERROR_NONE Successful
777 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
778 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
779 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
781 * @pre thread API must be initialized with thread_initialize().
783 int thread_commissioner_start(thread_instance_h instance);
786 * @ingroup CAPI_NETWORK_THREAD_COMMISSIONER_MODULE
787 * @brief Set commissioning Data (In-Band Commissioning)
790 * @return 0 on success, otherwise a negative error value.
791 * @retval #THREAD_ERROR_NONE Successful
792 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
793 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
794 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
796 * @pre thread API must be initialized with thread_initialize().
798 int thread_commissioner_set_commissioning_data(thread_instance_h instance, const char *joiner_uuid,
799 const char *joiner_passphrase);
802 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
803 * @brief Start SRP Client
806 * @return 0 on success, otherwise a negative error value.
807 * @retval #THREAD_ERROR_NONE Successful
808 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
809 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
810 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
812 * @pre thread API must be initialized with thread_initialize().
813 * @see thread_srp_client_stop()
815 int thread_srp_client_start(thread_instance_h instance);
818 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
819 * @brief Stop SRP Client
822 * @return 0 on success, otherwise a negative error value.
823 * @retval #THREAD_ERROR_NONE Successful
824 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
825 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
826 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
828 * @pre thread API must be initialized with thread_initialize().
829 * @see thread_srp_client_start()
831 int thread_srp_client_stop(thread_instance_h instance);
834 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
835 * @brief Remove already registered SRP host service
838 * @return 0 on success, otherwise a negative error value.
839 * @retval #THREAD_ERROR_NONE Successful
840 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
841 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
842 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
844 * @pre thread API must be initialized with thread_initialize().
845 * @see thread_srp_client_start()
847 int thread_srp_client_remove_host(thread_instance_h instance);
850 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
851 * @brief Set Host name
854 * @return 0 on success, otherwise a negative error value.
855 * @retval #THREAD_ERROR_NONE Successful
856 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
857 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
858 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
860 * @pre thread API must be initialized with thread_initialize().
861 * @see thread_srp_client_start()
863 int thread_srp_client_set_host_name(thread_instance_h instance, const char *host_name);
866 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
867 * @brief Set Host address
870 * @return 0 on success, otherwise a negative error value.
871 * @retval #THREAD_ERROR_NONE Successful
872 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
873 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
874 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
876 * @pre thread API must be initialized with thread_initialize().
877 * @see thread_srp_client_start()
879 int thread_srp_client_set_host_address(thread_instance_h instance, const char *ipv6_address);
882 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
883 * @brief Register Service to SRP server
886 * @return 0 on success, otherwise a negative error value.
887 * @retval #THREAD_ERROR_NONE Successful
888 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
889 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
890 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
892 * @pre thread API must be initialized with thread_initialize().
893 * @see thread_srp_client_start()
894 * @see thread_srp_client_set_host_address()
896 int thread_srp_client_register_service(thread_instance_h instance,
897 const char *service_name, const char *service_type, uint64_t port);
900 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
901 * @brief Start SRP Server
904 * @return 0 on success, otherwise a negative error value.
905 * @retval #THREAD_ERROR_NONE Successful
906 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
907 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
908 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
910 * @pre thread API must be initialized with thread_initialize().
911 * @see thread_srp_server_stop()
913 int thread_srp_server_start(thread_instance_h instance);
916 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
917 * @brief Stop SRP Server
920 * @return 0 on success, otherwise a negative error value.
921 * @retval #THREAD_ERROR_NONE Successful
922 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
923 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
924 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
926 * @pre thread API must be initialized with thread_initialize().
927 * @see thread_srp_server_start()
929 int thread_srp_server_stop(thread_instance_h instance);
932 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
933 * @brief Get registered service detail from the SRP server
936 * @return 0 on success, otherwise a negative error value.
937 * @retval #THREAD_ERROR_NONE Successful
938 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
939 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
940 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
942 * @pre thread API must be initialized with thread_initialize().
943 * @see thread_srp_server_start()
945 int thread_srp_server_get_registered_service(thread_instance_h instance, const char **service_name,
946 const char **address, uint64_t *port, bool *is_deleted);
949 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
950 * @brief Get node ip address of the thread network node
953 * @return 0 on success, otherwise a negative error value.
954 * @retval #THREAD_ERROR_NONE Successful
955 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
956 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
957 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
959 * @pre thread API must be initialized with thread_initialize() and
960 * enabled with thread_enable().
961 * @see thread_initialize() and thread_enable()
963 int thread_get_ipaddr(thread_instance_h instance, thread_ipaddr_foreach_cb callback,
964 thread_ipaddr_type_e ipaddr_type, void *user_data);
967 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
968 * @brief Up the netwotk interface for the thread node.
971 * @return 0 on success, otherwise a negative error value.
972 * @retval #THREAD_ERROR_NONE Successful
973 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
974 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
975 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
977 * @pre thread API must be initialized with thread_initialize() and
978 * enabled with thread_enable().
979 * @see thread_initialize() and thread_enable()
981 int thread_ifconfig_up(thread_instance_h instance);
984 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
985 * @brief Add Ipv6 address to the thread node.
988 * @param[in] ipv6_address Byte list
990 * @return 0 on success, otherwise a negative error value.
991 * @retval #THREAD_ERROR_NONE Successful
992 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
993 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
994 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
996 * @pre thread API must be initialized with thread_initialize() and
997 * enabled with thread_enable().
998 * @see thread_initialize() and thread_enable()
1000 int thread_add_ipaddr(thread_instance_h instance, const uint8_t *ipv6_address);
1003 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1004 * @brief Remove Ipv6 address from the thread node.
1007 * @param[in] ipv6_address Byte list
1009 * @return 0 on success, otherwise a negative error value.
1010 * @retval #THREAD_ERROR_NONE Successful
1011 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1012 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1013 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1015 * @pre thread API must be initialized with thread_initialize() and
1016 * enabled with thread_enable().
1017 * @see thread_initialize() and thread_enable()
1019 int thread_remove_ipaddr(thread_instance_h instance, const uint8_t *ipv6_address);
1023 #endif /* __cplusplus */
1025 #endif /* __TIZEN_NETWORK_THREAD_H__ */