From: jiung-yu Date: Thu, 23 Sep 2021 17:32:15 +0000 (+0900) Subject: Add Angle of arrival data X-Git-Tag: submit/tizen/20210924.142521^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_6.5_unified;p=platform%2Fcore%2Fapi%2Fuwb.git Add Angle of arrival data Change-Id: Icf4289d059816e902a23fd61f181d6676bbafc39 Signed-off-by: Yu jiung --- diff --git a/include/uwb.h b/include/uwb.h index a6ad849..bd88bcc 100755 --- a/include/uwb.h +++ b/include/uwb.h @@ -99,6 +99,9 @@ int uwb_node_get_node_id(uwb_node_h node, uint64_t *node_id); int uwb_node_get_pan_id(uwb_node_h node, uint64_t *pan_id); int uwb_node_get_is_remote(uwb_node_h node, bool *is_remote); int uwb_node_get_position(uwb_node_h node, int *x, int *y, int *z); +int uwb_node_get_range(uwb_node_h node, int *range); +int uwb_node_get_aoa(uwb_node_h node, int *aoa); +int uwb_node_get_pdoa(uwb_node_h node, int *pdoa); #ifdef __cplusplus } diff --git a/packaging/capi-network-uwb.spec b/packaging/capi-network-uwb.spec index 06e5808..43e9f8c 100644 --- a/packaging/capi-network-uwb.spec +++ b/packaging/capi-network-uwb.spec @@ -1,6 +1,6 @@ Name: capi-network-uwb Summary: UWB CAPI -Version: 0.1.3 +Version: 0.2.0 Release: 0 Group: Network & Connectivity/API License: Apache-2.0 diff --git a/src/uwb-private.h b/src/uwb-private.h index 117dff3..443b9a0 100755 --- a/src/uwb-private.h +++ b/src/uwb-private.h @@ -73,6 +73,9 @@ typedef struct { int x; int y; int z; + int range; + int aoa; + int pdoa; } uwb_node_s; typedef struct { diff --git a/src/uwb-util.c b/src/uwb-util.c index 6a901e7..799e8de 100755 --- a/src/uwb-util.c +++ b/src/uwb-util.c @@ -69,6 +69,12 @@ uwb_node_s *uwb_util_get_node_from_variant(GVariant *va) node->y = g_variant_get_int32(key_value); else if (g_strcmp0(key, "Z") == 0) node->z = g_variant_get_int32(key_value); + else if (g_strcmp0(key, "Range") == 0) + node->range = g_variant_get_int32(key_value); + else if (g_strcmp0(key, "Aoa") == 0) + node->aoa = g_variant_get_int32(key_value); + else if (g_strcmp0(key, "Pdoa") == 0) + node->pdoa = g_variant_get_int32(key_value); } g_variant_iter_free(iter); diff --git a/src/uwb.c b/src/uwb.c index 7b378ab..a39ba3f 100755 --- a/src/uwb.c +++ b/src/uwb.c @@ -912,6 +912,9 @@ EXPORT_API int uwb_node_clone(uwb_node_h src, uwb_node_h *dst) _dst->x = _src->x; _dst->y = _src->y; _dst->z = _src->z; + _dst->range = _src->range; + _dst->aoa = _src->aoa; + _dst->pdoa = _src->pdoa; _END(); @@ -1028,6 +1031,58 @@ EXPORT_API int uwb_node_get_position(uwb_node_h node, int *x, int *y, int *z) return ret; } +EXPORT_API int uwb_node_get_range(uwb_node_h node, int *range) +{ + int ret = UWB_ERROR_NONE; + + CHECK_FEATURE_SUPPORTED(UWB_FEATURE); + + _BEGIN(); + + uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER); + uwb_check_null_ret_error("range", range, UWB_ERROR_INVALID_PARAMETER); + *range = ((uwb_node_s *)node)->range; + + _END(); + + return ret; +} + +EXPORT_API int uwb_node_get_aoa(uwb_node_h node, int *aoa) +{ + int ret = UWB_ERROR_NONE; + + CHECK_FEATURE_SUPPORTED(UWB_FEATURE); + + _BEGIN(); + + uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER); + uwb_check_null_ret_error("aoa", aoa, UWB_ERROR_INVALID_PARAMETER); + + *aoa = ((uwb_node_s *)node)->aoa; + + _END(); + + return ret; +} + +EXPORT_API int uwb_node_get_pdoa(uwb_node_h node, int *pdoa) +{ + int ret = UWB_ERROR_NONE; + + CHECK_FEATURE_SUPPORTED(UWB_FEATURE); + + _BEGIN(); + + uwb_check_null_ret_error("node", node, UWB_ERROR_INVALID_PARAMETER); + uwb_check_null_ret_error("pdoa", pdoa, UWB_ERROR_INVALID_PARAMETER); + + *pdoa = ((uwb_node_s *)node)->pdoa; + + _END(); + + return ret; +} static void __get_network_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { @@ -1129,6 +1184,9 @@ static gpointer __copy_node(gconstpointer src, gpointer data) dst_ptr->x = src_ptr->x; dst_ptr->y = src_ptr->y; dst_ptr->z = src_ptr->z; + dst_ptr->range = src_ptr->range; + dst_ptr->aoa = src_ptr->aoa; + dst_ptr->pdoa = src_ptr->pdoa; return (gpointer)dst_ptr; } diff --git a/tests/capi-network-uwb-test.c b/tests/capi-network-uwb-test.c index f42c667..55f9de0 100644 --- a/tests/capi-network-uwb-test.c +++ b/tests/capi-network-uwb-test.c @@ -322,6 +322,7 @@ bool __print_node_info(uwb_node_h node, void *user_data) uint64_t pan_id = 0; bool is_remote = 0; int x = 0, y = 0, z = 0; + int range = 0, aoa = 0, pdoa = 0; int ret = 0; if (node == NULL) @@ -340,6 +341,16 @@ bool __print_node_info(uwb_node_h node, void *user_data) printf("Distance :%llu Node ID: %llu Pan ID: %llu\n", distance, node_id, pan_id); printf("Position X: %d Y: %d Z: %d\n", x, y, z); + + ret = uwb_node_get_range(node, &range); + __print_result(ret, "uwb_node_get_range"); + ret = uwb_node_get_aoa(node, &aoa); + __print_result(ret, "uwb_node_get_aoa"); + ret = uwb_node_get_pdoa(node, &pdoa); + __print_result(ret, "uwb_node_get_pdoa"); + printf("AoA related range: %d aoa: %d pdoa: %d\n", range, aoa, pdoa); + + return true; }