• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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 <stdint.h>
20 #include <sys/types.h>
21 
22 #include <utils/Errors.h>
23 #include <utils/StrongPointer.h>
24 #include <utils/Timers.h>
25 
26 #include <binder/IInterface.h>
27 
28 namespace android {
29 // ----------------------------------------------------------------------------
30 
31 class BitTube;
32 class Parcel;
33 
34 class ISensorEventConnection : public IInterface
35 {
36 public:
37     DECLARE_META_INTERFACE(SensorEventConnection)
38 
39     virtual sp<BitTube> getSensorChannel() const = 0;
40     virtual status_t enableDisable(int handle, bool enabled, nsecs_t samplingPeriodNs,
41                                    nsecs_t maxBatchReportLatencyNs, int reservedFlags) = 0;
42     virtual status_t setEventRate(int handle, nsecs_t ns) = 0;
43     virtual status_t flush() = 0;
44     virtual int32_t configureChannel(int32_t handle, int32_t rateLevel) = 0;
45 protected:
46     virtual void destroy() = 0; // synchronously release resource hold by remote object
47 };
48 
49 // ----------------------------------------------------------------------------
50 
51 class BnSensorEventConnection : public BnInterface<ISensorEventConnection>
52 {
53 public:
54     virtual status_t    onTransact( uint32_t code,
55                                     const Parcel& data,
56                                     Parcel* reply,
57                                     uint32_t flags = 0);
58 };
59 
60 // ----------------------------------------------------------------------------
61 }; // namespace android
62