• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <cmath>
17 #include <cstdio>
18 #include <unistd.h>
19 #include <gtest/gtest.h>
20 #include <securec.h>
21 #include "hdf_base.h"
22 #include "osal_time.h"
23 #include "v1_1/isensor_interface.h"
24 #include "sensor_type.h"
25 #include "sensor_callback_impl.h"
26 
27 using namespace OHOS::HDI::Sensor::V1_1;
28 using namespace testing::ext;
29 
30 namespace {
31     sptr<ISensorInterface>  g_sensorInterface = nullptr;
32     sptr<ISensorCallback> g_traditionalCallback = new SensorCallbackImpl();
33     sptr<ISensorCallback> g_medicalCallback = new SensorCallbackImpl();
34     std::vector<HdfSensorInformation> g_info;
35     struct SensorValueRange {
36         float highThreshold;
37         float lowThreshold;
38     };
39 
40     struct SensorDevelopmentList {
41         int32_t sensorTypeId;
42         char sensorName[SENSOR_NAME_MAX_LEN];
43         int32_t dataForm;    // 0: fixed, 1: range
44         int32_t dataDimension;
45         struct SensorValueRange *valueRange;
46     };
47 
48     struct SensorValueRange g_testRange[] = {{1e5, 0}};
49     struct SensorValueRange g_accelRange[] = {{78, -78}, {78, -78}, {78, -78}};
50     struct SensorValueRange g_alsRange[] = {{10000, 0}};
51     struct SensorValueRange g_pedometerRange[] = {{10000, 0}};
52     struct SensorValueRange g_proximityRange[] = {{5, 0}};
53     struct SensorValueRange g_hallRange[] = {{1, 0}};
54     struct SensorValueRange g_barometerRange[] = {{1100, -1100}, {1100, -1100}};
55     struct SensorValueRange g_magneticRange[] = {{2000, -2000}, {2000, -2000}, {2000, -2000}};
56     struct SensorValueRange g_gyroscopeRange[] = {{35, -35}, {35, -35}, {35, -35}};
57     struct SensorValueRange g_gravityRange[] = {{78, -78}, {78, -78}, {78, -78}};
58 
59     struct SensorDevelopmentList g_sensorList[] = {
60         {SENSOR_TYPE_NONE, "sensor_test",  1, 1, g_testRange},
61         {SENSOR_TYPE_ACCELEROMETER, "accelerometer",  1, 3, g_accelRange},
62         {SENSOR_TYPE_PEDOMETER, "pedometer", 1, 1, g_pedometerRange},
63         {SENSOR_TYPE_PROXIMITY, "proximity",  0, 1, g_proximityRange},
64         {SENSOR_TYPE_HALL, "hallrometer",  0, 1, g_hallRange},
65         {SENSOR_TYPE_BAROMETER, "barometer",  1, 2, g_barometerRange},
66         {SENSOR_TYPE_AMBIENT_LIGHT, "als", 1, 1, g_alsRange},
67         {SENSOR_TYPE_MAGNETIC_FIELD, "magnetometer",  1, 3, g_magneticRange},
68         {SENSOR_TYPE_GYROSCOPE, "gyroscope", 1, 3, g_gyroscopeRange},
69         {SENSOR_TYPE_GRAVITY, "gravity", 1, 3, g_gravityRange}
70     };
71 
IsSuppprtedSensorId(int32_t sensorTypeId)72     int32_t IsSuppprtedSensorId(int32_t sensorTypeId)
73     {
74       EXPECT_GT(g_info.size(),0);
75       for (auto iter : g_info){
76           if (iter.sensorId == sensorTypeId)
77           {
78             return SENSOR_SUCCESS;
79           }
80       }
81       return SENSOR_NOT_SUPPORT;
82     }
83 
84     constexpr int g_listNum = sizeof(g_sensorList) / sizeof(g_sensorList[0]);
85     constexpr int32_t SENSOR_INTERVAL1 = 200000000;
86     constexpr int32_t SENSOR_INTERVAL2 = 20000000;
87     constexpr int32_t SENSOR_POLL_TIME = 1;
88     constexpr int32_t SENSOR_WAIT_TIME = 100;
89     constexpr int32_t ABNORMAL_SENSORID = -1;
90 }
91 
92 class HdfSensorHdiTest : public testing::Test {
93 public:
94     static void SetUpTestCase();
95     static void TearDownTestCase();
96     void SetUp();
97     void TearDown();
98 };
99 
SetUpTestCase()100 void HdfSensorHdiTest::SetUpTestCase()
101 {
102     g_sensorInterface = ISensorInterface::Get();
103 }
104 
TearDownTestCase()105 void HdfSensorHdiTest::TearDownTestCase()
106 {
107 }
108 
SetUp()109 void HdfSensorHdiTest::SetUp()
110 {
111 }
112 
TearDown()113 void HdfSensorHdiTest::TearDown()
114 {
115 }
116 
117 /**
118   * @tc.name: GetSensorClient0001
119   * @tc.desc: Get a client and check whether the client is empty.
120   * @tc.type: FUNC
121   */
122 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0210, TestSize.Level1)
123 {
124     ASSERT_NE(nullptr, g_sensorInterface);
125 }
126 
127 /**
128   * @tc.name: GetSensorList0001
129   * @tc.desc: Obtains information about all sensors in the system.
130   * @tc.type: FUNC
131   */
132 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0230, TestSize.Level1)
133 {
134     if (g_sensorInterface == nullptr) {
135         ASSERT_NE(nullptr, g_sensorInterface);
136         return;
137     }
138     int32_t ret = g_sensorInterface->GetAllSensorInfo(g_info);
139     EXPECT_EQ(SENSOR_SUCCESS, ret);
140     EXPECT_GT(g_info.size(), 0);
141     printf("get sensor list num[%zu]\n\r", g_info.size());
142 
143     for (auto iter : g_info) {
144         printf("get sensoriId[%d], info name[%s], power[%f]\n\r", iter.sensorId, iter.sensorName.c_str(), iter.power);
145         for (int j =0; j < g_listNum; ++j) {
146             if (iter.sensorId == g_sensorList[j].sensorTypeId) {
147                 EXPECT_GT(iter.sensorName.size(), 0);
148                 break;
149             }
150         }
151     }
152 }
153 
154 /**
155   * @tc.name: RegisterSensorDataCb0001
156   * @tc.desc: Returns 0 if the callback is successfully registered; returns a negative value otherwise.
157   * @tc.type: FUNC
158   */
159 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0240, TestSize.Level1)
160 {
161     if (g_sensorInterface == nullptr) {
162         ASSERT_NE(nullptr, g_sensorInterface);
163         return;
164     }
165     int32_t ret = g_sensorInterface->Register(TRADITIONAL_SENSOR_TYPE, g_medicalCallback);
166     EXPECT_EQ(SENSOR_SUCCESS, ret);
167     ret = g_sensorInterface->Unregister(TRADITIONAL_SENSOR_TYPE, g_medicalCallback);
168     EXPECT_EQ(SENSOR_SUCCESS, ret);
169 }
170 
171 /**
172   * @tc.name: RegisterSensorDataCb0002
173   * @tc.desc: Returns 0 if the callback is successfully registered; returns a negative value otherwise.
174   * @tc.type: FUNC
175   */
176 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0250, TestSize.Level1)
177 {
178     if (g_sensorInterface == nullptr) {
179         ASSERT_NE(nullptr, g_sensorInterface);
180         return;
181     }
182     int32_t ret = g_sensorInterface->Register(MEDICAL_SENSOR_TYPE, g_medicalCallback);
183     EXPECT_EQ(SENSOR_SUCCESS, ret);
184     ret = g_sensorInterface->Unregister(MEDICAL_SENSOR_TYPE, g_medicalCallback);
185     EXPECT_EQ(SENSOR_SUCCESS, ret);
186 }
187 
188 /**
189   * @tc.name: RegisterDataCb001
190   * @tc.desc: Returns 0 if the callback is successfully registered; returns a negative value otherwise.
191   * @tc.type: FUNC
192   */
193 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0260, TestSize.Level1)
194 {
195     if (g_sensorInterface == nullptr) {
196         ASSERT_NE(nullptr, g_sensorInterface);
197         return;
198     }
199     int32_t ret = g_sensorInterface->Register(SENSOR_GROUP_TYPE_MAX, g_medicalCallback);
200     EXPECT_EQ(SENSOR_INVALID_PARAM, ret);
201     ret = g_sensorInterface->Unregister(SENSOR_GROUP_TYPE_MAX, g_medicalCallback);
202     EXPECT_EQ(SENSOR_INVALID_PARAM, ret);
203 }
204 
205 /**
206   * @tc.name: EnableSensor0001
207   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
208   * @tc.type: FUNC
209   */
210 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0270, TestSize.Level1)
211 {
212     if (g_sensorInterface == nullptr) {
213         ASSERT_NE(nullptr, g_sensorInterface);
214         return;
215     }
216     int32_t ret = g_sensorInterface->Register(TRADITIONAL_SENSOR_TYPE, g_traditionalCallback);
217     EXPECT_EQ(SENSOR_SUCCESS, ret);
218 
219     EXPECT_GT(g_info.size(), 0);
220 
221     for (auto iter : g_info) {
222         ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL1, SENSOR_POLL_TIME);
223         EXPECT_EQ(SENSOR_SUCCESS, ret);
224         ret = g_sensorInterface->Enable(iter.sensorId);
225         EXPECT_EQ(SENSOR_SUCCESS, ret);
226         OsalSleep(SENSOR_POLL_TIME);
227         ret = g_sensorInterface->Disable(iter.sensorId);
228         EXPECT_EQ(SENSOR_SUCCESS, ret);
229     }
230     ret = g_sensorInterface->Unregister(TRADITIONAL_SENSOR_TYPE, g_traditionalCallback);
231     EXPECT_EQ(0, ret);
232     EXPECT_EQ(SensorCallbackImpl::sensorDataFlag, 1);
233     SensorCallbackImpl::sensorDataFlag = 1;
234 }
235 
236 /**
237   * @tc.name: SetSensorBatch0001
238   * @tc.desc: Sets the sampling time and data report interval for sensors in batches.
239   * @tc.type: FUNC
240   */
241 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0290, TestSize.Level1)
242 {
243     if (g_sensorInterface == nullptr) {
244         ASSERT_NE(nullptr, g_sensorInterface);
245         return;
246     }
247     int32_t ret = g_sensorInterface->Register(TRADITIONAL_SENSOR_TYPE, g_traditionalCallback);
248     EXPECT_EQ(SENSOR_SUCCESS, ret);
249 
250     for (auto iter : g_info) {
251         ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL2, SENSOR_POLL_TIME);
252         EXPECT_EQ(SENSOR_SUCCESS, ret);
253         ret = g_sensorInterface->Enable(iter.sensorId);
254         EXPECT_EQ(SENSOR_SUCCESS, ret);
255         OsalMSleep(SENSOR_WAIT_TIME);
256         ret = g_sensorInterface->Disable(iter.sensorId);
257         EXPECT_EQ(SENSOR_SUCCESS, ret);
258     }
259 
260     ret = g_sensorInterface->Unregister(TRADITIONAL_SENSOR_TYPE, g_traditionalCallback);
261     EXPECT_EQ(SENSOR_SUCCESS, ret);
262     EXPECT_EQ(SensorCallbackImpl::sensorDataFlag, 1);
263     SensorCallbackImpl::sensorDataFlag = 1;
264 }
265 
266 /** @tc.name: SetSensorBatch0002
267     @tc.desc: Sets the sampling time and data report interval for sensors in batches.
268     @tc.type: FUNC
269     */
270 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0300, TestSize.Level1)
271 {
272     if (g_sensorInterface == nullptr) {
273         ASSERT_NE(nullptr, g_sensorInterface);
274         return;
275     }
276     int32_t ret = g_sensorInterface->SetBatch(ABNORMAL_SENSORID, 0, 0);
277     EXPECT_EQ(SENSOR_NOT_SUPPORT, ret);
278 }
279 
280 /**
281   * @tc.name: SetSensorBatch0003
282   * @tc.desc: Sets the sampling time and data report interval for sensors in batches.
283   * @tc.type: FUNC
284   */
285 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0310, TestSize.Level1)
286 {
287     if (g_sensorInterface == nullptr) {
288         ASSERT_NE(nullptr, g_sensorInterface);
289         return;
290     }
291     for (auto iter : g_info) {
292         int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, -1, SENSOR_POLL_TIME);
293         EXPECT_EQ(SENSOR_INVALID_PARAM, ret);
294     }
295 }
296 
297 /**
298   * @tc.name: SetSensorBatch0004
299   * @tc.desc: Sets the sampling time and data report interval for sensors in batches.
300   * @tc.type: FUNC
301   */
302 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0311, TestSize.Level1)
303 {
304     if (g_sensorInterface == nullptr) {
305         ASSERT_NE(nullptr, g_sensorInterface);
306         return;
307     }
308     for (auto iter : g_info) {
309         int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, -1, -1);
310         EXPECT_EQ(SENSOR_INVALID_PARAM, ret);
311     }
312 }
313 
314 /**
315   * @tc.name: SetSensorBatch0005
316   * @tc.desc: Sets the sampling time and data report interval for sensors in batches.
317   * @tc.type: FUNC
318   */
319 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0312, TestSize.Level1)
320 {
321     if (g_sensorInterface == nullptr) {
322         ASSERT_NE(nullptr, g_sensorInterface);
323         return;
324     }
325     for (auto iter : g_info) {
326         int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL2, -1);
327         EXPECT_EQ(SENSOR_INVALID_PARAM, ret);
328     }
329 }
330 
331 /**
332   * @tc.name: SetSensorMode0001
333   * @tc.desc: Sets the data reporting mode for the specified sensor.
334   * @tc.type: FUNC
335   */
336 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0320, TestSize.Level1)
337 {
338     if (g_sensorInterface == nullptr) {
339         ASSERT_NE(nullptr, g_sensorInterface);
340         return;
341     }
342     EXPECT_GT(g_info.size(), 0);
343     for (auto iter : g_info) {
344         int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL1, SENSOR_POLL_TIME);
345         EXPECT_EQ(SENSOR_SUCCESS, ret);
346         if (iter.sensorId == SENSOR_TYPE_HALL) {
347             ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_ON_CHANGE);
348             EXPECT_EQ(SENSOR_SUCCESS, ret);
349         } else {
350             ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_REALTIME);
351             EXPECT_EQ(SENSOR_SUCCESS, ret);
352         }
353         ret = g_sensorInterface->Enable(iter.sensorId);
354         EXPECT_EQ(SENSOR_SUCCESS, ret);
355         OsalMSleep(SENSOR_WAIT_TIME);
356         ret = g_sensorInterface->Disable(iter.sensorId);
357         EXPECT_EQ(SENSOR_SUCCESS, ret);
358     }
359 }
360 
361 /**
362   * @tc.name: SetSensorMode0001
363   * @tc.desc: Sets the data reporting mode for the specified sensor.
364   * @tc.type: FUNC
365   */
366 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0321, TestSize.Level1)
367 {
368     if (g_sensorInterface == nullptr) {
369         ASSERT_NE(nullptr, g_sensorInterface);
370         return;
371     }
372     EXPECT_GT(g_info.size(), 0);
373     for (auto iter : g_info) {
374         int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL1, SENSOR_POLL_TIME);
375         EXPECT_EQ(SENSOR_SUCCESS, ret);
376         if (iter.sensorId == SENSOR_TYPE_HALL) {
377             ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_ONE_SHOT);
378             EXPECT_EQ(SENSOR_SUCCESS, ret);
379         } else {
380             ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_REALTIME);
381             EXPECT_EQ(SENSOR_SUCCESS, ret);
382         }
383         ret = g_sensorInterface->Enable(iter.sensorId);
384         EXPECT_EQ(SENSOR_SUCCESS, ret);
385         OsalMSleep(SENSOR_WAIT_TIME);
386         ret = g_sensorInterface->Disable(iter.sensorId);
387         EXPECT_EQ(SENSOR_SUCCESS, ret);
388     }
389 }
390 
391 /**
392   * @tc.name: SetSensorMode0001
393   * @tc.desc: Sets the data reporting mode for the specified sensor.
394   * @tc.type: FUNC
395   */
396 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0322, TestSize.Level1)
397 {
398     if (g_sensorInterface == nullptr) {
399         ASSERT_NE(nullptr, g_sensorInterface);
400         return;
401     }
402     EXPECT_GT(g_info.size(), 0);
403     for (auto iter : g_info) {
404         int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL1, SENSOR_POLL_TIME);
405         EXPECT_EQ(SENSOR_SUCCESS, ret);
406         if (iter.sensorId == SENSOR_TYPE_HALL) {
407             ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_FIFO_MODE);
408             EXPECT_EQ(SENSOR_SUCCESS, ret);
409         } else {
410             ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_REALTIME);
411             EXPECT_EQ(SENSOR_SUCCESS, ret);
412         }
413         ret = g_sensorInterface->Enable(iter.sensorId);
414         EXPECT_EQ(SENSOR_SUCCESS, ret);
415         OsalMSleep(SENSOR_WAIT_TIME);
416         ret = g_sensorInterface->Disable(iter.sensorId);
417         EXPECT_EQ(SENSOR_SUCCESS, ret);
418     }
419 }
420 
421 
422 /**
423   * @tc.name: SetSensorMode0002
424   * @tc.desc: Sets the data reporting mode for the specified sensor.The current real-time polling mode is valid.
425   * Other values are invalid.
426   * @tc.type: FUNC
427   */
428 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0330, TestSize.Level1)
429 {
430     if (g_sensorInterface == nullptr) {
431         ASSERT_NE(nullptr, g_sensorInterface);
432         return;
433     }
434     int32_t ret = g_sensorInterface->SetMode(ABNORMAL_SENSORID, SENSOR_MODE_REALTIME);
435     EXPECT_EQ(SENSOR_NOT_SUPPORT, ret);
436 }
437 
438 /**
439   * @tc.name: SetSensorMode0003
440   * @tc.desc: Sets the data reporting mode for the specified sensor.The current real-time polling mode is valid.
441   * Other values are invalid.
442   * @tc.type: FUNC
443   */
444 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0340, TestSize.Level1)
445 {
446     if (g_sensorInterface == nullptr) {
447         ASSERT_NE(nullptr, g_sensorInterface);
448         return;
449     }
450     EXPECT_GT(g_info.size(), 0);
451     for (auto iter : g_info) {
452         int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL1, SENSOR_POLL_TIME);
453         EXPECT_EQ(SENSOR_SUCCESS, ret);
454         ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_DEFAULT);
455         EXPECT_EQ(SENSOR_FAILURE, ret);
456         ret = g_sensorInterface->Enable(iter.sensorId);
457         EXPECT_EQ(SENSOR_SUCCESS, ret);
458         OsalMSleep(SENSOR_WAIT_TIME);
459         ret = g_sensorInterface->Disable(iter.sensorId);
460         EXPECT_EQ(SENSOR_SUCCESS, ret);
461     }
462 }
463 
464 /**
465   * @tc.name: SetSensorOption0001
466   * @tc.desc: Sets options for the specified sensor, including its measurement range and accuracy.
467   * @tc.type: FUNC
468   */
469 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0350, TestSize.Level1)
470 {
471     if (g_sensorInterface == nullptr) {
472         ASSERT_NE(nullptr, g_sensorInterface);
473         return;
474     }
475     EXPECT_GT(g_info.size(), 0);
476     for (auto iter : g_info) {
477         int32_t ret = g_sensorInterface->SetOption(iter.sensorId, 0);
478         EXPECT_EQ(SENSOR_SUCCESS, ret);
479     }
480 }
481 
482 /**
483   * @tc.name: SetSensorOption0002
484   * @tc.desc: Sets options for the specified sensor, including its measurement range and accuracy.
485   * @tc.type: FUNC
486   */
487 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0360, TestSize.Level1)
488 {
489     if (g_sensorInterface == nullptr) {
490         ASSERT_NE(nullptr, g_sensorInterface);
491         return;
492     }
493     int32_t ret = g_sensorInterface->SetOption(ABNORMAL_SENSORID, 0);
494     EXPECT_EQ(SENSOR_NOT_SUPPORT, ret);
495 }
496 
497 /**
498   * @tc.name: EnableSensor0002
499   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
500   * @tc.type: FUNC
501   */
502 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0362, TestSize.Level1)
503 {
504     if (g_sensorInterface == nullptr) {
505         ASSERT_NE(nullptr, g_sensorInterface);
506         return;
507     }
508 
509     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_NONE);
510     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_NONE);
511     EXPECT_EQ(status,ret);
512     ret = g_sensorInterface->Disable(SENSOR_TYPE_NONE);
513     EXPECT_EQ(status,ret);
514 }
515 
516 /**
517   * @tc.name: EnableSensor0003
518   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
519   * @tc.type: FUNC
520   */
521 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0363, TestSize.Level1)
522 {
523     if (g_sensorInterface == nullptr) {
524         ASSERT_NE(nullptr, g_sensorInterface);
525         return;
526     }
527 
528     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ACCELEROMETER );
529     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ACCELEROMETER );
530     EXPECT_EQ(status,ret);
531     ret = g_sensorInterface->Disable(SENSOR_TYPE_ACCELEROMETER);
532     EXPECT_EQ(status,ret);
533 }
534 
535 /**
536   * @tc.name: EnableSensor0004
537   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
538   * @tc.type: FUNC
539   */
540 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0364, TestSize.Level1)
541 {
542     if (g_sensorInterface == nullptr) {
543         ASSERT_NE(nullptr, g_sensorInterface);
544         return;
545     }
546 
547     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GYROSCOPE);
548     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GYROSCOPE);
549     EXPECT_EQ(status,ret);
550     ret = g_sensorInterface->Disable(SENSOR_TYPE_GYROSCOPE);
551     EXPECT_EQ(status,ret);
552 }
553 
554 /**
555   * @tc.name: EnableSensor0005
556   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
557   * @tc.type: FUNC
558   */
559 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0365, TestSize.Level1)
560 {
561     if (g_sensorInterface == nullptr) {
562         ASSERT_NE(nullptr, g_sensorInterface);
563         return;
564     }
565 
566     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PHOTOPLETHYSMOGRAPH);
567     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PHOTOPLETHYSMOGRAPH);
568     EXPECT_EQ(status,ret);
569     ret = g_sensorInterface->Disable(SENSOR_TYPE_PHOTOPLETHYSMOGRAPH);
570     EXPECT_EQ(status,ret);
571 }
572 
573 /**
574   * @tc.name: EnableSensor0006
575   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
576   * @tc.type: FUNC
577   */
578 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0366, TestSize.Level1)
579 {
580     if (g_sensorInterface == nullptr) {
581         ASSERT_NE(nullptr, g_sensorInterface);
582         return;
583     }
584 
585     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ELECTROCARDIOGRAPH);
586     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ELECTROCARDIOGRAPH);
587     EXPECT_EQ(status,ret);
588     ret = g_sensorInterface->Disable(SENSOR_TYPE_ELECTROCARDIOGRAPH);
589     EXPECT_EQ(status,ret);
590 }
591 
592 /**
593   * @tc.name: EnableSensor0007
594   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
595   * @tc.type: FUNC
596   */
597 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0367, TestSize.Level1)
598 {
599     if (g_sensorInterface == nullptr) {
600         ASSERT_NE(nullptr, g_sensorInterface);
601         return;
602     }
603 
604     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_AMBIENT_LIGHT);
605     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_AMBIENT_LIGHT);
606     EXPECT_EQ(status,ret);
607     ret = g_sensorInterface->Disable(SENSOR_TYPE_AMBIENT_LIGHT);
608     EXPECT_EQ(status,ret);
609 }
610 
611 /**
612   * @tc.name: EnableSensor0008
613   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
614   * @tc.type: FUNC
615   */
616 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0368, TestSize.Level1)
617 {
618     if (g_sensorInterface == nullptr) {
619         ASSERT_NE(nullptr, g_sensorInterface);
620         return;
621     }
622 
623     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MAGNETIC_FIELD);
624     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MAGNETIC_FIELD);
625     EXPECT_EQ(status,ret);
626     ret = g_sensorInterface->Disable(SENSOR_TYPE_MAGNETIC_FIELD);
627     EXPECT_EQ(status,ret);
628 }
629 
630 /**
631   * @tc.name: EnableSensor0009
632   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
633   * @tc.type: FUNC
634   */
635 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0369, TestSize.Level1)
636 {
637     if (g_sensorInterface == nullptr) {
638         ASSERT_NE(nullptr, g_sensorInterface);
639         return;
640     }
641 
642     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_CAPACITIVE);
643     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_CAPACITIVE);
644     EXPECT_EQ(status,ret);
645     ret = g_sensorInterface->Disable(SENSOR_TYPE_CAPACITIVE);
646     EXPECT_EQ(status,ret);
647 }
648 
649 /**
650   * @tc.name: EnableSensor0010
651   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
652   * @tc.type: FUNC
653   */
654 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0370, TestSize.Level1)
655 {
656     if (g_sensorInterface == nullptr) {
657         ASSERT_NE(nullptr, g_sensorInterface);
658         return;
659     }
660 
661     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_BAROMETER);
662     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_BAROMETER);
663     EXPECT_EQ(status,ret);
664     ret = g_sensorInterface->Disable(SENSOR_TYPE_BAROMETER);
665     EXPECT_EQ(status,ret);
666 }
667 
668 /**
669   * @tc.name: EnableSensor0011
670   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
671   * @tc.type: FUNC
672   */
673 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0371, TestSize.Level1)
674 {
675     if (g_sensorInterface == nullptr) {
676         ASSERT_NE(nullptr, g_sensorInterface);
677         return;
678     }
679 
680     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_TEMPERATURE);
681     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_TEMPERATURE);
682     EXPECT_EQ(status,ret);
683     ret = g_sensorInterface->Disable(SENSOR_TYPE_TEMPERATURE);
684     EXPECT_EQ(status,ret);
685 }
686 
687 /**
688   * @tc.name: EnableSensor0012
689   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
690   * @tc.type: FUNC
691   */
692 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0372, TestSize.Level1)
693 {
694     if (g_sensorInterface == nullptr) {
695         ASSERT_NE(nullptr, g_sensorInterface);
696         return;
697     }
698 
699     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_HALL);
700     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_HALL);
701     EXPECT_EQ(status,ret);
702     ret = g_sensorInterface->Disable(SENSOR_TYPE_HALL);
703     EXPECT_EQ(status,ret);
704 }
705 
706 /**
707   * @tc.name: EnableSensor0013
708   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
709   * @tc.type: FUNC
710   */
711 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0373, TestSize.Level1)
712 {
713     if (g_sensorInterface == nullptr) {
714         ASSERT_NE(nullptr, g_sensorInterface);
715         return;
716     }
717 
718     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GESTURE);
719     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GESTURE);
720     EXPECT_EQ(status,ret);
721     ret = g_sensorInterface->Disable(SENSOR_TYPE_GESTURE);
722     EXPECT_EQ(status,ret);
723 }
724 
725 /**
726   * @tc.name: EnableSensor0014
727   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
728   * @tc.type: FUNC
729   */
730 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0374, TestSize.Level1)
731 {
732     if (g_sensorInterface == nullptr) {
733         ASSERT_NE(nullptr, g_sensorInterface);
734         return;
735     }
736 
737     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PROXIMITY);
738     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PROXIMITY);
739     EXPECT_EQ(status,ret);
740     ret = g_sensorInterface->Disable(SENSOR_TYPE_PROXIMITY);
741     EXPECT_EQ(status,ret);
742 }
743 
744 /**
745   * @tc.name: EnableSensor0015
746   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
747   * @tc.type: FUNC
748   */
749 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0375, TestSize.Level1)
750 {
751     if (g_sensorInterface == nullptr) {
752         ASSERT_NE(nullptr, g_sensorInterface);
753         return;
754     }
755 
756     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_HUMIDITY);
757     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_HUMIDITY);
758     EXPECT_EQ(status,ret);
759     ret = g_sensorInterface->Disable(SENSOR_TYPE_HUMIDITY);
760     EXPECT_EQ(status,ret);
761 }
762 
763 /**
764   * @tc.name: EnableSensor0016
765   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
766   * @tc.type: FUNC
767   */
768 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0376, TestSize.Level1)
769 {
770     if (g_sensorInterface == nullptr) {
771         ASSERT_NE(nullptr, g_sensorInterface);
772         return;
773     }
774 
775     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MEDICAL_BEGIN);
776     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MEDICAL_BEGIN);
777     EXPECT_EQ(status,ret);
778     ret = g_sensorInterface->Disable(SENSOR_TYPE_MEDICAL_BEGIN);
779     EXPECT_EQ(status,ret);
780 }
781 
782 /**
783   * @tc.name: EnableSensor0017
784   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
785   * @tc.type: FUNC
786   */
787 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0377, TestSize.Level1)
788 {
789     if (g_sensorInterface == nullptr) {
790         ASSERT_NE(nullptr, g_sensorInterface);
791         return;
792     }
793 
794     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MEDICAL_END);
795     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MEDICAL_END);
796     EXPECT_EQ(status,ret);
797     ret = g_sensorInterface->Disable(SENSOR_TYPE_MEDICAL_END);
798     EXPECT_EQ(status,ret);
799 }
800 
801 /**
802   * @tc.name: EnableSensor0018
803   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
804   * @tc.type: FUNC
805   */
806 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0378, TestSize.Level1)
807 {
808     if (g_sensorInterface == nullptr) {
809         ASSERT_NE(nullptr, g_sensorInterface);
810         return;
811     }
812 
813     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PHYSICAL_MAX);
814     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PHYSICAL_MAX);
815     EXPECT_EQ(status,ret);
816     ret = g_sensorInterface->Disable(SENSOR_TYPE_PHYSICAL_MAX);
817     EXPECT_EQ(status,ret);
818 }
819 
820 /**
821   * @tc.name: EnableSensor0019
822   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
823   * @tc.type: FUNC
824   */
825 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0379, TestSize.Level1)
826 {
827     if (g_sensorInterface == nullptr) {
828         ASSERT_NE(nullptr, g_sensorInterface);
829         return;
830     }
831 
832     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ORIENTATION);
833     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ORIENTATION);
834     EXPECT_EQ(status,ret);
835     ret = g_sensorInterface->Disable(SENSOR_TYPE_ORIENTATION);
836     EXPECT_EQ(status,ret);
837 }
838 
839 /**
840   * @tc.name: EnableSensor0020
841   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
842   * @tc.type: FUNC
843   */
844 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0380, TestSize.Level1)
845 {
846     if (g_sensorInterface == nullptr) {
847         ASSERT_NE(nullptr, g_sensorInterface);
848         return;
849     }
850 
851     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GRAVITY);
852     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GRAVITY);
853     EXPECT_EQ(status,ret);
854     ret = g_sensorInterface->Disable(SENSOR_TYPE_GRAVITY);
855     EXPECT_EQ(status,ret);
856 }
857 
858 /**
859   * @tc.name: EnableSensor0021
860   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
861   * @tc.type: FUNC
862   */
863 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0381, TestSize.Level1)
864 {
865     if (g_sensorInterface == nullptr) {
866         ASSERT_NE(nullptr, g_sensorInterface);
867         return;
868     }
869 
870     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_LINEAR_ACCELERATION);
871     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_LINEAR_ACCELERATION);
872     EXPECT_EQ(status,ret);
873     ret = g_sensorInterface->Disable(SENSOR_TYPE_LINEAR_ACCELERATION);
874     EXPECT_EQ(status,ret);
875 }
876 
877 /**
878   * @tc.name: EnableSensor0022
879   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
880   * @tc.type: FUNC
881   */
882 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0382, TestSize.Level1)
883 {
884     if (g_sensorInterface == nullptr) {
885         ASSERT_NE(nullptr, g_sensorInterface);
886         return;
887     }
888 
889     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ROTATION_VECTOR);
890     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ROTATION_VECTOR);
891     EXPECT_EQ(status,ret);
892     ret = g_sensorInterface->Disable(SENSOR_TYPE_ROTATION_VECTOR);
893     EXPECT_EQ(status,ret);
894 }
895 
896 /**
897   * @tc.name: EnableSensor0023
898   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
899   * @tc.type: FUNC
900   */
901 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0383, TestSize.Level1)
902 {
903     if (g_sensorInterface == nullptr) {
904         ASSERT_NE(nullptr, g_sensorInterface);
905         return;
906     }
907 
908     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_AMBIENT_TEMPERATURE);
909     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_AMBIENT_TEMPERATURE);
910     EXPECT_EQ(status,ret);
911     ret = g_sensorInterface->Disable(SENSOR_TYPE_AMBIENT_TEMPERATURE);
912     EXPECT_EQ(status,ret);
913 }
914 
915 /**
916   * @tc.name: EnableSensor0024
917   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
918   * @tc.type: FUNC
919   */
920 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0384, TestSize.Level1)
921 {
922     if (g_sensorInterface == nullptr) {
923         ASSERT_NE(nullptr, g_sensorInterface);
924         return;
925     }
926 
927     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED);
928     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED);
929     EXPECT_EQ(status,ret);
930     ret = g_sensorInterface->Disable(SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED);
931     EXPECT_EQ(status,ret);
932 }
933 
934 /**
935   * @tc.name: EnableSensor0025
936   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
937   * @tc.type: FUNC
938   */
939 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0385, TestSize.Level1)
940 {
941     if (g_sensorInterface == nullptr) {
942         ASSERT_NE(nullptr, g_sensorInterface);
943         return;
944     }
945 
946     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GAME_ROTATION_VECTOR);
947     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GAME_ROTATION_VECTOR);
948     EXPECT_EQ(status,ret);
949     ret = g_sensorInterface->Disable(SENSOR_TYPE_GAME_ROTATION_VECTOR);
950     EXPECT_EQ(status,ret);
951 }
952 
953 /**
954   * @tc.name: EnableSensor0026
955   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
956   * @tc.type: FUNC
957   */
958 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0386, TestSize.Level1)
959 {
960     if (g_sensorInterface == nullptr) {
961         ASSERT_NE(nullptr, g_sensorInterface);
962         return;
963     }
964 
965     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GYROSCOPE_UNCALIBRATED);
966     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GYROSCOPE_UNCALIBRATED);
967     EXPECT_EQ(status,ret);
968     ret = g_sensorInterface->Disable(SENSOR_TYPE_GYROSCOPE_UNCALIBRATED);
969     EXPECT_EQ(status,ret);
970 }
971 
972 /**
973   * @tc.name: EnableSensor0027
974   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
975   * @tc.type: FUNC
976   */
977 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0387, TestSize.Level1)
978 {
979     if (g_sensorInterface == nullptr) {
980         ASSERT_NE(nullptr, g_sensorInterface);
981         return;
982     }
983 
984     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_SIGNIFICANT_MOTION);
985     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_SIGNIFICANT_MOTION);
986     EXPECT_EQ(status,ret);
987     ret = g_sensorInterface->Disable(SENSOR_TYPE_SIGNIFICANT_MOTION);
988     EXPECT_EQ(status,ret);
989 }
990 
991 /**
992   * @tc.name: EnableSensor0028
993   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
994   * @tc.type: FUNC
995   */
996 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0388, TestSize.Level1)
997 {
998     if (g_sensorInterface == nullptr) {
999         ASSERT_NE(nullptr, g_sensorInterface);
1000         return;
1001     }
1002 
1003     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PEDOMETER_DETECTION);
1004     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PEDOMETER_DETECTION);
1005     EXPECT_EQ(status,ret);
1006     ret = g_sensorInterface->Disable(SENSOR_TYPE_PEDOMETER_DETECTION);
1007     EXPECT_EQ(status,ret);
1008 }
1009 
1010 /**
1011   * @tc.name: EnableSensor0029
1012   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1013   * @tc.type: FUNC
1014   */
1015 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0389, TestSize.Level1)
1016 {
1017     if (g_sensorInterface == nullptr) {
1018         ASSERT_NE(nullptr, g_sensorInterface);
1019         return;
1020     }
1021 
1022     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PEDOMETER);
1023     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PEDOMETER);
1024     EXPECT_EQ(status,ret);
1025     ret = g_sensorInterface->Disable(SENSOR_TYPE_PEDOMETER);
1026     EXPECT_EQ(status,ret);
1027 }
1028 
1029 /**
1030   * @tc.name: EnableSensor0030
1031   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1032   * @tc.type: FUNC
1033   */
1034 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0390, TestSize.Level1)
1035 {
1036     if (g_sensorInterface == nullptr) {
1037         ASSERT_NE(nullptr, g_sensorInterface);
1038         return;
1039     }
1040 
1041     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR);
1042     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR);
1043     EXPECT_EQ(status,ret);
1044     ret = g_sensorInterface->Disable(SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR);
1045     EXPECT_EQ(status,ret);
1046 }
1047 
1048 /**
1049   * @tc.name: EnableSensor0031
1050   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1051   * @tc.type: FUNC
1052   */
1053 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0391, TestSize.Level1)
1054 {
1055     if (g_sensorInterface == nullptr) {
1056         ASSERT_NE(nullptr, g_sensorInterface);
1057         return;
1058     }
1059 
1060     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_HEART_RATE);
1061     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_HEART_RATE);
1062     EXPECT_EQ(status,ret);
1063     ret = g_sensorInterface->Disable(SENSOR_TYPE_HEART_RATE);
1064     EXPECT_EQ(status,ret);
1065 }
1066 
1067 /**
1068   * @tc.name: EnableSensor0032
1069   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1070   * @tc.type: FUNC
1071   */
1072 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0392, TestSize.Level1)
1073 {
1074     if (g_sensorInterface == nullptr) {
1075         ASSERT_NE(nullptr, g_sensorInterface);
1076         return;
1077     }
1078 
1079     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_DEVICE_ORIENTATION);
1080     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_DEVICE_ORIENTATION);
1081     EXPECT_EQ(status,ret);
1082     ret = g_sensorInterface->Disable(SENSOR_TYPE_DEVICE_ORIENTATION);
1083     EXPECT_EQ(status,ret);
1084 }
1085 
1086 /**
1087   * @tc.name: EnableSensor0033
1088   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1089   * @tc.type: FUNC
1090   */
1091 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0393, TestSize.Level1)
1092 {
1093     if (g_sensorInterface == nullptr) {
1094         ASSERT_NE(nullptr, g_sensorInterface);
1095         return;
1096     }
1097 
1098     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_WEAR_DETECTION);
1099     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_WEAR_DETECTION);
1100     EXPECT_EQ(status,ret);
1101     ret = g_sensorInterface->Disable(SENSOR_TYPE_WEAR_DETECTION);
1102     EXPECT_EQ(status,ret);
1103 }
1104 
1105 /**
1106   * @tc.name: EnableSensor0034
1107   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1108   * @tc.type: FUNC
1109   */
1110 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0394, TestSize.Level1)
1111 {
1112     if (g_sensorInterface == nullptr) {
1113         ASSERT_NE(nullptr, g_sensorInterface);
1114         return;
1115     }
1116 
1117     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED);
1118     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED);
1119     EXPECT_EQ(status,ret);
1120     ret = g_sensorInterface->Disable(SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED);
1121     EXPECT_EQ(status,ret);
1122 }
1123 
1124 /**
1125   * @tc.name: EnableSensor0035
1126   * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1127   * @tc.type: FUNC
1128   */
1129 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0395, TestSize.Level1)
1130 {
1131     if (g_sensorInterface == nullptr) {
1132         ASSERT_NE(nullptr, g_sensorInterface);
1133         return;
1134     }
1135 
1136     int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MAX);
1137     int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MAX);
1138     EXPECT_EQ(status,ret);
1139     ret = g_sensorInterface->Disable(SENSOR_TYPE_MAX);
1140     EXPECT_EQ(status,ret);
1141 }