Provide sensor information in absence callback submit/tizen/20191001.125608
authorAbhay Agarwal <ay.agarwal@samsung.com>
Tue, 1 Oct 2019 06:23:06 +0000 (15:23 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Tue, 1 Oct 2019 12:37:46 +0000 (21:37 +0900)
This commit modifies the absence sensor callback and provides the detected
sensor information to CAPI for environmental sensors.

Change-Id: Ib80eaa7377c69c630bdc76703445f16e23d2fd86
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
packaging/ua-manager.spec
ua-api/src/ua-event-handler.c
ua-daemon/src/ua-manager-core.c

index 751da6f..9d74ef7 100644 (file)
@@ -1,6 +1,6 @@
 Name:       ua-manager
 Summary:    User awareness manager
-Version:    0.10.7
+Version:    0.10.8
 Release:    1
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index caecc48..f371671 100644 (file)
@@ -142,12 +142,31 @@ static void __uam_event_handler(GDBusConnection *connection,
                __uam_send_event(event, result, &sensor_info,
                                event_info->cb, event_info->user_data);
        } else if (0 == strcasecmp(signal_name, UAM_SIGNAL_ABSENCE_DETECTED)) {
+               uam_sensor_info_s sensor_info;
                unsigned int sensor_bitmask;
-               g_variant_get(parameters, "(u)", &sensor_bitmask);
+               long int timestamp;
+               int accuracy, count;
+               double values[UAM_SENSOR_MAX_VALUES];
 
+               g_variant_get(parameters, "(uxiidddd)", &sensor_bitmask, &timestamp,
+                                               &accuracy, &count, &values[0], &values[1],
+                                               &values[2], &values[3]);
+               memset(&sensor_info, 0, sizeof(uam_sensor_info_s));
                event = UAM_EVENT_ABSENCE_DETECTED;
+               sensor_info.sensor_bitmask = sensor_bitmask;
+               sensor_info.timestamp = timestamp;
+               sensor_info.accuracy = accuracy;
+               sensor_info.count = count;
+               for (int i = 0; i < UAM_SENSOR_MAX_VALUES; i++) {
+                       sensor_info.values[i] = values[i];
+               }
 
-               __uam_send_event(event, result, &sensor_bitmask,
+               UAM_DBG("sensor bitmask [%u] timestamp [%ld] accuracy [%d] count [%d] " \
+                               "value0 [%f] value1 [%f] value2 [%f] value3 [%f]",
+                               sensor_info.sensor_bitmask, sensor_info.timestamp,
+                               sensor_info.accuracy, sensor_info.count, sensor_info.values[0],
+                               sensor_info.values[1], sensor_info.values[2], sensor_info.values[3]);
+               __uam_send_event(event, result, &sensor_info,
                                event_info->cb, event_info->user_data);
        } else if (0 == strcasecmp(signal_name, UAM_SIGNAL_SENSOR_STATE_READY)) {
                unsigned int sensor;
index 605f312..c27b2cf 100644 (file)
@@ -2391,7 +2391,9 @@ void __send_sensor_absence_event(uam_sensor_info_s *sensor_info, unsigned int se
 
        if (UAM_SENSOR_BITMASK_LIGHT != sensor) {
                _uam_manager_send_event(NULL, UAM_EVENT_ABSENCE_DETECTED,
-                       g_variant_new("(u)", sensor));
+                       g_variant_new("(uxiidddd)", sensor, sensor_info->timestamp,
+                       sensor_info->accuracy, sensor_info->count, sensor_info->values[0],
+                       sensor_info->values[1], sensor_info->values[2], sensor_info->values[3]));
                UAM_DBG("Sent UAM_EVENT_ABSENCE_DETECTED for 0x%8.8X", sensor);
                FUNC_EXIT;
                return;
@@ -2425,7 +2427,9 @@ void __send_sensor_absence_event(uam_sensor_info_s *sensor_info, unsigned int se
                                continue;
 
                        _uam_manager_send_event(mon->name, UAM_EVENT_ABSENCE_DETECTED,
-                               g_variant_new("(u)", sensor));
+                               g_variant_new("(uxiidddd)", sensor, sensor_info->timestamp,
+                               sensor_info->accuracy, sensor_info->count, sensor_info->values[0],
+                               sensor_info->values[1], sensor_info->values[2], sensor_info->values[3]));
                        UAM_DBG("Sent UAM_EVENT_ABSENCE_DETECTED for 0x%8.8X", sensor);
                }
        }