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_0/isensor_interface.h"
24 #include "sensor_type.h"
25 #include "sensor_callback_impl.h"
26
27 using namespace OHOS::HDI::Sensor::V1_0;
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
72 constexpr int g_listNum = sizeof(g_sensorList) / sizeof(g_sensorList[0]);
73 constexpr int32_t SENSOR_INTERVAL1 = 200000000;
74 constexpr int32_t SENSOR_INTERVAL2 = 20000000;
75 constexpr int32_t SENSOR_POLL_TIME = 1;
76 constexpr int32_t SENSOR_WAIT_TIME = 100;
77 constexpr int32_t ABNORMAL_SENSORID = -1;
78 }
79
IsSuppprtedSensorId(int32_t sensorTypeId)80 int32_t IsSuppprtedSensorId(int32_t sensorTypeId)
81 {
82 EXPECT_GT(g_info.size(),0);
83 for (auto iter : g_info){
84 if (iter.sensorId == sensorTypeId)
85 {
86 return SENSOR_SUCCESS;
87 }
88 }
89 return SENSOR_NOT_SUPPORT;
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: SetSensorMode0002
363 * @tc.desc: Sets the data reporting mode for the specified sensor.The current real-time polling mode is valid.
364 * Other values are invalid.
365 * @tc.type: FUNC
366 */
367 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0330, TestSize.Level1)
368 {
369 if (g_sensorInterface == nullptr) {
370 ASSERT_NE(nullptr, g_sensorInterface);
371 return;
372 }
373 int32_t ret = g_sensorInterface->SetMode(ABNORMAL_SENSORID, SENSOR_MODE_REALTIME);
374 EXPECT_EQ(SENSOR_NOT_SUPPORT, ret);
375 }
376
377 /**
378 * @tc.name: SetSensorMode0003
379 * @tc.desc: Sets the data reporting mode for the specified sensor.The current real-time polling mode is valid.
380 * Other values are invalid.
381 * @tc.type: FUNC
382 */
383 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0340, TestSize.Level1)
384 {
385 if (g_sensorInterface == nullptr) {
386 ASSERT_NE(nullptr, g_sensorInterface);
387 return;
388 }
389 EXPECT_GT(g_info.size(), 0);
390 for (auto iter : g_info) {
391 int32_t ret = g_sensorInterface->SetBatch(iter.sensorId, SENSOR_INTERVAL1, SENSOR_POLL_TIME);
392 EXPECT_EQ(SENSOR_SUCCESS, ret);
393 ret = g_sensorInterface->SetMode(iter.sensorId, SENSOR_MODE_DEFAULT);
394 EXPECT_EQ(SENSOR_FAILURE, ret);
395 ret = g_sensorInterface->Enable(iter.sensorId);
396 EXPECT_EQ(SENSOR_SUCCESS, ret);
397 OsalMSleep(SENSOR_WAIT_TIME);
398 ret = g_sensorInterface->Disable(iter.sensorId);
399 EXPECT_EQ(SENSOR_SUCCESS, ret);
400 }
401 }
402
403 /**
404 * @tc.name: SetSensorOption0001
405 * @tc.desc: Sets options for the specified sensor, including its measurement range and accuracy.
406 * @tc.type: FUNC
407 */
408 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0350, TestSize.Level1)
409 {
410 if (g_sensorInterface == nullptr) {
411 ASSERT_NE(nullptr, g_sensorInterface);
412 return;
413 }
414 EXPECT_GT(g_info.size(), 0);
415 for (auto iter : g_info) {
416 int32_t ret = g_sensorInterface->SetOption(iter.sensorId, 0);
417 EXPECT_EQ(SENSOR_SUCCESS, ret);
418 }
419 }
420
421 /**
422 * @tc.name: SetSensorOption0002
423 * @tc.desc: Sets options for the specified sensor, including its measurement range and accuracy.
424 * @tc.type: FUNC
425 */
426 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0360, TestSize.Level1)
427 {
428 if (g_sensorInterface == nullptr) {
429 ASSERT_NE(nullptr, g_sensorInterface);
430 return;
431 }
432 int32_t ret = g_sensorInterface->SetOption(ABNORMAL_SENSORID, 0);
433 EXPECT_EQ(SENSOR_NOT_SUPPORT, ret);
434 }
435
436 /**
437 * @tc.name: EnableSensor0002
438 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
439 * @tc.type: FUNC
440 */
441 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0362, TestSize.Level1)
442 {
443 if (g_sensorInterface == nullptr) {
444 ASSERT_NE(nullptr, g_sensorInterface);
445 return;
446 }
447
448 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_NONE);
449 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_NONE);
450 EXPECT_EQ(status,ret);
451 ret = g_sensorInterface->Disable(SENSOR_TYPE_NONE);
452 EXPECT_EQ(status,ret);
453 }
454
455 /**
456 * @tc.name: EnableSensor0003
457 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
458 * @tc.type: FUNC
459 */
460 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0363, TestSize.Level1)
461 {
462 if (g_sensorInterface == nullptr) {
463 ASSERT_NE(nullptr, g_sensorInterface);
464 return;
465 }
466
467 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ACCELEROMETER );
468 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ACCELEROMETER );
469 EXPECT_EQ(status,ret);
470 ret = g_sensorInterface->Disable(SENSOR_TYPE_ACCELEROMETER);
471 EXPECT_EQ(status,ret);
472 }
473
474 /**
475 * @tc.name: EnableSensor0004
476 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
477 * @tc.type: FUNC
478 */
479 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0364, TestSize.Level1)
480 {
481 if (g_sensorInterface == nullptr) {
482 ASSERT_NE(nullptr, g_sensorInterface);
483 return;
484 }
485
486 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GYROSCOPE);
487 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GYROSCOPE);
488 EXPECT_EQ(status,ret);
489 ret = g_sensorInterface->Disable(SENSOR_TYPE_GYROSCOPE);
490 EXPECT_EQ(status,ret);
491 }
492
493 /**
494 * @tc.name: EnableSensor0005
495 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
496 * @tc.type: FUNC
497 */
498 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0365, TestSize.Level1)
499 {
500 if (g_sensorInterface == nullptr) {
501 ASSERT_NE(nullptr, g_sensorInterface);
502 return;
503 }
504
505 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PHOTOPLETHYSMOGRAPH);
506 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PHOTOPLETHYSMOGRAPH);
507 EXPECT_EQ(status,ret);
508 ret = g_sensorInterface->Disable(SENSOR_TYPE_PHOTOPLETHYSMOGRAPH);
509 EXPECT_EQ(status,ret);
510 }
511
512 /**
513 * @tc.name: EnableSensor0006
514 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
515 * @tc.type: FUNC
516 */
517 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0366, TestSize.Level1)
518 {
519 if (g_sensorInterface == nullptr) {
520 ASSERT_NE(nullptr, g_sensorInterface);
521 return;
522 }
523
524 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ELECTROCARDIOGRAPH);
525 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ELECTROCARDIOGRAPH);
526 EXPECT_EQ(status,ret);
527 ret = g_sensorInterface->Disable(SENSOR_TYPE_ELECTROCARDIOGRAPH);
528 EXPECT_EQ(status,ret);
529 }
530
531 /**
532 * @tc.name: EnableSensor0007
533 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
534 * @tc.type: FUNC
535 */
536 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0367, TestSize.Level1)
537 {
538 if (g_sensorInterface == nullptr) {
539 ASSERT_NE(nullptr, g_sensorInterface);
540 return;
541 }
542
543 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_AMBIENT_LIGHT);
544 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_AMBIENT_LIGHT);
545 EXPECT_EQ(status,ret);
546 ret = g_sensorInterface->Disable(SENSOR_TYPE_AMBIENT_LIGHT);
547 EXPECT_EQ(status,ret);
548 }
549
550 /**
551 * @tc.name: EnableSensor0008
552 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
553 * @tc.type: FUNC
554 */
555 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0368, TestSize.Level1)
556 {
557 if (g_sensorInterface == nullptr) {
558 ASSERT_NE(nullptr, g_sensorInterface);
559 return;
560 }
561
562 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MAGNETIC_FIELD);
563 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MAGNETIC_FIELD);
564 EXPECT_EQ(status,ret);
565 ret = g_sensorInterface->Disable(SENSOR_TYPE_MAGNETIC_FIELD);
566 EXPECT_EQ(status,ret);
567 }
568
569 /**
570 * @tc.name: EnableSensor0009
571 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
572 * @tc.type: FUNC
573 */
574 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0369, TestSize.Level1)
575 {
576 if (g_sensorInterface == nullptr) {
577 ASSERT_NE(nullptr, g_sensorInterface);
578 return;
579 }
580
581 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_CAPACITIVE);
582 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_CAPACITIVE);
583 EXPECT_EQ(status,ret);
584 ret = g_sensorInterface->Disable(SENSOR_TYPE_CAPACITIVE);
585 EXPECT_EQ(status,ret);
586 }
587
588 /**
589 * @tc.name: EnableSensor0010
590 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
591 * @tc.type: FUNC
592 */
593 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0370, TestSize.Level1)
594 {
595 if (g_sensorInterface == nullptr) {
596 ASSERT_NE(nullptr, g_sensorInterface);
597 return;
598 }
599
600 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_BAROMETER);
601 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_BAROMETER);
602 EXPECT_EQ(status,ret);
603 ret = g_sensorInterface->Disable(SENSOR_TYPE_BAROMETER);
604 EXPECT_EQ(status,ret);
605 }
606
607 /**
608 * @tc.name: EnableSensor0011
609 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
610 * @tc.type: FUNC
611 */
612 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0371, TestSize.Level1)
613 {
614 if (g_sensorInterface == nullptr) {
615 ASSERT_NE(nullptr, g_sensorInterface);
616 return;
617 }
618
619 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_TEMPERATURE);
620 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_TEMPERATURE);
621 EXPECT_EQ(status,ret);
622 ret = g_sensorInterface->Disable(SENSOR_TYPE_TEMPERATURE);
623 EXPECT_EQ(status,ret);
624 }
625
626 /**
627 * @tc.name: EnableSensor0012
628 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
629 * @tc.type: FUNC
630 */
631 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0372, TestSize.Level1)
632 {
633 if (g_sensorInterface == nullptr) {
634 ASSERT_NE(nullptr, g_sensorInterface);
635 return;
636 }
637
638 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_HALL);
639 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_HALL);
640 EXPECT_EQ(status,ret);
641 ret = g_sensorInterface->Disable(SENSOR_TYPE_HALL);
642 EXPECT_EQ(status,ret);
643 }
644
645 /**
646 * @tc.name: EnableSensor0013
647 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
648 * @tc.type: FUNC
649 */
650 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0373, TestSize.Level1)
651 {
652 if (g_sensorInterface == nullptr) {
653 ASSERT_NE(nullptr, g_sensorInterface);
654 return;
655 }
656
657 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GESTURE);
658 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GESTURE);
659 EXPECT_EQ(status,ret);
660 ret = g_sensorInterface->Disable(SENSOR_TYPE_GESTURE);
661 EXPECT_EQ(status,ret);
662 }
663
664 /**
665 * @tc.name: EnableSensor0014
666 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
667 * @tc.type: FUNC
668 */
669 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0374, TestSize.Level1)
670 {
671 if (g_sensorInterface == nullptr) {
672 ASSERT_NE(nullptr, g_sensorInterface);
673 return;
674 }
675
676 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PROXIMITY);
677 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PROXIMITY);
678 EXPECT_EQ(status,ret);
679 ret = g_sensorInterface->Disable(SENSOR_TYPE_PROXIMITY);
680 EXPECT_EQ(status,ret);
681 }
682
683 /**
684 * @tc.name: EnableSensor0015
685 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
686 * @tc.type: FUNC
687 */
688 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0375, TestSize.Level1)
689 {
690 if (g_sensorInterface == nullptr) {
691 ASSERT_NE(nullptr, g_sensorInterface);
692 return;
693 }
694
695 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_HUMIDITY);
696 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_HUMIDITY);
697 EXPECT_EQ(status,ret);
698 ret = g_sensorInterface->Disable(SENSOR_TYPE_HUMIDITY);
699 EXPECT_EQ(status,ret);
700 }
701
702 /**
703 * @tc.name: EnableSensor0016
704 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
705 * @tc.type: FUNC
706 */
707 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0376, TestSize.Level1)
708 {
709 if (g_sensorInterface == nullptr) {
710 ASSERT_NE(nullptr, g_sensorInterface);
711 return;
712 }
713
714 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MEDICAL_BEGIN);
715 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MEDICAL_BEGIN);
716 EXPECT_EQ(status,ret);
717 ret = g_sensorInterface->Disable(SENSOR_TYPE_MEDICAL_BEGIN);
718 EXPECT_EQ(status,ret);
719 }
720
721 /**
722 * @tc.name: EnableSensor0017
723 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
724 * @tc.type: FUNC
725 */
726 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0377, TestSize.Level1)
727 {
728 if (g_sensorInterface == nullptr) {
729 ASSERT_NE(nullptr, g_sensorInterface);
730 return;
731 }
732
733 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MEDICAL_END);
734 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MEDICAL_END);
735 EXPECT_EQ(status,ret);
736 ret = g_sensorInterface->Disable(SENSOR_TYPE_MEDICAL_END);
737 EXPECT_EQ(status,ret);
738 }
739
740 /**
741 * @tc.name: EnableSensor0018
742 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
743 * @tc.type: FUNC
744 */
745 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0378, TestSize.Level1)
746 {
747 if (g_sensorInterface == nullptr) {
748 ASSERT_NE(nullptr, g_sensorInterface);
749 return;
750 }
751
752 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PHYSICAL_MAX);
753 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PHYSICAL_MAX);
754 EXPECT_EQ(status,ret);
755 ret = g_sensorInterface->Disable(SENSOR_TYPE_PHYSICAL_MAX);
756 EXPECT_EQ(status,ret);
757 }
758
759 /**
760 * @tc.name: EnableSensor0019
761 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
762 * @tc.type: FUNC
763 */
764 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0379, TestSize.Level1)
765 {
766 if (g_sensorInterface == nullptr) {
767 ASSERT_NE(nullptr, g_sensorInterface);
768 return;
769 }
770
771 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ORIENTATION);
772 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ORIENTATION);
773 EXPECT_EQ(status,ret);
774 ret = g_sensorInterface->Disable(SENSOR_TYPE_ORIENTATION);
775 EXPECT_EQ(status,ret);
776 }
777
778 /**
779 * @tc.name: EnableSensor0020
780 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
781 * @tc.type: FUNC
782 */
783 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0380, TestSize.Level1)
784 {
785 if (g_sensorInterface == nullptr) {
786 ASSERT_NE(nullptr, g_sensorInterface);
787 return;
788 }
789
790 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GRAVITY);
791 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GRAVITY);
792 EXPECT_EQ(status,ret);
793 ret = g_sensorInterface->Disable(SENSOR_TYPE_GRAVITY);
794 EXPECT_EQ(status,ret);
795 }
796
797 /**
798 * @tc.name: EnableSensor0021
799 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
800 * @tc.type: FUNC
801 */
802 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0381, TestSize.Level1)
803 {
804 if (g_sensorInterface == nullptr) {
805 ASSERT_NE(nullptr, g_sensorInterface);
806 return;
807 }
808
809 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_LINEAR_ACCELERATION);
810 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_LINEAR_ACCELERATION);
811 EXPECT_EQ(status,ret);
812 ret = g_sensorInterface->Disable(SENSOR_TYPE_LINEAR_ACCELERATION);
813 EXPECT_EQ(status,ret);
814 }
815
816 /**
817 * @tc.name: EnableSensor0022
818 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
819 * @tc.type: FUNC
820 */
821 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0382, TestSize.Level1)
822 {
823 if (g_sensorInterface == nullptr) {
824 ASSERT_NE(nullptr, g_sensorInterface);
825 return;
826 }
827
828 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ROTATION_VECTOR);
829 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ROTATION_VECTOR);
830 EXPECT_EQ(status,ret);
831 ret = g_sensorInterface->Disable(SENSOR_TYPE_ROTATION_VECTOR);
832 EXPECT_EQ(status,ret);
833 }
834
835 /**
836 * @tc.name: EnableSensor0023
837 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
838 * @tc.type: FUNC
839 */
840 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0383, TestSize.Level1)
841 {
842 if (g_sensorInterface == nullptr) {
843 ASSERT_NE(nullptr, g_sensorInterface);
844 return;
845 }
846
847 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_AMBIENT_TEMPERATURE);
848 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_AMBIENT_TEMPERATURE);
849 EXPECT_EQ(status,ret);
850 ret = g_sensorInterface->Disable(SENSOR_TYPE_AMBIENT_TEMPERATURE);
851 EXPECT_EQ(status,ret);
852 }
853
854 /**
855 * @tc.name: EnableSensor0024
856 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
857 * @tc.type: FUNC
858 */
859 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0384, TestSize.Level1)
860 {
861 if (g_sensorInterface == nullptr) {
862 ASSERT_NE(nullptr, g_sensorInterface);
863 return;
864 }
865
866 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED);
867 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED);
868 EXPECT_EQ(status,ret);
869 ret = g_sensorInterface->Disable(SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED);
870 EXPECT_EQ(status,ret);
871 }
872
873 /**
874 * @tc.name: EnableSensor0025
875 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
876 * @tc.type: FUNC
877 */
878 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0385, TestSize.Level1)
879 {
880 if (g_sensorInterface == nullptr) {
881 ASSERT_NE(nullptr, g_sensorInterface);
882 return;
883 }
884
885 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GAME_ROTATION_VECTOR);
886 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GAME_ROTATION_VECTOR);
887 EXPECT_EQ(status,ret);
888 ret = g_sensorInterface->Disable(SENSOR_TYPE_GAME_ROTATION_VECTOR);
889 EXPECT_EQ(status,ret);
890 }
891
892 /**
893 * @tc.name: EnableSensor0026
894 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
895 * @tc.type: FUNC
896 */
897 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0386, TestSize.Level1)
898 {
899 if (g_sensorInterface == nullptr) {
900 ASSERT_NE(nullptr, g_sensorInterface);
901 return;
902 }
903
904 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GYROSCOPE_UNCALIBRATED);
905 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GYROSCOPE_UNCALIBRATED);
906 EXPECT_EQ(status,ret);
907 ret = g_sensorInterface->Disable(SENSOR_TYPE_GYROSCOPE_UNCALIBRATED);
908 EXPECT_EQ(status,ret);
909 }
910
911 /**
912 * @tc.name: EnableSensor0027
913 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
914 * @tc.type: FUNC
915 */
916 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0387, TestSize.Level1)
917 {
918 if (g_sensorInterface == nullptr) {
919 ASSERT_NE(nullptr, g_sensorInterface);
920 return;
921 }
922
923 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_SIGNIFICANT_MOTION);
924 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_SIGNIFICANT_MOTION);
925 EXPECT_EQ(status,ret);
926 ret = g_sensorInterface->Disable(SENSOR_TYPE_SIGNIFICANT_MOTION);
927 EXPECT_EQ(status,ret);
928 }
929
930 /**
931 * @tc.name: EnableSensor0028
932 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
933 * @tc.type: FUNC
934 */
935 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0388, TestSize.Level1)
936 {
937 if (g_sensorInterface == nullptr) {
938 ASSERT_NE(nullptr, g_sensorInterface);
939 return;
940 }
941
942 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PEDOMETER_DETECTION);
943 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PEDOMETER_DETECTION);
944 EXPECT_EQ(status,ret);
945 ret = g_sensorInterface->Disable(SENSOR_TYPE_PEDOMETER_DETECTION);
946 EXPECT_EQ(status,ret);
947 }
948
949 /**
950 * @tc.name: EnableSensor0029
951 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
952 * @tc.type: FUNC
953 */
954 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0389, TestSize.Level1)
955 {
956 if (g_sensorInterface == nullptr) {
957 ASSERT_NE(nullptr, g_sensorInterface);
958 return;
959 }
960
961 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_PEDOMETER);
962 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_PEDOMETER);
963 EXPECT_EQ(status,ret);
964 ret = g_sensorInterface->Disable(SENSOR_TYPE_PEDOMETER);
965 EXPECT_EQ(status,ret);
966 }
967
968 /**
969 * @tc.name: EnableSensor0030
970 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
971 * @tc.type: FUNC
972 */
973 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0390, TestSize.Level1)
974 {
975 if (g_sensorInterface == nullptr) {
976 ASSERT_NE(nullptr, g_sensorInterface);
977 return;
978 }
979
980 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR);
981 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR);
982 EXPECT_EQ(status,ret);
983 ret = g_sensorInterface->Disable(SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR);
984 EXPECT_EQ(status,ret);
985 }
986
987 /**
988 * @tc.name: EnableSensor0031
989 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
990 * @tc.type: FUNC
991 */
992 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0391, TestSize.Level1)
993 {
994 if (g_sensorInterface == nullptr) {
995 ASSERT_NE(nullptr, g_sensorInterface);
996 return;
997 }
998
999 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_HEART_RATE);
1000 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_HEART_RATE);
1001 EXPECT_EQ(status,ret);
1002 ret = g_sensorInterface->Disable(SENSOR_TYPE_HEART_RATE);
1003 EXPECT_EQ(status,ret);
1004 }
1005
1006 /**
1007 * @tc.name: EnableSensor0032
1008 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1009 * @tc.type: FUNC
1010 */
1011 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0392, TestSize.Level1)
1012 {
1013 if (g_sensorInterface == nullptr) {
1014 ASSERT_NE(nullptr, g_sensorInterface);
1015 return;
1016 }
1017
1018 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_DEVICE_ORIENTATION);
1019 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_DEVICE_ORIENTATION);
1020 EXPECT_EQ(status,ret);
1021 ret = g_sensorInterface->Disable(SENSOR_TYPE_DEVICE_ORIENTATION);
1022 EXPECT_EQ(status,ret);
1023 }
1024
1025 /**
1026 * @tc.name: EnableSensor0033
1027 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1028 * @tc.type: FUNC
1029 */
1030 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0393, TestSize.Level1)
1031 {
1032 if (g_sensorInterface == nullptr) {
1033 ASSERT_NE(nullptr, g_sensorInterface);
1034 return;
1035 }
1036
1037 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_WEAR_DETECTION);
1038 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_WEAR_DETECTION);
1039 EXPECT_EQ(status,ret);
1040 ret = g_sensorInterface->Disable(SENSOR_TYPE_WEAR_DETECTION);
1041 EXPECT_EQ(status,ret);
1042 }
1043
1044 /**
1045 * @tc.name: EnableSensor0034
1046 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1047 * @tc.type: FUNC
1048 */
1049 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0394, TestSize.Level1)
1050 {
1051 if (g_sensorInterface == nullptr) {
1052 ASSERT_NE(nullptr, g_sensorInterface);
1053 return;
1054 }
1055
1056 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED);
1057 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED);
1058 EXPECT_EQ(status,ret);
1059 ret = g_sensorInterface->Disable(SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED);
1060 EXPECT_EQ(status,ret);
1061 }
1062
1063 /**
1064 * @tc.name: EnableSensor0035
1065 * @tc.desc: Enables the sensor unavailable in the sensor list based on the specified sensor ID.
1066 * @tc.type: FUNC
1067 */
1068 HWTEST_F(HdfSensorHdiTest, SUB_DriverSystem_HdiSensor_0395, TestSize.Level1)
1069 {
1070 if (g_sensorInterface == nullptr) {
1071 ASSERT_NE(nullptr, g_sensorInterface);
1072 return;
1073 }
1074
1075 int32_t status = IsSuppprtedSensorId(SENSOR_TYPE_MAX);
1076 int32_t ret = g_sensorInterface->Enable(SENSOR_TYPE_MAX);
1077 EXPECT_EQ(status,ret);
1078 ret = g_sensorInterface->Disable(SENSOR_TYPE_MAX);
1079 EXPECT_EQ(status,ret);
1080 }