Home | History | Annotate | Download | only in sensor
      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 
     47     virtual sp<ISensorEventConnection> createSensorEventConnection(const String8& packageName,
     48              int mode, const String16& opPackageName) = 0;
     49     virtual int32_t isDataInjectionEnabled() = 0;
     50 
     51     virtual sp<ISensorEventConnection> createSensorDirectConnection(const String16& opPackageName,
     52             uint32_t size, int32_t type, int32_t format, const native_handle_t *resource) = 0;
     53 
     54     virtual int setOperationParameter(
     55             int32_t type, const Vector<float> &floats, const Vector<int32_t> &ints) = 0;
     56 };
     57 
     58 // ----------------------------------------------------------------------------
     59 
     60 class BnSensorServer : public BnInterface<ISensorServer>
     61 {
     62 public:
     63     virtual status_t    onTransact( uint32_t code,
     64                                     const Parcel& data,
     65                                     Parcel* reply,
     66                                     uint32_t flags = 0);
     67 };
     68 
     69 // ----------------------------------------------------------------------------
     70 }; // namespace android
     71