• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GetSingleStreamVolumeImpl(float &volume) override;
37 
38 private:
39     sptr<IStandardClientTracker> listener_ = nullptr;
40 };
41 
42 class AudioClientTrackerCallbackProxy : public IRemoteProxy<IStandardClientTracker> {
43 public:
44     explicit AudioClientTrackerCallbackProxy(const sptr<IRemoteObject> &impl);
45     virtual ~AudioClientTrackerCallbackProxy() = default;
46     virtual void PausedStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) override;
47     virtual void ResumeStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) override;
48 
49     virtual void SetLowPowerVolumeImpl(float volume) override;
50     virtual void GetLowPowerVolumeImpl(float &volume) override;
51     virtual void GetSingleStreamVolumeImpl(float &volume) override;
52 
53 private:
54     static inline BrokerDelegator<AudioClientTrackerCallbackProxy> delegator_;
55 };
56 } // namespace AudioStandard
57 } // namespace OHOS
58 #endif // ST_AUDIO_CLIENT_TRACKER_CALLBACK_PROXY_H
59