• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 #ifndef ANDROID_FRAMEWORKS_SENSORSERVICE_V1_0_EVENTQUEUE_H
18 #define ANDROID_FRAMEWORKS_SENSORSERVICE_V1_0_EVENTQUEUE_H
19 
20 #include "SensorManager.h"
21 
22 #include <android/frameworks/sensorservice/1.0/IEventQueue.h>
23 #include <android/frameworks/sensorservice/1.0/IEventQueueCallback.h>
24 #include <hidl/MQDescriptor.h>
25 #include <hidl/Status.h>
26 #include <sensor/SensorManager.h>
27 
28 namespace android {
29 namespace frameworks {
30 namespace sensorservice {
31 namespace V1_0 {
32 namespace implementation {
33 
34 using ::android::frameworks::sensorservice::V1_0::IEventQueue;
35 using ::android::frameworks::sensorservice::V1_0::IEventQueueCallback;
36 using ::android::frameworks::sensorservice::V1_0::Result;
37 using ::android::hardware::Return;
38 using ::android::sp;
39 
40 struct EventQueue final : public IEventQueue {
41     EventQueue(
42         sp<IEventQueueCallback> callback,
43         sp<::android::Looper> looper,
44         sp<::android::SensorEventQueue> internalQueue);
45     void onLastStrongRef(const void *) override;
46 
47     // Methods from ::android::frameworks::sensorservice::V1_0::IEventQueue follow.
48     Return<Result> enableSensor(int32_t sensorHandle, int32_t samplingPeriodUs, int64_t maxBatchReportLatencyUs) override;
49     Return<Result> disableSensor(int32_t sensorHandle) override;
50 
51 private:
52     friend class EventQueueLooperCallback;
53     sp<::android::Looper> mLooper;
54     sp<::android::SensorEventQueue> mInternalQueue;
55 };
56 
57 }  // namespace implementation
58 }  // namespace V1_0
59 }  // namespace sensorservice
60 }  // namespace frameworks
61 }  // namespace android
62 
63 #endif  // ANDROID_FRAMEWORKS_SENSORSERVICE_V1_0_EVENTQUEUE_H
64