2 * Copyright (c) 2020 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.
25 #include <uwb-private.h>
26 #include <uwb-gdbus.h>
30 #define UWB_DBUS_SERVICE "org.tizen.uwb" /**< For uwb dbus */
31 #define UWB_DBUS_MANAGER_PATH "/org/tizen/uwb/manager" /**< For manager dbus */
34 static struct _uwb_ctx {
35 Manager *manager_proxy;
36 uwb_message_received_cb message_received_cb;
37 void *message_received_user_data;
38 uwb_position_changed_cb position_changed_cb;
39 void *position_changed_user_data;
40 uwb_get_network_finished_cb get_network_finished_cb;
41 uwb_network_foreach_remote_node_cb foreach_remote_node_cb;
44 static inline void __handle_error(GError *error, int *ret)
49 if (NULL == g_strrstr(error->message, "org.tizen.uwb.Error")) {
50 if (NULL != g_strrstr(error->message, ".AccessDenied")) {
51 _DBG("Client doesn't have nmdaemon privilege");
52 *ret = UWB_ERROR_PERMISSION_DENIED;
55 *ret = UWB_ERROR_OPERATION_FAILED;
58 if (NULL != g_strrstr(error->message, ".NotPermitted")) {
59 _DBG("Client doesn't have uwb daemon privilege");
60 *ret = UWB_ERROR_PERMISSION_DENIED;
61 } else if (NULL != g_strrstr(error->message, ".InvalidParameter")) {
62 _DBG("Invalid Parameter");
63 *ret = UWB_ERROR_INVALID_PARAMETER;
64 } else if (NULL != g_strrstr(error->message, ".OutOfMemory")) {
65 _DBG("Out of memory");
66 *ret = UWB_ERROR_OUT_OF_MEMORY;
68 _DBG("Operation Failed");
69 *ret = UWB_ERROR_OPERATION_FAILED;
75 static void __message_received(GObject *source_object,
76 guint16 node_id, GVariant *message, gint message_length)
79 unsigned char element;
80 unsigned char *buf = NULL;
83 g_variant_get(message, "a(y)", &iter);
84 size = g_variant_iter_n_children(iter);
86 buf = (unsigned char *)malloc(sizeof(unsigned char) * size + 1);
87 for (int i = 0; g_variant_iter_loop(iter, "(y)", &element); i++)
93 g_variant_iter_free(iter);
95 if (uwb_ctx.message_received_cb != NULL) {
96 uwb_ctx.message_received_cb(node_id, buf, message_length,
97 uwb_ctx.message_received_user_data);
103 static void __position_changed(GObject *source_object,
104 guint16 node_id, gint x, gint y, gint z)
106 if (uwb_ctx.position_changed_cb != NULL)
107 uwb_ctx.position_changed_cb(node_id, x, y, z, uwb_ctx.position_changed_user_data);
110 static int manager_proxy_init(void)
112 GError *error = NULL;
114 uwb_ctx.manager_proxy = manager_proxy_new_for_bus_sync(
116 G_DBUS_PROXY_FLAGS_NONE,
118 UWB_DBUS_MANAGER_PATH,
121 if (NULL == uwb_ctx.manager_proxy) {
122 /* LCOV_EXCL_START */
124 _ERR("Failed to connect to the D-BUS daemon [%s]", error->message);
127 return UWB_ERROR_IO_ERROR;
131 g_signal_connect(uwb_ctx.manager_proxy, "message-received",
132 G_CALLBACK(__message_received), NULL);
134 g_signal_connect(uwb_ctx.manager_proxy, "position-changed",
135 G_CALLBACK(__position_changed), NULL);
137 return UWB_ERROR_NONE;
140 static void manager_proxy_deinit(void)
142 g_object_unref(uwb_ctx.manager_proxy);
143 uwb_ctx.manager_proxy = NULL;
146 EXPORT_API int uwb_initialize(void)
148 int ret = UWB_ERROR_NONE;
150 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
151 CHECK_ALREADY_INITIALIZED();
155 ret = manager_proxy_init();
162 EXPORT_API int uwb_deinitialize(void)
164 int ret = UWB_ERROR_NONE;
166 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
167 CHECK_NOT_INITIALIZED();
171 manager_proxy_deinit();
178 EXPORT_API int uwb_reset(void)
180 int ret = UWB_ERROR_NONE;
181 GError *error = NULL;
183 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
184 CHECK_NOT_INITIALIZED();
188 if (manager_call_reset_sync(uwb_ctx.manager_proxy, NULL, &error) == FALSE) {
189 _ERR("manager_call_reset_sync failed : %s", error->message);
190 __handle_error(error, &ret);
198 EXPORT_API int uwb_factory_reset(void)
200 int ret = UWB_ERROR_NONE;
201 GError *error = NULL;
203 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
204 CHECK_NOT_INITIALIZED();
208 if (manager_call_factory_reset_sync(uwb_ctx.manager_proxy, NULL, &error) == FALSE) {
209 _ERR("manager_call_factory_reset_sync failed : %s", error->message);
210 __handle_error(error, &ret);
218 EXPORT_API int uwb_set_message_received_cb(uwb_message_received_cb message_received_cb, void *user_data)
220 int ret = UWB_ERROR_NONE;
222 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
226 uwb_ctx.message_received_cb = message_received_cb;
227 uwb_ctx.message_received_user_data = user_data;
234 EXPORT_API int uwb_set_position_changed_cb(uwb_position_changed_cb position_changed_cb, void *user_data)
236 int ret = UWB_ERROR_NONE;
238 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
242 uwb_ctx.position_changed_cb = position_changed_cb;
243 uwb_ctx.position_changed_user_data = user_data;
250 EXPORT_API int uwb_unset_message_received_cb(void)
252 int ret = UWB_ERROR_NONE;
254 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
258 uwb_ctx.message_received_cb = NULL;
259 uwb_ctx.message_received_user_data = NULL;
266 EXPORT_API int uwb_unset_position_changed_cb(void)
268 int ret = UWB_ERROR_NONE;
270 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
274 uwb_ctx.position_changed_cb = NULL;
275 uwb_ctx.position_changed_user_data = NULL;
282 EXPORT_API int uwb_get_own_node(uwb_node_h *own_node)
284 int ret = UWB_ERROR_NONE;
285 GError *error = NULL;
286 GVariant *own_node_va = NULL;
287 uwb_node_s **_own_node = (uwb_node_s **)own_node;
289 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
290 CHECK_NOT_INITIALIZED();
294 uwb_check_null_ret_error("own_node", own_node, UWB_ERROR_INVALID_PARAMETER);
296 if (manager_call_get_own_node_sync(uwb_ctx.manager_proxy,
297 &own_node_va, NULL, &error) == FALSE) {
298 __handle_error(error, &ret);
301 if (ret == UWB_ERROR_NONE && own_node_va != NULL)
302 *_own_node = uwb_util_get_node_from_variant(own_node_va);
311 static void __network_get_cb(GObject *source_object, GAsyncResult *res, gpointer user_data)
313 int ret = UWB_ERROR_NONE;
315 GVariant *remote_node_list_va = NULL;
316 GError *error = NULL;
317 uwb_network_s *network_s;
319 if (manager_call_get_network_info_finish(
320 MANAGER(source_object),
322 &remote_node_list_va,
325 _ERR("manager_call_get_network_info_finish failed : %s", error->message);
326 __handle_error(error, &ret);
328 if (uwb_ctx.get_network_finished_cb != NULL) {
329 uwb_ctx.get_network_finished_cb(ret, NULL, user_data);
335 /* create network handle */
336 network_s = (uwb_network_s *)malloc(sizeof(uwb_network_s));
338 if (ret == UWB_ERROR_NONE) {
339 GSList *remote_node_list = NULL;
340 network_s->pan_id = pan_id;
341 network_s->remote_node_count = g_variant_n_children(remote_node_list_va);
343 if (network_s->remote_node_count > 0) {
344 GVariantIter *iter = NULL;
345 GVariant *nodes_va = NULL;
347 g_variant_get(remote_node_list_va, "aa{sv}", &iter);
348 while ((nodes_va = g_variant_iter_next_value(iter)) != NULL) {
351 node = uwb_util_get_node_from_variant(nodes_va);
352 node->is_remote = true;
354 _DBG("(%d, %d, %d)", node->x, node->y, node->z);
355 remote_node_list = g_slist_append(remote_node_list, node);
357 g_variant_iter_free(iter);
359 network_s->remote_node_list = remote_node_list;
361 g_variant_unref(remote_node_list_va);
364 if (uwb_ctx.get_network_finished_cb != NULL) {
365 uwb_ctx.get_network_finished_cb(ret, (uwb_network_h)network_s, user_data);
369 EXPORT_API int uwb_network_get(uwb_get_network_finished_cb finished_cb, void *user_data)
371 int ret = UWB_ERROR_NONE;
373 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
374 CHECK_NOT_INITIALIZED();
378 uwb_check_null_ret_error("finished_cb", finished_cb, UWB_ERROR_INVALID_PARAMETER);
380 uwb_ctx.get_network_finished_cb = finished_cb;
382 manager_call_get_network_info(uwb_ctx.manager_proxy, NULL, __network_get_cb, user_data);
390 static gpointer __copy_node(gconstpointer src, gpointer data)
395 uwb_node_s *src_ptr = (uwb_node_s *)src;
396 uwb_node_s *dst_ptr = (uwb_node_s *)malloc(sizeof(uwb_node_s));
400 dst_ptr->node_id = src_ptr->node_id;
401 dst_ptr->pan_id = src_ptr->pan_id;
402 dst_ptr->is_remote = src_ptr->is_remote;
403 dst_ptr->distance = src_ptr->distance;
404 dst_ptr->x = src_ptr->x;
405 dst_ptr->y = src_ptr->y;
406 dst_ptr->z = src_ptr->z;
408 return (gpointer)dst_ptr;
411 EXPORT_API int uwb_network_clone(uwb_network_h source, uwb_network_h *target)
413 uwb_network_s *result_network = NULL;
414 uwb_network_s *src_network = (uwb_network_s *)source;
415 GSList *remote_node_list = NULL;
416 int ret = UWB_ERROR_NONE;
418 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
422 uwb_check_null_ret_error("source", source, UWB_ERROR_INVALID_PARAMETER);
424 result_network = (uwb_network_s *)malloc(sizeof(uwb_network_s));
425 if (result_network == NULL) {
426 _ERR("malloc failed");
427 return UWB_ERROR_OPERATION_FAILED;
430 result_network->pan_id = src_network->pan_id;
431 result_network->remote_node_count = src_network->remote_node_count;
432 remote_node_list = src_network->remote_node_list;
433 result_network->remote_node_list = g_slist_copy_deep(remote_node_list,
439 *target = result_network;
443 EXPORT_API int uwb_network_destroy(uwb_network_h network)
445 int ret = UWB_ERROR_NONE;
447 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
451 uwb_check_null_ret_error("network", network, UWB_ERROR_INVALID_PARAMETER);
453 uwb_util_destroy_network(network);
460 EXPORT_API int uwb_network_get_pan_id(uwb_network_h network, uint64_t *pan_id)
462 int ret = UWB_ERROR_NONE;
464 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
468 uwb_check_null_ret_error("network", network, UWB_ERROR_INVALID_PARAMETER);
469 uwb_check_null_ret_error("pan_id", pan_id, UWB_ERROR_INVALID_PARAMETER);
471 *pan_id = ((uwb_network_s *)network)->pan_id;
478 EXPORT_API int uwb_network_get_remote_node_count(uwb_network_h network, int *remote_node_count)
480 int ret = UWB_ERROR_NONE;
482 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
486 uwb_check_null_ret_error("network", network, UWB_ERROR_INVALID_PARAMETER);
487 uwb_check_null_ret_error("remote_node_count", remote_node_count, UWB_ERROR_INVALID_PARAMETER);
489 *remote_node_count = ((uwb_network_s *)network)->remote_node_count;
496 static void __foreach_node(gpointer data, gpointer user_data)
498 uwb_node_s *node = (uwb_node_s *)data;
499 _DBG("panid : 0x%X, nodeid : 0x%04"PRIX64", distance : %"PRId64"", node->pan_id, node->node_id, node->distance);
501 if (uwb_ctx.foreach_remote_node_cb != NULL)
502 uwb_ctx.foreach_remote_node_cb((uwb_node_h)node, user_data);
505 EXPORT_API int uwb_network_foreach_remote_node(uwb_network_h network,
506 uwb_network_foreach_remote_node_cb node_cb, void *user_data)
508 int ret = UWB_ERROR_NONE;
510 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
514 uwb_check_null_ret_error("network", network, UWB_ERROR_INVALID_PARAMETER);
516 uwb_network_s *network_s = (uwb_network_s *)network;
517 if (network_s->remote_node_count == 0) {
518 _DBG("remote_node_count is 0");
522 uwb_ctx.foreach_remote_node_cb = node_cb;
523 g_slist_foreach(network_s->remote_node_list, __foreach_node, user_data);
530 EXPORT_API int uwb_node_clone(uwb_node_h src, uwb_node_h *dst)
532 int ret = UWB_ERROR_NONE;
534 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
538 uwb_check_null_ret_error("source", src, UWB_ERROR_INVALID_PARAMETER);
539 uwb_check_null_ret_error("target", dst, UWB_ERROR_INVALID_PARAMETER);
541 uwb_node_s *_src = (uwb_node_s *)src;
542 *dst = (uwb_node_s *)malloc(sizeof(uwb_node_s));
543 uwb_node_s *_dst = *dst;
545 _dst->node_id = _src->node_id;
546 _dst->pan_id = _src->pan_id;
547 _dst->is_remote = _src->is_remote;
548 _dst->distance = _src->distance;
558 EXPORT_API int uwb_node_destroy(uwb_node_h node)
560 int ret = UWB_ERROR_NONE;
562 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
566 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
575 EXPORT_API int uwb_node_get_distance(uwb_node_h node, uint64_t *distance)
577 int ret = UWB_ERROR_NONE;
579 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
583 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
584 uwb_check_null_ret_error("distance", distance, UWB_ERROR_INVALID_PARAMETER);
586 *distance = ((uwb_node_s *)node)->distance;
593 EXPORT_API int uwb_node_get_node_id(uwb_node_h node, uint64_t *node_id)
595 int ret = UWB_ERROR_NONE;
597 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
601 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
602 uwb_check_null_ret_error("node_id", node_id, UWB_ERROR_INVALID_PARAMETER);
604 *node_id = ((uwb_node_s *)node)->node_id;
611 EXPORT_API int uwb_node_get_pan_id(uwb_node_h node, uint64_t *pan_id)
613 int ret = UWB_ERROR_NONE;
615 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
619 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
620 uwb_check_null_ret_error("pan_id", pan_id, UWB_ERROR_INVALID_PARAMETER);
622 *pan_id = ((uwb_node_s *)node)->pan_id;
629 EXPORT_API int uwb_node_get_is_remote(uwb_node_h node, bool *is_remote)
631 int ret = UWB_ERROR_NONE;
633 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
637 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
638 uwb_check_null_ret_error("is_remote", is_remote, UWB_ERROR_INVALID_PARAMETER);
640 *is_remote = ((uwb_node_s *)node)->is_remote;
647 EXPORT_API int uwb_node_get_position(uwb_node_h node, int *x, int *y, int *z)
649 int ret = UWB_ERROR_NONE;
651 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
655 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
656 uwb_check_null_ret_error("x", x, UWB_ERROR_INVALID_PARAMETER);
657 uwb_check_null_ret_error("y", y, UWB_ERROR_INVALID_PARAMETER);
658 uwb_check_null_ret_error("z", z, UWB_ERROR_INVALID_PARAMETER);
660 *x = ((uwb_node_s *)node)->x;
661 *y = ((uwb_node_s *)node)->y;
662 *z = ((uwb_node_s *)node)->z;
669 EXPORT_API int uwb_node_set_position(uwb_node_h node, int x, int y, int z)
671 int ret = UWB_ERROR_NONE;
672 GError *error = NULL;
674 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
675 CHECK_NOT_INITIALIZED();
679 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
681 if (manager_call_set_position_sync(uwb_ctx.manager_proxy,
682 ((uwb_node_s *)node)->node_id, x, y, z, NULL, &error) == FALSE) {
683 _ERR("manager_call_set_position_sync failed : %s", error->message);
684 __handle_error(error, &ret);
692 static GVariant *__data_to_variant(const unsigned char *data, int length)
694 GVariantBuilder builder;
696 g_variant_builder_init(&builder, G_VARIANT_TYPE("a(y)"));
698 if (data && length > 0)
700 for(int i = 0; i < length; i++)
701 g_variant_builder_add(&builder, "(y)", *(data + i));
704 return g_variant_builder_end(&builder);
707 EXPORT_API int uwb_node_send_message(const unsigned char *message, int len)
709 int ret = UWB_ERROR_NONE;
710 GVariant *msg = NULL;
711 GError *error = NULL;
713 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
714 CHECK_NOT_INITIALIZED();
718 uwb_check_null_ret_error("message", message, UWB_ERROR_INVALID_PARAMETER);
719 cond_expr_ret(len <= 0, UWB_ERROR_INVALID_PARAMETER);
721 msg = __data_to_variant(message, len);
723 if (manager_call_send_message_sync(uwb_ctx.manager_proxy,
724 msg, len, NULL, &error) == FALSE) {
725 _ERR("manager_call_send_message_sync failed : %s", error->message);
726 __handle_error(error, &ret);
734 EXPORT_API int uwb_node_send_message_to(uwb_node_h node, const unsigned char *message, int len)
736 int ret = UWB_ERROR_NONE;
737 GVariant *msg = NULL;
738 GError *error = NULL;
740 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
741 CHECK_NOT_INITIALIZED();
745 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
746 uwb_check_null_ret_error("message", message, UWB_ERROR_INVALID_PARAMETER);
747 cond_expr_ret(len <= 0, UWB_ERROR_INVALID_PARAMETER);
749 msg = __data_to_variant(message, len);
751 if (manager_call_send_message_to_sync(uwb_ctx.manager_proxy, ((uwb_node_s *)node)->node_id,
752 msg, len, NULL, &error) == FALSE) {
753 _ERR("manager_call_send_message_to_sync failed : %s", error->message);
754 __handle_error(error, &ret);
762 static int __get_configurations(uwb_node_h node, char *key,
763 const GVariantType *va_type, GVariant **va_out)
765 int ret = UWB_ERROR_NONE;
766 GError *error = NULL;
769 if (manager_call_get_configurations_sync(uwb_ctx.manager_proxy,
770 ((uwb_node_s *)node)->node_id, &va, NULL, &error) == FALSE) {
771 _ERR("__get_configurations failed : %s", error->message);
772 __handle_error(error, &ret);
774 *va_out = g_variant_lookup_value(va, key, va_type);
780 EXPORT_API int uwb_node_get_configuration_int32(uwb_node_h node, char *key, int32_t *value)
782 int ret = UWB_ERROR_NONE;
783 GVariant *value_va = NULL;
785 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
786 CHECK_NOT_INITIALIZED();
790 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
792 ret = __get_configurations(node, key, G_VARIANT_TYPE_INT32, &value_va);
794 if (value_va != NULL)
795 *value = g_variant_get_int32(value_va);
804 EXPORT_API int uwb_node_get_configuration_int64(uwb_node_h node, char *key, int64_t *value)
806 int ret = UWB_ERROR_NONE;
807 GVariant *value_va = NULL;
809 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
810 CHECK_NOT_INITIALIZED();
814 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
816 ret = __get_configurations(node, key, G_VARIANT_TYPE_INT64, &value_va);
818 if (value_va != NULL)
819 *value = g_variant_get_int64(value_va);
828 EXPORT_API int uwb_node_get_configuration_string(uwb_node_h node, char *key, const char **value)
830 int ret = UWB_ERROR_NONE;
831 GVariant *value_va = NULL;
833 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
834 CHECK_NOT_INITIALIZED();
838 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
840 ret = __get_configurations(node, key, G_VARIANT_TYPE_STRING, &value_va);
842 if (value_va != NULL)
843 *value = g_variant_get_string(value_va, NULL);
852 static int __set_configuration(uwb_node_h node, char *key, GVariant *va)
854 int ret = UWB_ERROR_NONE;
855 GError *error = NULL;
857 if (manager_call_set_configurations_sync(uwb_ctx.manager_proxy, ((uwb_node_s *)node)->node_id,
858 va, NULL, &error) == FALSE) {
859 _ERR("__set_configurations : %s", error->message);
860 __handle_error(error, &ret);
866 static GVariant *__build_configuration(char *key, GVariant *value)
869 GVariantBuilder *builder;
871 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
872 g_variant_builder_open(builder, G_VARIANT_TYPE_VARDICT);
873 g_variant_builder_add(builder, "{sv}", key, value);
874 g_variant_builder_close(builder);
875 va = g_variant_builder_end(builder);
876 g_variant_builder_unref(builder);
881 EXPORT_API int uwb_node_set_configuration_int32(uwb_node_h node, char *key, int32_t value)
883 int ret = UWB_ERROR_NONE;
884 GVariant *configuration = NULL;
886 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
887 CHECK_NOT_INITIALIZED();
891 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
893 configuration = __build_configuration(key, g_variant_new_int32(value));
895 ret = __set_configuration(node, key, configuration);
902 EXPORT_API int uwb_node_set_configuration_int64(uwb_node_h node, char *key, int64_t value)
904 int ret = UWB_ERROR_NONE;
905 GVariant *configuration = NULL;
907 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
908 CHECK_NOT_INITIALIZED();
912 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
914 configuration = __build_configuration(key, g_variant_new_int64(value));
916 ret = __set_configuration(node, key, configuration);
923 EXPORT_API int uwb_node_set_configuration_string(uwb_node_h node, char *key, const char *value)
925 int ret = UWB_ERROR_NONE;
926 GVariant *configuration = NULL;
928 CHECK_FEATURE_SUPPORTED(UWB_FEATURE);
929 CHECK_NOT_INITIALIZED();
933 uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER);
935 configuration = __build_configuration(key, g_variant_new_string(value));
937 ret = __set_configuration(node, key, configuration);