• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ST_AUDIO_SERVER_PROXY_H
18 #define ST_AUDIO_SERVER_PROXY_H
19 
20 #include <bitset>
21 #include <list>
22 #include <string>
23 #include <unordered_map>
24 #include <unordered_set>
25 #include <mutex>
26 #include "singleton.h"
27 #include "audio_group_handle.h"
28 #include "audio_manager_base.h"
29 #include "audio_module_info.h"
30 #include "audio_ec_info.h"
31 #include "datashare_helper.h"
32 #include "audio_errors.h"
33 
34 #include "ipc_skeleton.h"
35 
36 namespace OHOS {
37 namespace AudioStandard {
38 class AudioServerProxy {
39 public:
GetInstance()40     static AudioServerProxy& GetInstance()
41     {
42         static AudioServerProxy instance;
43         return instance;
44     }
45     const sptr<IStandardAudioService> GetAudioServerProxy();
46     int32_t SetAudioSceneProxy(AudioScene audioScene, std::vector<DeviceType> activeOutputDevices,
47         DeviceType deviceType, BluetoothOffloadState state);
48     float GetMaxAmplitudeProxy(bool flag, std::string portName, SourceType sourceType = SOURCE_TYPE_INVALID);
49     void UpdateEffectBtOffloadSupportedProxy(const bool &isSupported);
50     void SetOutputDeviceSinkProxy(DeviceType deviceType, std::string sinkName);
51     bool GetEffectOffloadEnabledProxy();
52     int32_t UpdateActiveDevicesRouteProxy(std::vector<std::pair<DeviceType, DeviceFlag>> &activeDevices,
53         BluetoothOffloadState state, const std::string &deviceName = "");
54     int32_t UpdateDualToneStateProxy(const bool &enable, const int32_t &sessionId);
55     void UpdateSessionConnectionStateProxy(const int32_t &sessionID, const int32_t &state);
56     int32_t CheckRemoteDeviceStateProxy(std::string networkId, DeviceRole deviceRole, bool isStartDevice);
57     void SetAudioParameterProxy(const std::string &key, const std::string &value);
58     void ResetAudioEndpointProxy();
59     bool NotifyStreamVolumeChangedProxy(AudioStreamType streamType, float volume);
60     void OffloadSetVolumeProxy(float volume);
61     void SetVoiceVolumeProxy(float volume);
62     void UnsetOffloadModeProxy(uint32_t sessionId);
63     void SetOffloadModeProxy(uint32_t sessionId, int32_t state, bool isAppBack);
64     void CheckHibernateStateProxy(bool hibernate);
65     void RestoreSessionProxy(const uint32_t &sessionID, RestoreInfo RestoreInfo);
66     int32_t GetAudioEnhancePropertyProxy(AudioEnhancePropertyArray &propertyArray,
67         DeviceType deviceType = DEVICE_TYPE_NONE);
68     int32_t SetAudioEnhancePropertyProxy(const AudioEnhancePropertyArray &propertyArray,
69         DeviceType deviceType = DEVICE_TYPE_NONE);
70     void SetSinkMuteForSwitchDeviceProxy(const std::string &devceClass, int32_t durationUs, bool mute);
71     int32_t SetMicrophoneMuteProxy(bool isMute);
72     void SuspendRenderSinkProxy(const std::string &sinkName);
73     void RestoreRenderSinkProxy(const std::string &sinkName);
74     void LoadHdiEffectModelProxy();
75     void NotifyDeviceInfoProxy(std::string networkId, bool connected);
76     std::string GetAudioParameterProxy(const std::string &key);
77     std::string GetAudioParameterProxy(const std::string& networkId, const AudioParamKey key,
78         const std::string& condition);
79     void ResetRouteForDisconnectProxy(DeviceType type);
80     bool CreatePlaybackCapturerManagerProxy();
81     bool LoadAudioEffectLibrariesProxy(const std::vector<Library> libraries, const std::vector<Effect> effects,
82         std::vector<Effect>& successEffectList);
83     bool CreateEffectChainManagerProxy(std::vector<EffectChain> &effectChains,
84     const EffectChainManagerParam &effectParam, const EffectChainManagerParam &enhanceParam);
85     int32_t RegiestPolicyProviderProxy(const sptr<IRemoteObject> &object);
86     void SetParameterCallbackProxy(const sptr<IRemoteObject>& object);
87     int32_t SetAudioEffectPropertyProxy(const AudioEffectPropertyArrayV3 &propertyArray,
88         const DeviceType& deviceType = DEVICE_TYPE_NONE);
89     int32_t GetAudioEffectPropertyProxy(AudioEffectPropertyArrayV3 &propertyArray);
90     int32_t SetAudioEffectPropertyProxy(const AudioEffectPropertyArray &propertyArray);
91     int32_t GetAudioEffectPropertyProxy(AudioEffectPropertyArray &propertyArray);
92     void SetRotationToEffectProxy(const uint32_t rotate);
93     void SetAudioMonoStateProxy(bool audioMono);
94     void SetAudioBalanceValueProxy(float audioBalance);
95     void NotifyAccountsChanged();
96     void GetAllSinkInputsProxy(std::vector<SinkInput> &sinkInputs);
97     void NotifyAudioPolicyReady();
98     void SetDefaultAdapterEnableProxy(bool isEnable);
99 #ifdef HAS_FEATURE_INNERCAPTURER
100     int32_t SetInnerCapLimitProxy(uint32_t innerCapLimit);
101 #endif
102     int32_t LoadHdiAdapterProxy(uint32_t devMgrType, const std::string &adapterName);
103     void UnloadHdiAdapterProxy(uint32_t devMgrType, const std::string &adapterName, bool force);
104     void SetDeviceConnectedFlag(bool flag);
105     void NotifySettingsDataReady();
106 private:
AudioServerProxy()107     AudioServerProxy() {}
~AudioServerProxy()108     ~AudioServerProxy() {}
109 private:
110     std::mutex adProxyMutex_;
111 };
112 }
113 }
114 #endif