Change the last seen that has never been added or detected by the service to 0
authorsaerome.kim <saerome.kim@samsung.com>
Thu, 21 Nov 2019 04:39:37 +0000 (13:39 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 21 Nov 2019 05:37:20 +0000 (14:37 +0900)
- Problem: The last_seen information may not be 0 even if the service is not executed.
- Cause: We are adding the last_seen info regardless the service.
- Solution: The device information added to the service is initialized to 0.

Change-Id: I14249599db420b25e47098c83eaa17ed1d65182e
Signed-off-by: Lokesh <l.kasana@samsung.com>
ua-daemon/src/ua-manager-core.c

index 2170cfc..94fa9a3 100644 (file)
@@ -2587,7 +2587,7 @@ int _uam_core_handle_device_added(int status,
 
        /* Add device to database */
        ret = _uam_device_db_insert_device_info(user->user_id, dev_info,
-                       UAM_PRESENCE_STATE_PRESENT, 0);
+                       UAM_PRESENCE_STATE_PRESENT, dev_info->last_seen);
        if (UAM_ERROR_NONE != ret) {
                UAM_WARN("Device addition to persistent DB failed");
                __uam_db_end_transaction(0);
@@ -2598,7 +2598,7 @@ int _uam_core_handle_device_added(int status,
        ret =  _uam_db_insert_device_service_info(
                                dev_info->device_id, dev_info->type, dev_info->mac,
                                UAM_SERVICE_DEFAULT, UAM_DETECTION_CYCLE_DEFAULT,
-                               dev_info->discriminant, dev_info->last_seen);
+                               dev_info->discriminant, 0);
        if (UAM_ERROR_NONE != ret) {
                UAM_WARN("Device service addition to persistent DB failed");
                __send_device_event(ret, UAM_EVENT_DEVICE_ADDED, dev_info);
@@ -2608,7 +2608,7 @@ int _uam_core_handle_device_added(int status,
        __uam_db_end_transaction(1);
 
        ret = _uam_core_update_svc_dev_info(dev_info->device_id, dev_info->type,
-                               UAM_SERVICE_DEFAULT, dev_info->discriminant, dev_info->last_seen);
+                               UAM_SERVICE_DEFAULT, dev_info->discriminant, 0);
        if (UAM_ERROR_NONE != ret) {
                UAM_WARN("Device service mappiing update failed");
                __send_device_event(ret, UAM_EVENT_DEVICE_ADDED, dev_info);