--- /dev/null
+/*
+ * User Awareness Light plugin callback handler
+ *
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Author: Atul Rai <a.rai@samsung.com>
+ *
+ * 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-plugin-manager.h>
+
+void motion_state_changed_callback(int state)
+{
+ FUNC_ENTRY;
+
+ UAM_DBG("Motion: %s", state == UAS_STATE_READY ? "READY" : "NOT_READY");
+
+ FUNC_EXIT;
+}
+
+void motion_detection_callback(uas_detection_type_e type)
+{
+ FUNC_ENTRY;
+
+ UAM_DBG("Motion: %s", type == UAS_PRESENCE ? "PRESENCE" : "ABSENCE");
+
+ FUNC_EXIT;
+}
+
+uas_callbacks_t motion_cbs = {
+ .state_changed_cb = motion_state_changed_callback,
+ .detected_cb = motion_detection_callback,
+ .device_detected_cb = NULL,
+ .device_added_cb = NULL
+};
extern const uas_callbacks_t ble_cbs;
extern const uas_callbacks_t light_cbs;
+extern const uas_callbacks_t motion_cbs;
typedef struct {
void *handle;
available_sensors |= UAM_SENSOR_BITMASK_LIGHT;
break;
+ case UAS_PLUGIN_ID_MOTION:
+ status = plugin->api->init(&motion_cbs);
+ if (UAS_STATUS_SUCCESS != status) {
+ /* Deinit plugin */
+ continue;
+ }
+
+ available_sensors |= UAM_SENSOR_BITMASK_MOTION;
+ break;
default:
UAM_WARN("Unknown plugin %d", id);
break;