Home | History | Annotate | Download | only in dynamic_sensor
      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 #ifndef ANDROID_SENSORHAL_EXT_HIDRAW_SENSOR_DEVICE_H
     17 #define ANDROID_SENSORHAL_EXT_HIDRAW_SENSOR_DEVICE_H
     18 
     19 #include "BaseSensorObject.h"
     20 #include "BaseDynamicSensorDaemon.h" // BaseSensorVector
     21 #include "HidRawDevice.h"
     22 #include "HidRawSensor.h"
     23 
     24 #include <HidParser.h>
     25 #include <utils/Thread.h>
     26 #include <string>
     27 #include <vector>
     28 
     29 namespace android {
     30 namespace SensorHalExt {
     31 
     32 class HidRawSensorDevice : public HidRawDevice, public Thread {
     33 public:
     34     static sp<HidRawSensorDevice> create(const std::string &devName);
     35     virtual ~HidRawSensorDevice();
     36 
     37     // get a list of sensors associated with this device
     38     BaseSensorVector getSensors() const;
     39 private:
     40     static const std::unordered_set<unsigned int> sInterested;
     41 
     42     // constructor will result in +1 strong count
     43     explicit HidRawSensorDevice(const std::string &devName);
     44     // implement function of Thread
     45     virtual bool threadLoop() override;
     46     std::unordered_map<unsigned int/*reportId*/, sp<HidRawSensor>> mSensors;
     47     bool mValid;
     48 };
     49 
     50 } // namespace SensorHalExt
     51 } // namespace android
     52 
     53 #endif // ANDROID_SENSORHAL_EXT_HIDRAW_DEVICE_H
     54 
     55