• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef LOG_TAG
16 #define LOG_TAG "AudioClientTrackerCallbackListener"
17 #endif
18 
19 #include "audio_policy_log.h"
20 #include "audio_client_tracker_callback_listener.h"
21 #include "audio_errors.h"
22 
23 namespace OHOS {
24 namespace AudioStandard {
25 
ClientTrackerCallbackListener(const sptr<IStandardClientTracker> & listener)26 ClientTrackerCallbackListener::ClientTrackerCallbackListener(const sptr<IStandardClientTracker> &listener)
27     : listener_(listener)
28 {
29 }
30 
~ClientTrackerCallbackListener()31 ClientTrackerCallbackListener::~ClientTrackerCallbackListener()
32 {
33 }
34 
MuteStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)35 void ClientTrackerCallbackListener::MuteStreamImpl(
36     const StreamSetStateEventInternal &streamSetStateEventInternal)
37 {
38     if (listener_ != nullptr) {
39         listener_->MuteStreamImpl(streamSetStateEventInternal);
40     }
41 }
42 
UnmuteStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)43 void ClientTrackerCallbackListener::UnmuteStreamImpl(
44     const StreamSetStateEventInternal &streamSetStateEventInternal)
45 {
46     if (listener_ != nullptr) {
47         listener_->UnmuteStreamImpl(streamSetStateEventInternal);
48     }
49 }
50 
PausedStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)51 void ClientTrackerCallbackListener::PausedStreamImpl(
52     const StreamSetStateEventInternal &streamSetStateEventInternal)
53 {
54     if (listener_ != nullptr) {
55         listener_->PausedStreamImpl(streamSetStateEventInternal);
56     }
57 }
58 
ResumeStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)59 void ClientTrackerCallbackListener::ResumeStreamImpl(
60     const StreamSetStateEventInternal &streamSetStateEventInternal)
61 {
62     if (listener_ != nullptr) {
63         listener_->ResumeStreamImpl(streamSetStateEventInternal);
64     }
65 }
66 
SetLowPowerVolumeImpl(float volume)67 void ClientTrackerCallbackListener::SetLowPowerVolumeImpl(float volume)
68 {
69     if (listener_ != nullptr) {
70         listener_->SetLowPowerVolumeImpl(volume);
71     }
72 }
73 
GetLowPowerVolumeImpl(float & volume)74 void ClientTrackerCallbackListener::GetLowPowerVolumeImpl(float &volume)
75 {
76     if (listener_ != nullptr) {
77         listener_->GetLowPowerVolumeImpl(volume);
78     }
79 }
80 
GetSingleStreamVolumeImpl(float & volume)81 void ClientTrackerCallbackListener::GetSingleStreamVolumeImpl(float &volume)
82 {
83     if (listener_ != nullptr) {
84         listener_->GetSingleStreamVolumeImpl(volume);
85     }
86 }
87 
SetOffloadModeImpl(int32_t state,bool isAppBack)88 void ClientTrackerCallbackListener::SetOffloadModeImpl(int32_t state, bool isAppBack)
89 {
90     if (listener_ != nullptr) {
91         listener_->SetOffloadModeImpl(state, isAppBack);
92     }
93 }
94 
UnsetOffloadModeImpl()95 void ClientTrackerCallbackListener::UnsetOffloadModeImpl()
96 {
97     if (listener_ != nullptr) {
98         listener_->UnsetOffloadModeImpl();
99     }
100 }
101 
102 } // namespace AudioStandard
103 } // namespace OHOS