158ec469eSopenharmony_ci/*
258ec469eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
358ec469eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
458ec469eSopenharmony_ci * you may not use this file except in compliance with the License.
558ec469eSopenharmony_ci * You may obtain a copy of the License at
658ec469eSopenharmony_ci *
758ec469eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
858ec469eSopenharmony_ci *
958ec469eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1058ec469eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1158ec469eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1258ec469eSopenharmony_ci * See the License for the specific language governing permissions and
1358ec469eSopenharmony_ci * limitations under the License.
1458ec469eSopenharmony_ci */
1558ec469eSopenharmony_ci
1658ec469eSopenharmony_ci/**
1758ec469eSopenharmony_ci * @addtogroup Vibrator
1858ec469eSopenharmony_ci * @{
1958ec469eSopenharmony_ci *
2058ec469eSopenharmony_ci * @brief Provides APIs for vibrator services to access the vibrator driver.
2158ec469eSopenharmony_ci * @since 11
2258ec469eSopenharmony_ci */
2358ec469eSopenharmony_ci
2458ec469eSopenharmony_ci/**
2558ec469eSopenharmony_ci * @file vibrator.h
2658ec469eSopenharmony_ci * @kit SensorServiceKit
2758ec469eSopenharmony_ci * @brief Declares the APIs for starting or stopping vibration.
2858ec469eSopenharmony_ci * @library libohvibrator.z.so
2958ec469eSopenharmony_ci * @syscap SystemCapability.Sensors.MiscDevice
3058ec469eSopenharmony_ci * @since 11
3158ec469eSopenharmony_ci */
3258ec469eSopenharmony_ci
3358ec469eSopenharmony_ci#ifndef VIBRATOR_H
3458ec469eSopenharmony_ci#define VIBRATOR_H
3558ec469eSopenharmony_ci
3658ec469eSopenharmony_ci#include "vibrator_type.h"
3758ec469eSopenharmony_ci
3858ec469eSopenharmony_ci#ifdef __cplusplus
3958ec469eSopenharmony_ciextern "C" {
4058ec469eSopenharmony_ci#endif
4158ec469eSopenharmony_ci
4258ec469eSopenharmony_ci/**
4358ec469eSopenharmony_ci * @brief Controls the vibrator to vibrate continuously for a given duration.
4458ec469eSopenharmony_ci *
4558ec469eSopenharmony_ci * @param duration - Vibration duration, in milliseconds.
4658ec469eSopenharmony_ci * @param attribute - Vibration attribute. For details, see {@link Vibrator_Attribute}.
4758ec469eSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise.
4858ec469eSopenharmony_ci * For details, see {@link Vibrator_ErrorCode}.
4958ec469eSopenharmony_ci * @permission ohos.permission.VIBRATE
5058ec469eSopenharmony_ci *
5158ec469eSopenharmony_ci * @since 11
5258ec469eSopenharmony_ci */
5358ec469eSopenharmony_ciint32_t OH_Vibrator_PlayVibration(int32_t duration, Vibrator_Attribute attribute);
5458ec469eSopenharmony_ci
5558ec469eSopenharmony_ci/**
5658ec469eSopenharmony_ci * @brief Controls the vibrator to vibrate with the custom sequence.
5758ec469eSopenharmony_ci *
5858ec469eSopenharmony_ci * @param fileDescription - File descriptor of the custom vibration effect.
5958ec469eSopenharmony_ci * For details, see {@link Vibrator_FileDescription}.
6058ec469eSopenharmony_ci * @param vibrateAttribute - Vibration attribute. For details, see {@link Vibrator_Attribute}.
6158ec469eSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise.
6258ec469eSopenharmony_ci * For details, see {@link Vibrator_ErrorCode}.
6358ec469eSopenharmony_ci * @permission ohos.permission.VIBRATE
6458ec469eSopenharmony_ci *
6558ec469eSopenharmony_ci * @since 11
6658ec469eSopenharmony_ci */
6758ec469eSopenharmony_ciint32_t OH_Vibrator_PlayVibrationCustom(Vibrator_FileDescription fileDescription,
6858ec469eSopenharmony_ci    Vibrator_Attribute vibrateAttribute);
6958ec469eSopenharmony_ci
7058ec469eSopenharmony_ci/**
7158ec469eSopenharmony_ci * @brief Stop the motor vibration according to the input mode.
7258ec469eSopenharmony_ci *
7358ec469eSopenharmony_ci * @permission ohos.permission.VIBRATE
7458ec469eSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise.
7558ec469eSopenharmony_ci * For details, see {@link Vibrator_ErrorCode}.
7658ec469eSopenharmony_ci * @permission ohos.permission.VIBRATE
7758ec469eSopenharmony_ci *
7858ec469eSopenharmony_ci * @since 11
7958ec469eSopenharmony_ci */
8058ec469eSopenharmony_ciint32_t OH_Vibrator_Cancel();
8158ec469eSopenharmony_ci#ifdef __cplusplus
8258ec469eSopenharmony_ci}
8358ec469eSopenharmony_ci#endif
8458ec469eSopenharmony_ci/** @} */
8558ec469eSopenharmony_ci#endif // endif VIBRATOR_H