diff --git a/interfaces/native/vibrator/include/vibrator_agent.h b/interfaces/native/vibrator/include/vibrator_agent.h index 0cc52546582f2ab4bbf90b5cb7bfe0b03c49d7ac..2a83f303f73a22c93413bc1ab2b44bd774629198 100755 --- a/interfaces/native/vibrator/include/vibrator_agent.h +++ b/interfaces/native/vibrator/include/vibrator_agent.h @@ -56,11 +56,7 @@ const char *VIBRATOR_STOP_MODE_PRESET = "preset"; * * @param effectId Indicates the preset vibration effect, which is described in {@link vibrator_agent_type.h}, for * example: - * {@link VIBRATOR_TYPE_CAMERA_LONG_PRESS}: describes the vibration effect of the vibrator when a user touches and holds - * the viewfinder. - * {@link VIBRATOR_TYPE_CAMERA_FOCUS}: describes the vibration effect of the vibrator when the camera is focusing. - * {@link VIBRATOR_TYPE_CONTROL_TEXT_EDIT}: describes the vibration effect of the vibrator when a user touches and holds - * the editing text. + * {@link VIBRATOR_TYPE_CLOCK_TIMER}: Describes the vibration effect of the vibrator when a user adjusts the timer. * @return Returns 0 if the vibrator vibrates as expected; returns -1 otherwise, for example, the preset * vibration effect is not supported. * @@ -103,6 +99,18 @@ int32_t DisableLooping(); * @since 6 */ int32_t StopVibrator(const char *mode); + +/** + * @brief Set the vibration usage. + * + * @param usage Indicates the vibration usage, which is described in {@link vibrator_agent_type.h},for + * example: + * {@link USAGE_ALARM}: Describes the vibration is used for alarm. + * @return Returns 0 if the usage is set successfully; returns -1 otherwise. + * + * @since 9 + */ +int32_t SetUsage(VibratorUsage usage); } // namespace Sensors } // namespace OHOS #ifdef __cplusplus diff --git a/interfaces/native/vibrator/include/vibrator_agent_type.h b/interfaces/native/vibrator/include/vibrator_agent_type.h index b0566727a5dfbbc07eeb4cbe0b6bf1a368bea637..6b7dc63358d827e3b115196f255ef2eadaf7bd4d 100755 --- a/interfaces/native/vibrator/include/vibrator_agent_type.h +++ b/interfaces/native/vibrator/include/vibrator_agent_type.h @@ -27,6 +27,23 @@ extern "C" { */ const char *VIBRATOR_TYPE_CLOCK_TIMER = "haptic.clock.timer"; +/** + * @brief Enumerates vibration usages. + * + * @since 9 + */ +typedef enum VibratorUsage { + USAGE_UNKNOWN = 0, /**< Vibration is used for unknown, lowest priority */ + USAGE_ALARM = 1, /**< Vibration is used for alarm */ + USAGE_RING = 2, /**< Vibration is used for ring */ + USAGE_NOTIFICATION = 3, /**< Vibration is used for notification */ + USAGE_COMMUNICATION = 4, /**< Vibration is used for communication */ + USAGE_TOUCH = 5, /**< Vibration is used for touch */ + USAGE_MEDIA = 6, /**< Vibration is used for media */ + USAGE_PHYSICAL_FEEDBACK = 7, /**< Vibration is used for physical feedback */ + USAGE_SIMULATE_REALITY = 8, /**< Vibration is used for simulate reality */ +} VibratorUsage; + /** @} */ #ifdef __cplusplus };