diff options
author | saerome.kim <saerome.kim@samsung.com> | 2019-11-15 16:21:52 +0900 |
---|---|---|
committer | saerome.kim <saerome.kim@samsung.com> | 2019-11-15 19:20:35 +0900 |
commit | a740d8d354800c8ce2e54558fdc4a8cc2dab013b (patch) | |
tree | 742f6c45f854c7eaeb93461dc2705bf834de7d26 | |
parent | fe852679563bdf4b21d84a0b8c818287e94c2831 (diff) | |
download | ua-plugin-wifi-dummy-accepted/tizen_5.5_unified.tar.gz ua-plugin-wifi-dummy-accepted/tizen_5.5_unified.tar.bz2 ua-plugin-wifi-dummy-accepted/tizen_5.5_unified.zip |
Modified to add the last detection time information at the pluginsubmit/tizen_5.5_wearable_hotfix/20201026.184303submit/tizen_5.5/20191115.102057accepted/tizen/5.5/unified/wearable/hotfix/20201027.115104accepted/tizen/5.5/unified/20191118.084844tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5accepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified
- Problem: The function of recording the detection time is required
- Cause: The function to record the recent detection time does not support
in the plugin.
- Solution: Add a function to record the latest detection time.
Change-Id: I3ecfd30706df893293009ccbe37437cbcf1c34f4
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
-rwxr-xr-x[-rw-r--r--] | include/wifi-plugin-util.h | 2 | ||||
-rw-r--r-- | packaging/ua-plugin-wifi-dummy.spec | 4 | ||||
-rw-r--r-- | src/wifi-plugin.c | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | src/wifi-util.c | 15 |
4 files changed, 23 insertions, 3 deletions
diff --git a/include/wifi-plugin-util.h b/include/wifi-plugin-util.h index ba623dc..0aaadd1 100644..100755 --- a/include/wifi-plugin-util.h +++ b/include/wifi-plugin-util.h @@ -46,6 +46,8 @@ uas_device_info_t *_wifi_plugin_util_get_dev_info_from_wifi_info(uas_wifi_info_t void _wifi_plugin_util_uas_device_info_free(uas_device_info_t *device); +unsigned long long _wifi_plugin_util_get_curr_time(void); + #ifdef __cplusplus } #endif diff --git a/packaging/ua-plugin-wifi-dummy.spec b/packaging/ua-plugin-wifi-dummy.spec index 4b30842..0e04bbb 100644 --- a/packaging/ua-plugin-wifi-dummy.spec +++ b/packaging/ua-plugin-wifi-dummy.spec @@ -2,8 +2,8 @@ # should anchor any reverse-dependencies Name: ua-plugin-wifi-dummy -Summary: Wi-Fi User awareness plugin for VD -Version: 0.12.0 +Summary: Wi-Fi User awareness plugin +Version: 0.13.0 Release: 1 License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/wifi-plugin.c b/src/wifi-plugin.c index 931a26f..26e41cb 100644 --- a/src/wifi-plugin.c +++ b/src/wifi-plugin.c @@ -215,6 +215,8 @@ void __check_device_found(char* sbuf, char* ip_sbuf) UA_WIFI_ERR("Unable to get dev_info"); break; } + /* Save current time */ + dev_info->last_seen = _wifi_plugin_util_get_curr_time(); uas_cbs->device_detected_cb(UAS_PRESENCE, dev_info); UA_WIFI_INFO("Called uas_cbs->device_detected_cb(UAS_PRESENCE)"); @@ -316,7 +318,8 @@ static gboolean __add_device_send(gpointer data) free(wifi_info); break; } - + /* Save current time */ + dev_info->last_seen = _wifi_plugin_util_get_curr_time(); uas_cbs->device_added_cb(UAS_STATUS_SUCCESS, dev_info); _wifi_plugin_util_uas_device_info_free(dev_info); break; diff --git a/src/wifi-util.c b/src/wifi-util.c index c54997b..a2b0c4c 100755..100644 --- a/src/wifi-util.c +++ b/src/wifi-util.c @@ -18,6 +18,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <error.h> +#include <sys/time.h> #include <glib.h> #include <wifi-plugin.h> @@ -144,3 +146,16 @@ void _wifi_plugin_util_uas_device_info_free(uas_device_info_t *device) FUNC_EXIT; } + +unsigned long long _wifi_plugin_util_get_curr_time(void) +{ + int ret; + struct timespec t; + + ret = clock_gettime(CLOCK_REALTIME, &t); + if (-1 == ret) { + UA_WIFI_ERR("Failed to call clock_gettime [%d]", errno); + return 0; + } + return ((unsigned long long)(t.tv_sec) * 1000000000LL + t.tv_nsec) / 1000000; +} |