• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 _GTS_NANOAPPS_GENERAL_TEST_BASIC_SENSOR_TESTS_H_
18 #define _GTS_NANOAPPS_GENERAL_TEST_BASIC_SENSOR_TESTS_H_
19 
20 #include <general_test/basic_sensor_test_base.h>
21 
22 #include <chre.h>
23 
24 namespace general_test {
25 
26 class BasicAccelerometerTest : public BasicSensorTestBase {
27  public:
BasicAccelerometerTest()28   BasicAccelerometerTest() : BasicSensorTestBase() {}
29 
30  protected:
getSensorType()31   uint8_t getSensorType() const override {
32     return CHRE_SENSOR_TYPE_ACCELEROMETER;
33   }
isOnChangeSensor()34   bool isOnChangeSensor() const override {
35     return false;
36   }
isOneShotSensor()37   bool isOneShotSensor() const override {
38     return false;
39   }
40   void confirmDataIsSane(const void *eventData) override;
41 };
42 
43 class BasicInstantMotionDetectTest : public BasicSensorTestBase {
44  public:
BasicInstantMotionDetectTest()45   BasicInstantMotionDetectTest() : BasicSensorTestBase() {}
46 
47  protected:
getSensorType()48   uint8_t getSensorType() const override {
49     return CHRE_SENSOR_TYPE_INSTANT_MOTION_DETECT;
50   }
isOnChangeSensor()51   bool isOnChangeSensor() const override {
52     return false;
53   }
isOneShotSensor()54   bool isOneShotSensor() const override {
55     return true;
56   }
57   void confirmDataIsSane(const void *eventData) override;
58 };
59 
60 class BasicStationaryDetectTest : public BasicSensorTestBase {
61  public:
BasicStationaryDetectTest()62   BasicStationaryDetectTest() : BasicSensorTestBase() {}
63 
64  protected:
getSensorType()65   uint8_t getSensorType() const override {
66     return CHRE_SENSOR_TYPE_STATIONARY_DETECT;
67   }
isOnChangeSensor()68   bool isOnChangeSensor() const override {
69     return false;
70   }
isOneShotSensor()71   bool isOneShotSensor() const override {
72     return true;
73   }
74   void confirmDataIsSane(const void *eventData) override;
75 };
76 
77 class BasicGyroscopeTest : public BasicSensorTestBase {
78  public:
BasicGyroscopeTest()79   BasicGyroscopeTest() : BasicSensorTestBase() {}
80 
81  protected:
getSensorType()82   uint8_t getSensorType() const override {
83     return CHRE_SENSOR_TYPE_GYROSCOPE;
84   }
isOnChangeSensor()85   bool isOnChangeSensor() const override {
86     return false;
87   }
isOneShotSensor()88   bool isOneShotSensor() const override {
89     return false;
90   }
91   void confirmDataIsSane(const void *eventData) override;
92 };
93 
94 class BasicMagnetometerTest : public BasicSensorTestBase {
95  public:
BasicMagnetometerTest()96   BasicMagnetometerTest() : BasicSensorTestBase() {}
97 
98  protected:
getSensorType()99   uint8_t getSensorType() const override {
100     return CHRE_SENSOR_TYPE_GEOMAGNETIC_FIELD;
101   }
isOnChangeSensor()102   bool isOnChangeSensor() const override {
103     return false;
104   }
isOneShotSensor()105   bool isOneShotSensor() const override {
106     return false;
107   }
108   void confirmDataIsSane(const void *eventData) override;
109 };
110 
111 class BasicBarometerTest : public BasicSensorTestBase {
112  public:
BasicBarometerTest()113   BasicBarometerTest() : BasicSensorTestBase() {}
114 
115  protected:
getSensorType()116   uint8_t getSensorType() const override {
117     return CHRE_SENSOR_TYPE_PRESSURE;
118   }
isOnChangeSensor()119   bool isOnChangeSensor() const override {
120     return false;
121   }
isOneShotSensor()122   bool isOneShotSensor() const override {
123     return false;
124   }
125   void confirmDataIsSane(const void *eventData) override;
126 };
127 
128 class BasicLightSensorTest : public BasicSensorTestBase {
129  public:
BasicLightSensorTest()130   BasicLightSensorTest() : BasicSensorTestBase() {}
131 
132  protected:
getSensorType()133   uint8_t getSensorType() const override {
134     return CHRE_SENSOR_TYPE_LIGHT;
135   }
isOnChangeSensor()136   bool isOnChangeSensor() const override {
137     return true;
138   }
isOneShotSensor()139   bool isOneShotSensor() const override {
140     return false;
141   }
142   void confirmDataIsSane(const void *eventData) override;
143 };
144 
145 class BasicProximityTest : public BasicSensorTestBase {
146  public:
BasicProximityTest()147   BasicProximityTest() : BasicSensorTestBase() {}
148 
149  protected:
getSensorType()150   uint8_t getSensorType() const override {
151     return CHRE_SENSOR_TYPE_PROXIMITY;
152   }
isOnChangeSensor()153   bool isOnChangeSensor() const override {
154     return true;
155   }
isOneShotSensor()156   bool isOneShotSensor() const override {
157     return false;
158   }
159   void confirmDataIsSane(const void *eventData) override;
160 };
161 
162 }  // namespace general_test
163 
164 #endif  // _GTS_NANOAPPS_GENERAL_TEST_BASIC_SENSOR_TESTS_H_
165