CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(sensor-hal-tw3 CXX)
+PROJECT(hal-backend-sensor CXX)
INCLUDE(GNUInstallDirs)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(BINDIR "${PREFIX}/bin")
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${HAL_PKGS_LDFLAGS})
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/sensor)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /hal/lib COMPONENT RuntimeLibraries)
ADD_SUBDIRECTORY(testcase)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gmock)
BuildRequires: sensor-hal-devel
-
+BuildRequires: pkgconfig(hal-api-common)
+BuildRequires: pkgconfig(hal-api-sensor)
%description
TW3 Sensor HAL
%manifest packaging/%{name}.manifest
%{_libdir}/udev/rules.d/99-sensor.rules
%{_libdir}/udev/rules.d/99-sensorhub.rules
-%{_libdir}/sensor/*.so
+/hal/lib/*.so*
%license LICENSE.APLv2
%files haltests
#ifndef __ACCEL_DEVICE_H__
#define __ACCEL_DEVICE_H__
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <string>
#include <vector>
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 <sensor/sensor_hal.h>
-#include <sensor_log.h>
-#include <vector>
-
-#include "accel/accel_device.h"
-#include "gyro/gyro_device.h"
-#include "pressure/pressure_device.h"
-#include "light/light_device.h"
-#include "hrm_raw/hrm_raw_device.h"
-#include "hrm/hrm_device.h"
-#include "sensorhub/sensorhub.h"
-
-static std::vector<sensor_device_t> devs;
-
-template<typename _sensor>
-void create_sensor(const char *name)
-{
- sensor_device *instance = NULL;
- try {
- instance = new _sensor;
- } catch (std::exception &e) {
- ERR("Failed to create %s sensor device, exception: %s", name, e.what());
- return;
- } catch (int err) {
- _ERRNO(err, _E, "Failed to create %s sensor device", name);
- return;
- }
-
- devs.push_back(instance);
-}
-
-extern "C" int create(sensor_device_t **devices)
-{
- create_sensor<accel_device>("Accelerometer");
- create_sensor<gyro_device>("Gyroscope");
- create_sensor<pressure_device>("Pressure");
- create_sensor<light_device>("Light");
- create_sensor<hrm_raw_device>("HRM Raw");
- create_sensor<hrm_device>("HRM");
- create_sensor<sensorhub_device>("Sensorhub");
-
- *devices = &devs[0];
- return devs.size();
-}
#ifndef __GYRO_DEVICE_H__
#define __GYRO_DEVICE_H__
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <string>
#include <vector>
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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 <errno.h>
+#include <hal/hal-sensor-interface.h>
+#include <sensor_log.h>
+#include <stdlib.h>
+
+#include <vector>
+
+#include "accel/accel_device.h"
+#include "gyro/gyro_device.h"
+#include "hrm/hrm_device.h"
+#include "hrm_raw/hrm_raw_device.h"
+#include "light/light_device.h"
+#include "pressure/pressure_device.h"
+#include "sensorhub/sensorhub.h"
+
+static std::vector<sensor_device_t> devs;
+
+template <typename _sensor>
+void create_sensor(const char *name) {
+ sensor_device *instance = NULL;
+ try {
+ instance = new _sensor;
+ } catch (std::exception &e) {
+ ERR("Failed to create %s sensor device, exception: %s", name, e.what());
+ return;
+ } catch (int err) {
+ _ERRNO(err, _E, "Failed to create %s sensor device", name);
+ return;
+ }
+
+ devs.push_back(instance);
+}
+
+static int sensor_tw3_create(sensor_device_t **devices) {
+ create_sensor<accel_device>("Accelerometer");
+ create_sensor<gyro_device>("Gyroscope");
+ create_sensor<pressure_device>("Pressure");
+ create_sensor<light_device>("Light");
+ create_sensor<hrm_raw_device>("HRM Raw");
+ create_sensor<hrm_device>("HRM");
+ create_sensor<sensorhub_device>("Sensorhub");
+
+ *devices = &devs[0];
+ return devs.size();
+}
+
+static int sensor_tw3_init(void **data) {
+ _I("init hal backend sensor");
+ hal_backend_sensor_funcs *funcs;
+
+ funcs =
+ (hal_backend_sensor_funcs *)calloc(1, sizeof(hal_backend_sensor_funcs));
+ if (!funcs) return -ENOMEM;
+
+ funcs->create = sensor_tw3_create;
+
+ *data = (void *)funcs;
+
+ return 0;
+}
+
+static int sensor_tw3_exit(void *data) {
+ if (!data) return -EINVAL;
+ free(data);
+
+ return 0;
+}
+
+extern "C" hal_backend hal_backend_sensor_data = {
+ .name = "sensor-tw3",
+ .vendor = "Tizen",
+ .abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+ .init = sensor_tw3_init,
+ .exit = sensor_tw3_exit,
+};
#ifndef __HRM_DEVICE_H__
#define __HRM_DEVICE_H__
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <string>
#include <vector>
#ifndef __HRM_RAW_DEVICE_H__
#define __HRM_RAW_DEVICE_H__
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <string>
#include <vector>
#ifndef __LIGHT_DEVICE_H__
#define __LIGHT_DEVICE_H__
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <string>
#include <vector>
#ifndef __PRESSURE_DEVICE_H__
#define __PRESSURE_DEVICE_H__
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <string>
#include <vector>
#include <stdlib.h>
#include <sensor_common.h>
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <sensor_log.h>
#include <deque>
#include <util.h>
#include <stdlib.h>
#include <sensor_common.h>
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include <sensor_log.h>
#include <util.h>
#define _SENSORHUB_DEVICE_H_
#include <vector>
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
#include "sensorhub_controller.h"
#include "sensorhub_manager.h"
#ifndef _SENSORHUB_CONTROLLER_H_
#define _SENSORHUB_CONTROLLER_H_
-#include <sensor/sensor_hal.h>
+#include <hal/hal-sensor-interface.h>
class sensorhub_controller {
public: