1e41f4b71Sopenharmony_ci# Pan-sensor Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.vibrator Added isSupportEffect
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe **isSupportEffect** API is added.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci**Change Impact**
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciApplications developed based on OpenHarmony4.0.5.2 or a later SDK version can use **isSupportEffect** to check whether the passed effect ID is supported.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci**Key API/Component Changes**
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ciThe **isSupportEffect** API is added in **@ohos.vibrator.d.ts**.
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci| Module| Class| Method/Attribute/Enum/Constant| Change Type|
16e41f4b71Sopenharmony_ci|  -- | -- | -- | -- |
17e41f4b71Sopenharmony_ci| @ohos.vibrator.d.ts | vibrator | isSupportEffect(effectId: string, callback: AsyncCallback<boolean>): void | Added|
18e41f4b71Sopenharmony_ci| @ohos.vibrator.d.ts | vibrator | isSupportEffect(effectId: string): Promise<boolean> | Added|
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci**Adaptation Guide**
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ciCall **isSupportEffect** to check whether the passed effect ID is supported.
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci```ts
25e41f4b71Sopenharmony_ciimport vibrator from '@ohos.vibrator';
26e41f4b71Sopenharmony_citry {
27e41f4b71Sopenharmony_ci    // Check whether 'haptic.clock.timer' is supported.
28e41f4b71Sopenharmony_ci    vibrator.isSupportEffect('haptic.clock.timer', function (err, state) {
29e41f4b71Sopenharmony_ci        if (err) {
30e41f4b71Sopenharmony_ci            console.error('isSupportEffect failed, error:' + JSON.stringify(err));
31e41f4b71Sopenharmony_ci            return;
32e41f4b71Sopenharmony_ci        }
33e41f4b71Sopenharmony_ci        console.log('The effectId is ' + (state ? 'supported' : 'unsupported'));
34e41f4b71Sopenharmony_ci        if (state) {
35e41f4b71Sopenharmony_ci            try {
36e41f4b71Sopenharmony_ci                vibrator.startVibration({ // To use startVibration, you must configure the ohos.permission.VIBRATE permission.
37e41f4b71Sopenharmony_ci                    type: 'preset',
38e41f4b71Sopenharmony_ci                    effectId: 'haptic.clock.timer',
39e41f4b71Sopenharmony_ci                    count: 1,
40e41f4b71Sopenharmony_ci                }, {
41e41f4b71Sopenharmony_ci                    usage: 'unknown'
42e41f4b71Sopenharmony_ci                }, (error) => {
43e41f4b71Sopenharmony_ci                    if(error) {
44e41f4b71Sopenharmony_ci                        console.error('haptic.clock.timer vibrator error:'  + JSON.stringify(error));
45e41f4b71Sopenharmony_ci                    } else {
46e41f4b71Sopenharmony_ci                        console.log('haptic.clock.timer vibrator success');
47e41f4b71Sopenharmony_ci                    }
48e41f4b71Sopenharmony_ci                });
49e41f4b71Sopenharmony_ci            } catch (error) {
50e41f4b71Sopenharmony_ci                console.error('Exception in, error:' + JSON.stringify(error));
51e41f4b71Sopenharmony_ci            }
52e41f4b71Sopenharmony_ci        }
53e41f4b71Sopenharmony_ci    })
54e41f4b71Sopenharmony_ci} catch (error) {
55e41f4b71Sopenharmony_ci    console.error('Exception in, error:' + JSON.stringify(error));
56e41f4b71Sopenharmony_ci}
57e41f4b71Sopenharmony_ci```
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci## cl.vibrator Added stopVibration
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ciThe **stopVibration** API is added.
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci**Change Impact**
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ciApplications developed based on OpenHarmony4.0.5.2 or a later SDK version can use **stopVibration** to stop vibration in all modes.
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci**Key API/Component Changes**
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ciThe **stopVibration** API is added in **@ohos.vibrator.d.ts**.
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci| Module             | Class    | Method/Attribute/Enum/Constant                                     | Change Type|
72e41f4b71Sopenharmony_ci| ------------------- | -------- | -------------------------------------------------------- | -------- |
73e41f4b71Sopenharmony_ci| @ohos.vibrator.d.ts | vibrator | stopVibration(callback: AsyncCallback<void>): void | Added    |
74e41f4b71Sopenharmony_ci| @ohos.vibrator.d.ts | vibrator | stopVibration(): Promise<void>                     | Added    |
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci**Adaptation Guide**
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ciCall **stopVibration** to stop vibration in all modes.
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci```ts
81e41f4b71Sopenharmony_ciimport vibrator from '@ohos.vibrator';
82e41f4b71Sopenharmony_citry {
83e41f4b71Sopenharmony_ci    // Stop vibration in all modes.
84e41f4b71Sopenharmony_ci    vibrator.stopVibration(function (error) {
85e41f4b71Sopenharmony_ci        if (error) {
86e41f4b71Sopenharmony_ci            console.log('error.code' + error.code + 'error.message' + error.message);
87e41f4b71Sopenharmony_ci            return;
88e41f4b71Sopenharmony_ci        }
89e41f4b71Sopenharmony_ci        console.log('Callback returned to indicate successful.');
90e41f4b71Sopenharmony_ci    })
91e41f4b71Sopenharmony_ci} catch (error) {
92e41f4b71Sopenharmony_ci    console.info('errCode: ' + error.code + ' ,msg: ' + error.message);
93e41f4b71Sopenharmony_ci}
94e41f4b71Sopenharmony_ci```
95