1# Vibrator 2 3 4## Overview 5 6The **Vibrator** module provides APIs for vibrator services to access the vibrator driver. 7 8**Since**: 11 9 10 11## Summary 12 13 14### Files 15 16| Name| Description| 17| -------- | -------- | 18| [vibrator_type.h](vibrator_type_8h.md) | Declares the APIs for starting or stopping vibration. | 19 20 21### Structs 22 23| Name| Description| 24| -------- | -------- | 25| [Vibrator_Attribute](_vibrator_attribute.md) | Describes the vibrator attribute. | 26| [Vibrator_FileDescription](_vibrator_file_description.md) | Describes the vibration file description. | 27 28 29### Types 30 31| Name| Description| 32| -------- | -------- | 33| [Vibrator_ErrorCode](#vibrator_errorcode) | Defines an enum for vibrator error codes. | 34| [Vibrator_Usage](#vibrator_usage) | Defines an enum for vibration scenarios. | 35| [Vibrator_Attribute](#vibrator_attribute) | Defines a struct for the vibrator attribute. | 36| [Vibrator_FileDescription](#vibrator_filedescription) | Defines a struct for the vibration file description. | 37 38 39### Enums 40 41| Name| Description| 42| -------- | -------- | 43| [Vibrator_ErrorCode](#vibrator_errorcode) : int32_t { <br>PERMISSION_DENIED = 201, <br>PARAMETER_ERROR = 401, <br>UNSUPPORTED = 801, <br>DEVICE_OPERATION_FAILED = 14600101<br>} | Enumerates the vibrator error codes. | 44| [Vibrator_Usage](#vibrator_usage) {<br>USAGE_UNKNOWN = 0, <br>USAGE_ALARM = 1, <br>USAGE_RING = 2,<br> USAGE_NOTIFICATION = 3,<br>USAGE_COMMUNICATION = 4, <br>USAGE_TOUCH = 5, <br>USAGE_MEDIA = 6, <br>USAGE_PHYSICAL_FEEDBACK = 7,<br>USAGE_SIMULATE_REALITY = 8, <br>USAGE_MAX = 9<br>} | Enumerates the vibration scenarios. | 45 46 47## Type Description 48 49 50### Vibrator_Attribute 51 52``` 53typedef struct Vibrator_Attribute Vibrator_Attribute 54``` 55**Description** 56 57Describes the vibrator attribute. 58 59**Since**: 11 60 61 62### Vibrator_ErrorCode 63 64``` 65typedef enum Vibrator_ErrorCode Vibrator_ErrorCode 66``` 67**Description** 68 69Defines an enum for vibrator error codes. 70 71**Since**: 11 72 73 74### Vibrator_FileDescription 75 76``` 77typedef struct Vibrator_FileDescription Vibrator_FileDescription 78``` 79**Description** 80 81Describes the vibration file description. 82 83**Since**: 11 84 85 86### Vibrator_Usage 87 88``` 89typedef enum Vibrator_Usage Vibrator_Usage 90``` 91**Description** 92 93Defines an enum for vibration scenarios. 94 95**Since**: 11 96 97 98## Enum Description 99 100 101### Vibrator_ErrorCode 102 103``` 104enum Vibrator_ErrorCode:int32_t 105``` 106**Description** 107 108Defines an enum for vibrator error codes. 109 110**Since**: 11 111 112| Value| Description| 113| -------- | -------- | 114| PERMISSION_DENIED | Permission verification failed.| 115| PARAMETER_ERROR | Parameter check failed. For example, a mandatory parameter is not passed in, or the parameter type passed in is incorrect.| 116| UNSUPPORTED | The device does not support this API. Generally, this enumerated value is used for a device that supports the corresponding system capability but only parts of APIs.| 117| DEVICE_OPERATION_FAILED | Device operation failed.| 118 119 120### Vibrator_Usage 121 122``` 123enum Vibrator_Usage 124``` 125**Description** 126 127Defines an enum for vibration scenarios. 128 129**Since**: 11 130 131| Value| Description| 132| -------- | -------- | 133| USAGE_UNKNOWN | Unknown scenario.| 134| USAGE_ALARM | Vibration for alarms.| 135| USAGE_RING | Vibration for incoming calls.| 136| USAGE_NOTIFICATION | Vibration for notifications.| 137| USAGE_COMMUNICATION | Vibration for communication.| 138| USAGE_TOUCH | Touch vibration scenario.| 139| USAGE_MEDIA | Multimedia vibration scenario.| 140| USAGE_PHYSICAL_FEEDBACK | Physical feedback vibration scenario.| 141| USAGE_SIMULATE_REALITY | Simulated reality vibration scenario.| 142