1 /* 2 * Copyright (c) 2021-2022 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 ST_AUDIO_POLICY_INTERFACE_H 17 #define ST_AUDIO_POLICY_INTERFACE_H 18 19 #include "audio_module_info.h" 20 #include "audio_info.h" 21 #include "audio_policy_manager.h" 22 #include "audio_policy_types.h" 23 #include "audio_session_callback.h" 24 25 #include <memory> 26 #include <string> 27 28 namespace OHOS { 29 namespace AudioStandard { 30 class IAudioPolicyInterface { 31 public: ~IAudioPolicyInterface()32 virtual ~IAudioPolicyInterface() {} 33 34 virtual bool Init() = 0; 35 36 virtual void InitKVStore() = 0; 37 38 virtual bool ConnectServiceAdapter() = 0; 39 40 virtual int32_t SetStreamVolume(AudioStreamType streamType, float volume) = 0; 41 42 virtual float GetStreamVolume(AudioStreamType streamType) = 0; 43 44 virtual int32_t SetStreamMute(AudioStreamType streamType, bool mute) = 0; 45 46 virtual bool GetStreamMute(AudioStreamType streamType) const = 0; 47 48 virtual bool IsStreamActive(AudioStreamType streamType) = 0; 49 50 virtual AudioIOHandle OpenAudioPort(const AudioModuleInfo &audioPortInfo) = 0; 51 52 virtual int32_t CloseAudioPort(AudioIOHandle ioHandle) = 0; 53 54 virtual int32_t SetDeviceActive(AudioIOHandle ioHandle, InternalDeviceType deviceType, 55 std::string name, bool active) = 0; 56 57 virtual int32_t SetRingerMode(AudioRingerMode ringerMode) = 0; 58 59 virtual AudioRingerMode GetRingerMode() const = 0; 60 61 virtual int32_t SetAudioSessionCallback(AudioSessionCallback *callback) = 0; 62 63 virtual int32_t SuspendAudioDevice(std::string &name, bool isSuspend) = 0; 64 }; 65 } // namespace AudioStandard 66 } // namespace OHOS 67 68 #endif // ST_AUDIO_POLICY_INTERFACE_H 69