1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <aidl/android/hardware/sensors/BnSensors.h>
20 #include "HalProxy.h"
21 
22 namespace aidl {
23 namespace android {
24 namespace hardware {
25 namespace sensors {
26 namespace implementation {
27 
28 class HalProxyAidl : public ::android::hardware::sensors::V2_1::implementation::HalProxy,
29                      public ::aidl::android::hardware::sensors::BnSensors {
30     ::ndk::ScopedAStatus activate(int32_t in_sensorHandle, bool in_enabled) override;
31     ::ndk::ScopedAStatus batch(int32_t in_sensorHandle, int64_t in_samplingPeriodNs,
32                                int64_t in_maxReportLatencyNs) override;
33     ::ndk::ScopedAStatus configDirectReport(
34             int32_t in_sensorHandle, int32_t in_channelHandle,
35             ::aidl::android::hardware::sensors::ISensors::RateLevel in_rate,
36             int32_t* _aidl_return) override;
37     ::ndk::ScopedAStatus flush(int32_t in_sensorHandle) override;
38     ::ndk::ScopedAStatus getSensorsList(
39             std::vector<::aidl::android::hardware::sensors::SensorInfo>* _aidl_return) override;
40     ::ndk::ScopedAStatus initialize(
41             const ::aidl::android::hardware::common::fmq::MQDescriptor<
42                     ::aidl::android::hardware::sensors::Event,
43                     ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>&
44                     in_eventQueueDescriptor,
45             const ::aidl::android::hardware::common::fmq::MQDescriptor<
46                     int32_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>&
47                     in_wakeLockDescriptor,
48             const std::shared_ptr<::aidl::android::hardware::sensors::ISensorsCallback>&
49                     in_sensorsCallback) override;
50     ::ndk::ScopedAStatus injectSensorData(
51             const ::aidl::android::hardware::sensors::Event& in_event) override;
52     ::ndk::ScopedAStatus registerDirectChannel(
53             const ::aidl::android::hardware::sensors::ISensors::SharedMemInfo& in_mem,
54             int32_t* _aidl_return) override;
55     ::ndk::ScopedAStatus setOperationMode(
56             ::aidl::android::hardware::sensors::ISensors::OperationMode in_mode) override;
57     ::ndk::ScopedAStatus unregisterDirectChannel(int32_t in_channelHandle) override;
58 
59     binder_status_t dump(int fd, const char **args, uint32_t numArgs) override;
60 };
61 
62 }  // namespace implementation
63 }  // namespace sensors
64 }  // namespace hardware
65 }  // namespace android
66 }  // namespace aidl
67