Modified to add the last detection time information at the plugin accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191118.084844 accepted/tizen/5.5/unified/wearable/hotfix/20201027.115104 submit/tizen_5.5/20191115.102057 submit/tizen_5.5_wearable_hotfix/20201026.184303
authorsaerome.kim <saerome.kim@samsung.com>
Fri, 15 Nov 2019 07:21:52 +0000 (16:21 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Fri, 15 Nov 2019 10:20:35 +0000 (19:20 +0900)
- 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>
include/wifi-plugin-util.h [changed mode: 0644->0755]
packaging/ua-plugin-wifi-dummy.spec
src/wifi-plugin.c
src/wifi-util.c [changed mode: 0755->0644]

old mode 100644 (file)
new mode 100755 (executable)
index ba623dc..0aaadd1
@@ -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
index 4b30842..0e04bbb 100644 (file)
@@ -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
index 931a26f..26e41cb 100644 (file)
@@ -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;
old mode 100755 (executable)
new mode 100644 (file)
index c54997b..a2b0c4c
@@ -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;
+}