Home | History | Annotate | Download | only in gui
      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 #ifndef ANDROID_GUI_SENSOR_MANAGER_H
     18 #define ANDROID_GUI_SENSOR_MANAGER_H
     19 
     20 #include <stdint.h>
     21 #include <sys/types.h>
     22 
     23 #include <utils/Errors.h>
     24 #include <utils/RefBase.h>
     25 #include <utils/Singleton.h>
     26 #include <utils/Vector.h>
     27 
     28 #include <gui/SensorEventQueue.h>
     29 
     30 // ----------------------------------------------------------------------------
     31 // Concrete types for the NDK
     32 struct ASensorManager { };
     33 
     34 // ----------------------------------------------------------------------------
     35 namespace android {
     36 // ----------------------------------------------------------------------------
     37 
     38 class ISensorServer;
     39 class Sensor;
     40 class SensorEventQueue;
     41 
     42 // ----------------------------------------------------------------------------
     43 
     44 class SensorManager : public ASensorManager, public Singleton<SensorManager>
     45 {
     46 public:
     47     SensorManager();
     48     ~SensorManager();
     49 
     50     ssize_t getSensorList(Sensor const* const** list) const;
     51     Sensor const* getDefaultSensor(int type);
     52     sp<SensorEventQueue> createEventQueue();
     53 
     54 private:
     55     sp<ISensorServer> mSensorServer;
     56     Sensor const** mSensorList;
     57     Vector<Sensor> mSensors;
     58 };
     59 
     60 // ----------------------------------------------------------------------------
     61 }; // namespace android
     62 
     63 #endif // ANDROID_GUI_SENSOR_MANAGER_H
     64