sensor HAL v3
Bug: 32021636
Test: no
Change-Id: I7a4c5c47f8621209daef5af4d0dcbb806a236e41
diff --git a/sensors/1.0/default/Sensors.h b/sensors/1.0/default/Sensors.h
new file mode 100644
index 0000000..f9b837d
--- /dev/null
+++ b/sensors/1.0/default/Sensors.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#ifndef HARDWARE_INTERFACES_SENSORS_V1_0_DEFAULT_SENSORS_H_
+
+#define HARDWARE_INTERFACES_SENSORS_V1_0_DEFAULT_SENSORS_H_
+
+#include <android/hardware/sensors/1.0/ISensors.h>
+#include <hardware/sensors.h>
+
+namespace android {
+namespace hardware {
+namespace sensors {
+namespace V1_0 {
+namespace implementation {
+
+struct Sensors : public ::android::hardware::sensors::V1_0::ISensors {
+ Sensors();
+
+ status_t initCheck() const;
+
+ Return<void> getSensorsList(getSensorsList_cb _aidl_cb) override;
+
+ Return<Result> setOperationMode(OperationMode mode) override;
+
+ Return<Result> activate(
+ int32_t sensor_handle, bool enabled) override;
+
+ Return<Result> setDelay(
+ int32_t sensor_handle, int64_t sampling_period_ns) override;
+
+ Return<void> poll(int32_t maxCount, poll_cb _hidl_cb) override;
+
+ Return<Result> batch(
+ int32_t sensor_handle,
+ int32_t flags,
+ int64_t sampling_period_ns,
+ int64_t max_report_latency_ns) override;
+
+ Return<Result> flush(int32_t sensor_handle) override;
+
+ Return<Result> injectSensorData(const Event& event) override;
+
+private:
+ status_t mInitCheck;
+ sensors_module_t *mSensorModule;
+ sensors_poll_device_1_t *mSensorDevice;
+
+ int getHalDeviceVersion() const;
+
+ static void convertFromSensorEvents(
+ size_t count, const sensors_event_t *src, hidl_vec<Event> *dst);
+
+ DISALLOW_COPY_AND_ASSIGN(Sensors);
+};
+
+extern "C" ISensors *HIDL_FETCH_ISensors(const char *name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace sensors
+} // namespace hardware
+} // namespace android
+
+#endif // HARDWARE_INTERFACES_SENSORS_V1_0_DEFAULT_SENSORS_H_