Add support to report light sensor status change 18/222518/1
authorAbhay Agarwal <ay.agarwal@samsung.com>
Tue, 14 Jan 2020 09:35:31 +0000 (15:05 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 16 Jan 2020 00:02:48 +0000 (09:02 +0900)
This patch add support of light sensor in existing functionality
to report sensor status change to application

Change-Id: Ie237eeecc1fbf15c3ccb08b35b91ec5e597e60d3
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
packaging/ua-manager.spec
ua-daemon/src/pm/ua-light-plugin-handler.c
ua-daemon/src/pm/ua-motion-plugin-handler.c
ua-daemon/src/ua-manager-core.c

index afb09ad..e43a414 100644 (file)
@@ -1,6 +1,6 @@
 Name:       ua-manager
 Summary:    User awareness manager
-Version:    0.13.17
+Version:    0.13.19
 Release:    1
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 0dcdb9a..5bb2ed9 100644 (file)
@@ -43,6 +43,27 @@ static void light_detection_state_changed_cb(int state)
        FUNC_EXIT;
 }
 
+static void light_detection_status_changed_cb(uas_detection_type_e type,
+       void *sensor_info)
+{
+       FUNC_ENTRY;
+
+       uas_sensor_info_t *info = NULL;
+       uam_sensor_info_s *light_info = NULL;
+
+       UAM_DBG("Light: %s", type == UAS_PRESENCE ? "PRESENCE" : "ABSENCE");
+
+       if (sensor_info)
+               info = sensor_info;
+       light_info = _pm_util_uas_sensor_info_to_uam_sensor_info(info);
+
+       _uam_core_handle_status_changed(UAM_SENSOR_BITMASK_LIGHT, light_info);
+
+       g_free(light_info);
+
+       FUNC_EXIT;
+}
+
 void light_detection_callback(uas_detection_type_e type, void *sensor_info)
 {
        FUNC_ENTRY;
@@ -74,7 +95,7 @@ void light_detection_callback(uas_detection_type_e type, void *sensor_info)
 uas_callbacks_t light_cbs = {
        .state_changed_cb = light_state_changed_callback,
        .detection_state_cb = light_detection_state_changed_cb,
-       .detection_status_cb = NULL,
+       .detection_status_cb = light_detection_status_changed_cb,
        .detected_cb = light_detection_callback,
        .device_detected_cb = NULL,
        .device_added_cb = NULL,
index 195d5e1..0bf1848 100644 (file)
@@ -43,7 +43,6 @@ static void motion_detection_state_changed_cb(int state)
        FUNC_EXIT;
 }
 
-
 static void motion_detection_status_changed_cb(uas_detection_type_e type,
        void *sensor_info)
 {
index 96421a4..f6965f1 100644 (file)
@@ -4118,11 +4118,10 @@ void _uam_core_handle_status_changed(unsigned int sensor, void *info)
 
        ret_if(NULL == info);
 
-       UAM_DBG("%d %d %llu %d %d", sensor, sensor_info->status, sensor_info->timestamp,
-               sensor_info->accuracy, sensor_info->count);
-
        UAM_INFO("sensor: 0x%8.8X %s", sensor, sensor_info->status == UAS_ABSENCE ?
                "UAM_EVENT_ABSENCE_DETECTED" : "UAM_EVENT_PRESENCE_DETECTED");
+       UAM_DBG("%llu %d %d", sensor_info->timestamp,
+               sensor_info->accuracy, sensor_info->count);
 
        _uam_manager_send_event(NULL, UAM_EVENT_SENSOR_STATUS_CHANGED,
                g_variant_new("(uutiidddd)", sensor, sensor_info->status, sensor_info->timestamp,