} uam_presence_state_e;
/**
+ * @brief Enumerations for detection cycle state.
+ * @since_tizen 5.5
+ */
+typedef enum {
+ UAM_DETECTION_CYCLE_MID = 0x00, /**< Invaild state */
+ UAM_DETECTION_CYCLE_END, /**< Presence state */
+} uam_cycle_state_e;
+
+/**
* @brief Enumerations for OS type.
* @since_tizen 5.5
*/
} uam_user_event_data_s;
/**
+ * @brief Detection stopped event structure.
+ * @since_tizen 5.5
+ */
+typedef struct {
+ char service[UAM_SERVICE_MAX_STRING_LEN]; /**< Service name */
+ uam_cycle_state_e cycle_state; /**< detection cycle state */
+} uam_detection_stopped_event_data_s;
+
+/**
* @brief Application info structure.
* @since_tizen 5.5
*/
__uam_send_event(UAM_EVENT_DETECTION_STARTED, result, NULL,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_DETECTION_STOPPED)) {
- __uam_send_event(UAM_EVENT_DETECTION_STOPPED, result, NULL,
+ uam_detection_stopped_event_data_s event_data;
+ char *svc_name = NULL;
+ uam_cycle_state_e cycle_state;
+
+ g_variant_get(parameters, "(&si)", &svc_name, &cycle_state);
+
+ UAM_DBG("Service: %s, cycle_state: %s", svc_name,
+ cycle_state ? "end" : "mid");
+
+ g_strlcpy(event_data.service, svc_name, UAM_SERVICE_MAX_STRING_LEN);
+ event_data.cycle_state = cycle_state;
+
+ __uam_send_event(UAM_EVENT_DETECTION_STOPPED, result, &event_data,
event_info->cb, event_info->user_data);
} else if (0 == strcasecmp(signal_name, UAM_SIGNAL_DEVICE_FOUND)) {
uam_device_info_s dev_info;
void _uam_core_handle_detection_stopped(unsigned int sensor)
{
FUNC_ENTRY;
+
uam_tech_type_e type = UAM_TECH_TYPE_NONE;
+ uam_cycle_state_e cycle_state;
+ GSList *l = NULL;
ret_if((detecting_sensors & sensor) == 0);
UAM_DBG("Sensor: 0x%8.8X, detecting_sensors: 0x%8.8X",
if (UAM_TECH_TYPE_NONE != type)
__send_user_absence_event(type, sensor);
- if (0 == detecting_sensors)
+ if (0 == detecting_sensors) {
/* Send detection stopped event */
- _uam_manager_send_event(NULL, UAM_EVENT_DETECTION_STOPPED, NULL);
+ for (l = monitors; l; l = g_slist_next(l)) {
+ uam_monitor_info_t *mon = l->data;
+
+ if (!mon || !mon->name || !mon->service)
+ continue;
+ uam_db_service_info_t *service = mon->service;
+ UAM_DBG("service->remaining_time: %d", service->remaining_time);
+ cycle_state = (service->remaining_time <= UAM_DETECTION_CYCLE_MIN) ?
+ UAM_DETECTION_CYCLE_END : UAM_DETECTION_CYCLE_MID;
+
+ _uam_manager_send_event(mon->name, UAM_EVENT_DETECTION_STOPPED,
+ g_variant_new("(si)", service->name, cycle_state));
+ UAM_DBG("Sent UAM_EVENT_DETECTION_STOPPED to %s, Service: %s,"
+ " cycle state:[%s]",
+ mon->name, service->name, cycle_state ? "end" : "mid");
+ }
+ }
FUNC_EXIT;
}