1 /* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef I_MISCDEVICE_SERVICE_H 17 #define I_MISCDEVICE_SERVICE_H 18 19 #include <string> 20 #include <vector> 21 22 #include "iremote_broker.h" 23 24 #include "light_agent_type.h" 25 #include "light_animation_ipc.h" 26 #include "light_info_ipc.h" 27 #include "miscdevice_common.h" 28 #include "raw_file_descriptor.h" 29 #include "sensors_ipc_interface_code.h" 30 #include "vibrator_infos.h" 31 32 namespace OHOS { 33 namespace Sensors { 34 class IMiscdeviceService : public IRemoteBroker { 35 public: 36 IMiscdeviceService() = default; 37 virtual ~IMiscdeviceService() = default; 38 DECLARE_INTERFACE_DESCRIPTOR(u"IMiscdeviceService"); 39 virtual int32_t Vibrate(int32_t vibratorId, int32_t timeOut, int32_t usage, bool systemUsage) = 0; 40 virtual int32_t PlayVibratorEffect(int32_t vibratorId, const std::string &effect, 41 int32_t loopCount, int32_t usage, bool systemUsage) = 0; 42 #ifdef OHOS_BUILD_ENABLE_VIBRATOR_CUSTOM 43 virtual int32_t PlayVibratorCustom(int32_t vibratorId, const RawFileDescriptor &rawFd, int32_t usage, 44 bool systemUsage, const VibrateParameter ¶meter) = 0; 45 #endif // OHOS_BUILD_ENABLE_VIBRATOR_CUSTOM 46 virtual int32_t StopVibrator(int32_t vibratorId) = 0; 47 virtual int32_t StopVibrator(int32_t vibratorId, const std::string &mode) = 0; 48 virtual int32_t IsSupportEffect(const std::string &effect, bool &state) = 0; 49 virtual std::vector<LightInfoIPC> GetLightList() = 0; 50 virtual int32_t TurnOn(int32_t lightId, const LightColor &color, const LightAnimationIPC &animation) = 0; 51 virtual int32_t TurnOff(int32_t lightId) = 0; 52 virtual int32_t GetDelayTime(int32_t &delayTime) = 0; 53 virtual int32_t PlayPattern(const VibratePattern &pattern, int32_t usage, bool systemUsage, 54 const VibrateParameter ¶meter) = 0; 55 virtual int32_t TransferClientRemoteObject(const sptr<IRemoteObject> &vibratorClient) = 0; 56 virtual int32_t PlayPrimitiveEffect(int32_t vibratorId, const std::string &effect, int32_t intensity, 57 int32_t usage, bool systemUsage, int32_t count) = 0; 58 virtual int32_t GetVibratorCapacity(VibratorCapacity &capacity) = 0; 59 }; 60 } // namespace Sensors 61 } // namespace OHOS 62 #endif // I_MISCDEVICE_SERVICE_H 63