diff options
author | saerome.kim <saerome.kim@samsung.com> | 2019-10-21 21:00:23 +0900 |
---|---|---|
committer | saerome.kim <saerome.kim@samsung.com> | 2019-11-01 12:49:18 +0900 |
commit | 412d4a32c01831b15879f7d19d3041e62095f9cb (patch) | |
tree | 0660b64bceb279395728707409f8dd8f3ab30be1 | |
parent | d9a8ff5283b54bdc59d2c75b578e7549bebe1934 (diff) | |
download | user-awareness-412d4a32c01831b15879f7d19d3041e62095f9cb.tar.gz user-awareness-412d4a32c01831b15879f7d19d3041e62095f9cb.tar.bz2 user-awareness-412d4a32c01831b15879f7d19d3041e62095f9cb.zip |
Fix the problem that the SF and UAF use different data format
- Problem: The data format of timestamp is not different from the sensor
framework.
- Cause: The UAF uses 32 bit timestamp but the sensor framework uses 64
bit timestamp.
- Solution: Change timestamps in UAF with 64-bit unsigned long long.
Change-Id: I174627c17a17e5f59c2f9c04ed78f81b12ff0ebe
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
-rw-r--r-- | include/user-awareness-private.h | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | include/user-awareness.h | 6 | ||||
-rw-r--r-- | packaging/capi-network-ua.spec | 2 | ||||
-rw-r--r-- | src/user-awareness-device.c | 2 | ||||
-rw-r--r-- | src/user-awareness-event-handler.c | 6 | ||||
-rw-r--r-- | src/user-awareness-users.c | 2 | ||||
-rw-r--r-- | src/user-awareness-util.c | 2 | ||||
-rw-r--r-- | test/uat-detections.c | 4 | ||||
-rw-r--r-- | test/uat-devices.c | 8 | ||||
-rw-r--r-- | test/uat-init.c | 8 | ||||
-rw-r--r-- | test/uat-users.c | 4 |
11 files changed, 29 insertions, 29 deletions
diff --git a/include/user-awareness-private.h b/include/user-awareness-private.h index 7e6478e..0a507f5 100644 --- a/include/user-awareness-private.h +++ b/include/user-awareness-private.h @@ -202,12 +202,12 @@ typedef struct { */ typedef struct { unsigned int status; /**< Sensor status 1:PRESENCE 2:ABSENCE */ - ua_sensor_h handle; - ua_sensor_e bitmask; - long int timestamp; - int accuracy; - int count; - double *values; + ua_sensor_h handle; /**< Sensor handle */ + ua_sensor_e bitmask; /**< Sensor bitmask */ + unsigned long long timestamp; /**< Timestamp */ + int accuracy; /**< Accuracty from sensor device */ + int count; /**< How many sensor data included */ + double *values; /**< Sensor data */ } ua_sensor_info_s; /** @@ -304,7 +304,7 @@ typedef struct { gboolean isadded; /**< Is the device addition completed? */ gboolean create_by_app; /**< Did app add this device information? */ gboolean discriminant; /**< Determines whether to judge PRESENCE/ABSENCE */ - long last_presence_timestamp; /**< timestamp of last presence */ + unsigned long long last_presence_timestamp; /**< timestamp of last presence */ ua_ble_payload_s *payload; /**< BLE payload to filter device*/ } ua_dev_info_s; diff --git a/include/user-awareness.h b/include/user-awareness.h index 839f7d8..53bd1ad 100644..100755 --- a/include/user-awareness.h +++ b/include/user-awareness.h @@ -1489,7 +1489,7 @@ int ua_user_get_name( * @post * */ -int ua_user_get_last_presence(ua_user_h user_handle, long *timestamp); +int ua_user_get_last_presence(ua_user_h user_handle, unsigned long long *timestamp); /** * @ingroup CAPI_NETWORK_UA_MODULE @@ -2432,7 +2432,7 @@ int ua_device_get_wifi_ipv4_address( */ int ua_device_get_last_presence( ua_device_h device_handle, - long *timestamp); + unsigned long long *timestamp); /** * @ingroup CAPI_NETWORK_UA_MODULE @@ -2893,7 +2893,7 @@ int ua_device_foreach_added_by_user( */ int ua_sensor_get_timestamp( ua_sensor_h sensor_handle, - long int *timestamp); + unsigned long long *timestamp); /** * @ingroup CAPI_NETWORK_UA_MODULE diff --git a/packaging/capi-network-ua.spec b/packaging/capi-network-ua.spec index 5e4cc8d..8d926e5 100644 --- a/packaging/capi-network-ua.spec +++ b/packaging/capi-network-ua.spec @@ -1,6 +1,6 @@ Name: capi-network-ua Summary: User Awareness Framework CAPI -Version: 0.12.0 +Version: 0.12.1 Release: 1 License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/user-awareness-device.c b/src/user-awareness-device.c index 7b71a13..2bc9308 100644 --- a/src/user-awareness-device.c +++ b/src/user-awareness-device.c @@ -920,7 +920,7 @@ int ua_device_get_discriminant( int ua_device_get_last_presence( ua_device_h device_handle, - long *timestamp) + unsigned long long *timestamp) { FUNC_ENTRY; ua_dev_info_s *device = (ua_dev_info_s *)device_handle; diff --git a/src/user-awareness-event-handler.c b/src/user-awareness-event-handler.c index 3223f1d..1c0f3a5 100644 --- a/src/user-awareness-event-handler.c +++ b/src/user-awareness-event-handler.c @@ -91,7 +91,7 @@ static void __ua_event_handler(int event, uam_event_data_s *event_param, sensor_info = event_param->data; ret_if(NULL == sensor_info); - UA_INFO("sensor: [%u], timestamp [%ld], accuracy [%d], value [%f]", + UA_INFO("sensor: [%u], timestamp [%llu], accuracy [%d], value [%f]", sensor_info->sensor_bitmask, sensor_info->timestamp, sensor_info->accuracy, sensor_info->values[0]); _ua_monitor_handle_user_presence_detected(sensor_info, NULL, @@ -105,7 +105,7 @@ static void __ua_event_handler(int event, uam_event_data_s *event_param, sensor_info = event_param->data; ret_if(NULL == sensor_info); - UA_INFO("sensor: [%u], timestamp [%ld], accuracy [%d], value [%f]", + UA_INFO("sensor: [%u], timestamp [%llu], accuracy [%d], value [%f]", sensor_info->sensor_bitmask, sensor_info->timestamp, sensor_info->accuracy, sensor_info->values[0]); _ua_monitor_handle_user_absence_detected(sensor_info, NULL, NULL); @@ -118,7 +118,7 @@ static void __ua_event_handler(int event, uam_event_data_s *event_param, sensor_info = event_param->data; ret_if(NULL == sensor_info); - UA_INFO("status [%d] sensor: [%u], timestamp [%ld], accuracy [%d], value [%f]", + UA_INFO("status [%d] sensor: [%u], timestamp [%llu], accuracy [%d], value [%f]", sensor_info->status, sensor_info->sensor_bitmask, sensor_info->timestamp, sensor_info->accuracy, sensor_info->values[0]); diff --git a/src/user-awareness-users.c b/src/user-awareness-users.c index 057fefa..4a5a98e 100644 --- a/src/user-awareness-users.c +++ b/src/user-awareness-users.c @@ -668,7 +668,7 @@ int ua_user_get_name( return UA_ERROR_NONE; } -int ua_user_get_last_presence(ua_user_h user_handle, long *timestamp) +int ua_user_get_last_presence(ua_user_h user_handle, unsigned long long *timestamp) { FUNC_ENTRY; ua_user_info_s *user = (ua_user_info_s *)user_handle; diff --git a/src/user-awareness-util.c b/src/user-awareness-util.c index d066063..40dc102 100644 --- a/src/user-awareness-util.c +++ b/src/user-awareness-util.c @@ -362,7 +362,7 @@ GSList *ua_sensor_get_sensor_handle_list( int ua_sensor_get_timestamp( ua_sensor_h sensor_handle, - long int *timestamp) + unsigned long long *timestamp) { FUNC_ENTRY; ua_sensor_info_s *sensor; diff --git a/test/uat-detections.c b/test/uat-detections.c index ce0476c..b0b24b3 100644 --- a/test/uat-detections.c +++ b/test/uat-detections.c @@ -79,7 +79,7 @@ static void __sensor_presence_detected_sensor_info(ua_sensor_e sensor, int ret; char buf[MENU_DATA_SIZE] = {0, }; char final_buf[MENU_DATA_SIZE * 4] = {0, }; - long int timestamp; + unsigned long long timestamp; int info_count = 0; GSList *values = NULL; double *value; @@ -108,7 +108,7 @@ static void __sensor_presence_detected_sensor_info(ua_sensor_e sensor, strncat(final_buf, buf, sizeof(buf) - strlen(buf) - 1); memset(buf, 0, MENU_DATA_SIZE); } - msgb("[%s] information detected at timestamp [%ld] value [%s]", + msgb("[%s] information detected at timestamp [%llu] value [%s]", uat_get_sensor_bitmask_str(sensor), timestamp, final_buf); diff --git a/test/uat-devices.c b/test/uat-devices.c index 6b71985..75e4087 100644 --- a/test/uat-devices.c +++ b/test/uat-devices.c @@ -157,7 +157,7 @@ static bool __foreach_added_device_cb( char *wifi_bssid = NULL; char *ipv4 = NULL; bool required = false; - long timestamp = 0; + unsigned long long timestamp = 0; bool discriminant = false; char service_id = 0; char device_icon = 0; @@ -218,7 +218,7 @@ static bool __foreach_added_device_cb( ret_temp = ua_device_get_last_presence(handle, ×tamp); if (UA_ERROR_NONE == ret_temp) - msgb("Last present at : %ld", timestamp); + msgb("Last present at : %llu", timestamp); ret_temp = ua_device_get_payload_service_id(handle, &service_id); if (UA_ERROR_NONE == ret_temp) @@ -259,7 +259,7 @@ static bool __service_foreach_added_device_cb( char *ipv4 = NULL; bool required = false; bool discriminant = false; - long timestamp = 0; + unsigned long long timestamp = 0; char service_id = 0; char device_icon = 0; char purpose = 0; @@ -322,7 +322,7 @@ static bool __service_foreach_added_device_cb( ret_temp = ua_device_get_last_presence(handle, ×tamp); if (UA_ERROR_NONE == ret_temp) - msgb("Last present at : %ld", timestamp); + msgb("Last present at : %llu", timestamp); ret_temp = ua_device_get_payload_service_id(handle, &service_id); if (UA_ERROR_NONE == ret_temp) diff --git a/test/uat-init.c b/test/uat-init.c index 10a0fad..508168b 100644 --- a/test/uat-init.c +++ b/test/uat-init.c @@ -44,7 +44,7 @@ static void __user_detected_foreach_sensors(gpointer data, int ret; char buf[MENU_DATA_SIZE] = {0, }; char final_buf[MENU_DATA_SIZE * 4] = {0, }; - long int timestamp; + unsigned long long timestamp; int info_count = 0; GSList *values = NULL; double *value; @@ -81,7 +81,7 @@ static void __user_detected_foreach_sensors(gpointer data, strncat(final_buf, buf, sizeof(buf) - strlen(buf) - 1); memset(buf, 0, MENU_DATA_SIZE); } - msgb("[%s] information detected at timestamp [%ld] value [%s]", + msgb("[%s] information detected at timestamp [%llu] value [%s]", uat_get_sensor_bitmask_str(bitmask), timestamp, final_buf); @@ -199,7 +199,7 @@ static void __sensor_status_changed_cb(ua_sensor_status_e status, int ret; double *value; GSList *l = 0; - long int timestamp; + unsigned long long timestamp; int info_count = 0; ua_sensor_e sensor; GSList *values = NULL; @@ -240,7 +240,7 @@ static void __sensor_status_changed_cb(ua_sensor_status_e status, strncat(final_buf, buf, sizeof(buf) - strlen(buf) - 1); memset(buf, 0, MENU_DATA_SIZE); } - msgr("[%s] information detected at timestamp [%ld] value [%s]", + msgr("[%s] information detected at timestamp [%llu] value [%s]", uat_get_sensor_bitmask_str(sensor), timestamp, final_buf); g_slist_free(values); diff --git a/test/uat-users.c b/test/uat-users.c index fbd7df2..5e82157 100644 --- a/test/uat-users.c +++ b/test/uat-users.c @@ -89,7 +89,7 @@ static bool __foreach_registered_user_cb( char *account = NULL; char *name = NULL; - long timestamp = 0; + unsigned long long timestamp = 0; if (user_handle) { @@ -111,7 +111,7 @@ static bool __foreach_registered_user_cb( ret = ua_user_get_last_presence(user_handle, ×tamp); if (UA_ERROR_NONE == ret) - msgb("last present at %ld", timestamp); + msgb("last present at %llu", timestamp); } return true; |