From: jiung-yu Date: Mon, 18 Oct 2021 15:13:15 +0000 (+0900) Subject: Update filtered data X-Git-Tag: accepted/tizen/7.0/unified/20221110.060152~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7d6592304a86157766a9cb210ffc262d86bf036;p=platform%2Fcore%2Fapi%2Fuwb.git Update filtered data Change-Id: I8bd5751c3eb7220e32503d1ecb292930c553b4db Signed-off-by: Yu jiung --- diff --git a/include/uwb.h b/include/uwb.h index bd88bcc..10708f8 100755 --- a/include/uwb.h +++ b/include/uwb.h @@ -102,6 +102,8 @@ 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); +int uwb_node_get_filtered_range(uwb_node_h node, int *range); +int uwb_node_get_filtered_aoa(uwb_node_h node, int *aoa); #ifdef __cplusplus } diff --git a/packaging/capi-network-uwb.spec b/packaging/capi-network-uwb.spec index 43e9f8c..7fdd500 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.2.0 +Version: 0.2.1 Release: 0 Group: Network & Connectivity/API License: Apache-2.0 diff --git a/src/uwb-private.h b/src/uwb-private.h index 443b9a0..23e5da9 100755 --- a/src/uwb-private.h +++ b/src/uwb-private.h @@ -76,6 +76,8 @@ typedef struct { int range; int aoa; int pdoa; + int filtered_range; + int filtered_aoa; } uwb_node_s; typedef struct { diff --git a/src/uwb-util.c b/src/uwb-util.c index 799e8de..1ed4df9 100755 --- a/src/uwb-util.c +++ b/src/uwb-util.c @@ -75,6 +75,10 @@ uwb_node_s *uwb_util_get_node_from_variant(GVariant *va) node->aoa = g_variant_get_int32(key_value); else if (g_strcmp0(key, "Pdoa") == 0) node->pdoa = g_variant_get_int32(key_value); + else if (g_strcmp0(key, "FilteredRange") == 0) + node->filtered_range = g_variant_get_int32(key_value); + else if (g_strcmp0(key, "FilteredAoa") == 0) + node->filtered_aoa = g_variant_get_int32(key_value); } g_variant_iter_free(iter); diff --git a/src/uwb.c b/src/uwb.c index a39ba3f..d0a840b 100755 --- a/src/uwb.c +++ b/src/uwb.c @@ -915,6 +915,8 @@ EXPORT_API int uwb_node_clone(uwb_node_h src, uwb_node_h *dst) _dst->range = _src->range; _dst->aoa = _src->aoa; _dst->pdoa = _src->pdoa; + _dst->filtered_range = _src->filtered_range; + _dst->filtered_aoa = _src->filtered_aoa; _END(); @@ -1031,6 +1033,7 @@ 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; @@ -1084,6 +1087,41 @@ EXPORT_API int uwb_node_get_pdoa(uwb_node_h node, int *pdoa) return ret; } +EXPORT_API int uwb_node_get_filtered_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)->filtered_range; + + _END(); + + return ret; +} + +EXPORT_API int uwb_node_get_filtered_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)->filtered_aoa; + + _END(); + + return ret; +} + static void __get_network_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { int ret = UWB_ERROR_NONE; diff --git a/tests/capi-network-uwb-test.c b/tests/capi-network-uwb-test.c index d7838df..8e23a4d 100644 --- a/tests/capi-network-uwb-test.c +++ b/tests/capi-network-uwb-test.c @@ -53,6 +53,8 @@ typedef struct { int range; int aoa; int pdoa; + int filtered_range; + int filtered_aoa; } aoa_data_s; typedef void (*free_data_func)(void * user_data); @@ -223,7 +225,13 @@ static void __write_aoa_data(int aoa_data_file, aoa_data_s *aoa_data) if (aoa_data_file == -1) return; - ret = snprintf(buffer, sizeof(buffer), "%d,%d,%d,%d\n", aoa_data->node_id, aoa_data->range, aoa_data->aoa, aoa_data->pdoa); + ret = snprintf(buffer, sizeof(buffer), "%d,%d,%d,%d,%d,%d\n", + aoa_data->node_id, + aoa_data->range, + aoa_data->aoa, + aoa_data->pdoa, + aoa_data->filtered_range, + aoa_data->filtered_aoa); if (ret == 0) return; @@ -912,7 +920,7 @@ static bool __uwb_network_foreach_remote_node_cb( uwb_node_h remote_node, void *user_data) { uint64_t node_id; - int range, aoa, pdoa; + int range, aoa, pdoa, filtered_range, filtered_aoa; if (remote_node == NULL || user_data == NULL) return true; @@ -921,7 +929,10 @@ static bool __uwb_network_foreach_remote_node_cb( uwb_node_get_range(remote_node, &range); uwb_node_get_aoa(remote_node, &aoa); uwb_node_get_pdoa(remote_node, &pdoa); + uwb_node_get_filtered_range(remote_node, &filtered_range); + uwb_node_get_filtered_aoa(remote_node, &filtered_aoa); printf("AoA related Node ID [%lld] range: %d aoa: %d pdoa: %d\n", node_id, range, aoa, pdoa); + printf("AoA filtered values [%lld] range: %d aoa: %d\n", node_id, filtered_range, filtered_aoa); monitor_ctx_s *monitor = (monitor_ctx_s *)user_data; aoa_data_s *data = (aoa_data_s *)calloc(1, sizeof(aoa_data_s)); @@ -932,6 +943,8 @@ static bool __uwb_network_foreach_remote_node_cb( data->range = range; data->aoa = aoa; data->pdoa = pdoa; + data->filtered_range = filtered_range; + data->filtered_aoa = filtered_aoa; sync_queue_push(&monitor->aoa_data_queue, data, free_aoa_data);