*/
uam_tech_type_e _ua_to_uam_tech_type(ua_mac_type_e type);
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @internal
+ * @brief Converts device's tech. type enum to sensor bitmask enum.
+ * @since_tizen 5.5
+ *
+ * @remarks The returned value can be used until return call function is valid.
+ *
+ * @param[in] type Tech code to be converted.
+ *
+ * @return Sensor bitmask
+ *
+ * @retval #UA_SENSOR_BT Bluetooth
+ * @retval #UA_SENSOR_BLE Bluetooth Low Energy
+ * @retval #UA_SENSOR_WIFI Wi-Fi
+ * @retval #UA_SENSOR_MAX Invalid
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ */
+ua_sensor_e _ua_dev_type_to_sensor(ua_mac_type_e type);
+
#ifdef __cplusplus
}
#endif
UA_WARN("Unknown sensor bitmask [0x%8.8X]", bitmask);
return UA_SENSOR_MAX;
}
+ FUNC_EXIT;
}
/* LCOV_EXCL_STOP */
FUNC_ENTRY;
unsigned int env_presence_bitmask = 0;
unsigned int user_sensor_bitmask = user_state->sensor_bitmask;
+ unsigned int filter_bitmask = 0;
+ unsigned int dev_bitmask = 0;
+ GSList *l = 0;
+ GSList *devices = 0;
gboolean and_condition = 0;
gboolean or_condition = 0;
gboolean condition_result = 0;
+ ua_dev_info_s *dev = 0;
+
ret_if(NULL == user_state);
ua_user_h user_handle = _ua_get_user_handle_by_account(
user_state->account);
env_presence_bitmask = monitor->presence_detected_bitmask
& (UA_SENSOR_MOTION | UA_SENSOR_LIGHT);
+ filter_bitmask =
+ monitor->presence_bitmask_and | monitor->presence_bitmask_or;
/**
* Check whether user_handle present or not and also check
return;
}
+ /**
+ * Filter the list of found_devices according to sensors mentioned in
+ * AND/OR conditions.
+ */
+ for (l = user_state->found_devices; l; l = g_slist_next(l)) {
+ dev = (ua_dev_info_s *)l->data;
+ if(!dev)
+ continue;
+
+ UA_DBG("device id [%s], dev type [%u]", dev->device_id, dev->type);
+
+ dev_bitmask = _ua_dev_type_to_sensor(dev->type);
+ if (dev_bitmask & filter_bitmask)
+ devices = g_slist_prepend(devices, dev);
+ }
+
((ua_presence_user_detected_cb)monitor->presence_user_cb.callback)(
UA_ERROR_NONE, monitor, user_handle,
- user_state->found_devices,
+ devices,
monitor->presence_user_cb.user_data);
user_state->cb_sent = TRUE;
+
+ g_slist_free(devices);
+
FUNC_EXIT;
return;
}