• 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/Vector.h>
25 
26 #include <binder/IInterface.h>
27 
28 struct native_handle;
29 typedef struct native_handle native_handle_t;
30 namespace android {
31 // ----------------------------------------------------------------------------
32 
33 class ISensorEventConnection;
34 class Parcel;
35 class Sensor;
36 class String8;
37 class String16;
38 
39 class ISensorServer : public IInterface
40 {
41 public:
42     DECLARE_META_INTERFACE(SensorServer)
43 
44     virtual Vector<Sensor> getSensorList(const String16& opPackageName) = 0;
45     virtual Vector<Sensor> getDynamicSensorList(const String16& opPackageName) = 0;
46     virtual Vector<Sensor> getRuntimeSensorList(const String16& opPackageName, int deviceId) = 0;
47 
48     virtual sp<ISensorEventConnection> createSensorEventConnection(const String8& packageName,
49              int mode, const String16& opPackageName, const String16& attributionTag) = 0;
50     virtual int32_t isDataInjectionEnabled() = 0;
51 
52     virtual sp<ISensorEventConnection> createSensorDirectConnection(const String16& opPackageName,
53             int deviceId, uint32_t size, int32_t type, int32_t format,
54             const native_handle_t *resource) = 0;
55 
56     virtual int setOperationParameter(
57             int32_t handle, int32_t type, const Vector<float> &floats, const Vector<int32_t> &ints) = 0;
58 };
59 
60 // ----------------------------------------------------------------------------
61 
62 class BnSensorServer : public BnInterface<ISensorServer>
63 {
64 public:
65     virtual status_t shellCommand(int in, int out, int err,
66                                   Vector<String16>& args) = 0;
67 
68     virtual status_t    onTransact( uint32_t code,
69                                     const Parcel& data,
70                                     Parcel* reply,
71                                     uint32_t flags = 0);
72 };
73 
74 // ----------------------------------------------------------------------------
75 }; // namespace android
76