1# IVibratorInterface 2 3 4## 概述 5 6Vibrator模块向上层服务提供统一的接口。 7 8上层服务开发人员可根据Vibrator模块提供的统一接口,用于控制马达执行单次或周期性振动。 9 10**起始版本:** 4.1 11 12**相关模块:**[Vibrator](_vibrator_v12.md) 13 14 15## 汇总 16 17 18### Public 成员函数 19 20| 名称 | 描述 | 21| -------- | -------- | 22| [PlayHapticPattern](#playhapticpattern) ([in] struct [HapticPaket](_haptic_paket_v12.md) pkg) | 高清振动数据下发。 | 23| [GetHapticCapacity](#gethapticcapacity) ([out] struct [HapticCapacity](_haptic_capacity_v12.md)[HapticCapacity](_haptic_capacity_v12.md)) | 获取马达振动能力。 | 24| [GetHapticStartUpTime](#gethapticstartuptime) ([in] int mode, [out] int startUpTime) | 获取起振时间。 | 25| [StopV1_2](#stopv1_2) ([in] int mode) | 停止马达振动。 | 26 27 28## 成员函数说明 29 30 31### GetHapticCapacity() 32 33``` 34IVibratorInterface::GetHapticCapacity ([out] struct HapticCapacity HapticCapacity) 35``` 36**描述** 37 38获取马达振动能力。 39 40**起始版本:** 4.1 41 42**参数:** 43 44| 名称 | 描述 | 45| -------- | -------- | 46| [HapticCapacity](_haptic_capacity_v12.md) | 表示振动能力数据包,属性包含是否高清振动,是否支持延时振动,是否支持预定义振动。 | 47 48**返回:** 49 50如果操作成功,则返回0。 51 52如果操作失败,则返回负值。 53 54 55### GetHapticStartUpTime() 56 57``` 58IVibratorInterface::GetHapticStartUpTime ([in] int mode, [out] int startUpTime ) 59``` 60**描述** 61 62获取起振时间。 63 64**起始版本:** 4.1 65 66**参数:** 67 68| 名称 | 描述 | 69| -------- | -------- | 70| startUpTime | 表示从下达振动振动命令到马达振动起来的时间,mode为振动模式,按照模式去获取。 | 71 72**返回:** 73 74如果操作成功,则返回0。 75 76如果操作失败,则返回负值。 77 78 79### PlayHapticPattern() 80 81``` 82IVibratorInterface::PlayHapticPattern ([in] struct HapticPaket pkg) 83``` 84**描述** 85 86高清振动数据下发。 87 88**起始版本:** 4.1 89 90**参数:** 91 92| 名称 | 描述 | 93| -------- | -------- | 94| pkg | 表示高清振动数据的数据包,是一个结构体,内部赋值具体振动参数。 | 95 96**返回:** 97 98如果操作成功,则返回0。 99 100如果操作失败,则返回负值。 101 102 103### StopV1_2() 104 105``` 106IVibratorInterface::StopV1_2 ([in] int mode) 107``` 108**描述** 109 110停止马达振动。 111 112马达启动前,必须在任何模式下停止振动。此功能用在振动过程之后。 113 114**起始版本:** 4.1 115 116**参数:** 117 118| 名称 | 描述 | 119| -------- | -------- | 120| mode | 表示振动模式,可以是单次或周期性或者HD的,详见[HdfVibratorModeV1_2](_vibrator_v12.md#hdfvibratormodev1_2)。 | 121 122**返回:** 123 124如果操作成功,则返回0。 125 126如果操作失败,则返回负值。 127