static unsigned int available_sensors = 0;
extern const uas_callbacks_t ble_cbs;
+extern const uas_callbacks_t wifi_cbs;
extern const uas_callbacks_t light_cbs;
extern const uas_callbacks_t motion_cbs;
available_sensors |= UAM_SENSOR_BITMASK_BLE;
break;
+ case UAS_PLUGIN_ID_WIFI:
+ status = plugin->api->init(&wifi_cbs);
+ if (UAS_STATUS_SUCCESS != status) {
+ /* Deinit plugin */
+ continue;
+ }
+
+ plugin->capability = UAS_NOT_SUPPORT_USER;
+ if (UAS_STATUS_SUCCESS != plugin->api->get_capability(
+ &plugin->capability))
+ plugin->capability = UAS_NOT_SUPPORT_USER;
+
+ available_sensors |= UAM_SENSOR_BITMASK_WIFI;
+ break;
+
case UAS_PLUGIN_ID_LIGHT:
status = plugin->api->init(&light_cbs);
if (UAS_STATUS_SUCCESS != status) {
--- /dev/null
+/*
+ * User Awareness WIFI plugin callback handler
+ *
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <ua-plugin.h>
+#include <ua-manager-core.h>
+#include <ua-plugin-manager.h>
+
+#include "ua-pm-util.h"
+
+static void wifi_state_changed_callback(int state)
+{
+ FUNC_ENTRY;
+ gboolean is_ready = FALSE;
+
+ if (UAS_STATE_READY == state)
+ is_ready = TRUE;
+
+ _uam_core_handle_sensor_ready(UAM_SENSOR_BITMASK_WIFI, is_ready);
+
+ FUNC_EXIT;
+}
+
+static void wifi_lpm_detection_callback(uas_detection_type_e type)
+{
+ FUNC_ENTRY;
+
+ /* Currently, in lpm mode only Presence is detected */
+ if (UAS_PRESENCE == type) {
+ UAM_DBG("Presence detected");
+ _uam_core_handle_presence_detected(UAM_SENSOR_BITMASK_WIFI, -1, NULL);
+ } else {
+ UAM_WARN("Unlikely Absence detected");
+ }
+
+ FUNC_EXIT;
+}
+
+static void wifi_device_detection_callback(uas_detection_type_e type, uas_device_info_t *device)
+{
+ FUNC_ENTRY;
+ uam_device_info_t *dev_info;
+
+ ret_if(NULL == device);
+
+ dev_info = _pm_util_uas_dev_info_to_uam_dev_info(device);
+ ret_if(NULL == dev_info);
+
+ if (UAS_PRESENCE == type) {
+ UAM_DBG("Presence detected for %s", dev_info->device_id);
+ _uam_core_handle_presence_detected(UAM_SENSOR_BITMASK_WIFI, device->user_id, dev_info);
+ } else {
+ UAM_DBG("Absence detected for %s", dev_info->device_id);
+ _uam_core_handle_absence_detected(UAM_SENSOR_BITMASK_WIFI, device->user_id, dev_info);
+ }
+
+ g_free(dev_info);
+ FUNC_EXIT;
+}
+
+static void wifi_device_added_callback(int status, uas_device_info_t *device)
+{
+ FUNC_ENTRY;
+ uam_device_info_t *dev_info;
+
+ ret_if(NULL == device);
+
+ dev_info = _pm_util_uas_dev_info_to_uam_dev_info(device);
+ ret_if(NULL == dev_info);
+
+ dev_info->type = UAM_TECH_TYPE_WIFI;
+ UAM_INFO("Status: %s", _pm_util_uas_status_to_str(status));
+ if (UAS_STATUS_SUCCESS != status)
+ status = UAM_ERROR_INTERNAL;
+ else
+ status = UAM_ERROR_NONE;
+
+ _uam_core_handle_device_added(status, device->user_id, dev_info);
+ g_free(dev_info);
+ FUNC_EXIT;
+}
+
+uas_callbacks_t wifi_cbs = {
+ .state_changed_cb = wifi_state_changed_callback,
+ .detected_cb = wifi_lpm_detection_callback,
+ .device_detected_cb = wifi_device_detection_callback,
+ .device_added_cb = wifi_device_added_callback
+};