1 /* 2 * Copyright (c) 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_CLIENT_TRACKER_CALLBACK_PROXY_H 17 #define ST_AUDIO_CLIENT_TRACKER_CALLBACK_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "audio_stream_manager.h" 21 #include "i_standard_client_tracker.h" 22 23 namespace OHOS { 24 namespace AudioStandard { 25 class ClientTrackerCallbackListener : public AudioClientTracker { 26 public: 27 explicit ClientTrackerCallbackListener(const sptr<IStandardClientTracker> &listener); 28 virtual ~ClientTrackerCallbackListener(); 29 DISALLOW_COPY_AND_MOVE(ClientTrackerCallbackListener); 30 31 virtual void PausedStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) override; 32 virtual void ResumeStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) override; 33 34 virtual void SetLowPowerVolumeImpl(float volume) override; 35 virtual void GetLowPowerVolumeImpl(float &volume) override; 36 virtual void SetOffloadModeImpl(int32_t state, bool isAppBack) override; 37 virtual void UnsetOffloadModeImpl() override; 38 virtual void GetSingleStreamVolumeImpl(float &volume) override; 39 40 private: 41 sptr<IStandardClientTracker> listener_ = nullptr; 42 }; 43 44 class AudioClientTrackerCallbackProxy : public IRemoteProxy<IStandardClientTracker> { 45 public: 46 explicit AudioClientTrackerCallbackProxy(const sptr<IRemoteObject> &impl); 47 virtual ~AudioClientTrackerCallbackProxy() = default; 48 virtual void PausedStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) override; 49 virtual void ResumeStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) override; 50 51 virtual void SetLowPowerVolumeImpl(float volume) override; 52 virtual void GetLowPowerVolumeImpl(float &volume) override; 53 virtual void SetOffloadModeImpl(int32_t state, bool isAppBack) override; 54 virtual void UnsetOffloadModeImpl() override; 55 virtual void GetSingleStreamVolumeImpl(float &volume) override; 56 57 private: 58 static inline BrokerDelegator<AudioClientTrackerCallbackProxy> delegator_; 59 }; 60 } // namespace AudioStandard 61 } // namespace OHOS 62 #endif // ST_AUDIO_CLIENT_TRACKER_CALLBACK_PROXY_H 63