• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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 "AudioA2dpOffloadFlag"
17 #endif
18 
19 #include "audio_a2dp_offload_flag.h"
20 #include <ability_manager_client.h>
21 #include "iservice_registry.h"
22 #include "parameter.h"
23 #include "parameters.h"
24 #include "audio_policy_log.h"
25 #include "audio_manager_listener_stub.h"
26 #include "audio_inner_call.h"
27 #include "media_monitor_manager.h"
28 
29 namespace OHOS {
30 namespace AudioStandard {
31 
OffloadStopPlaying(const std::vector<int32_t> & sessionIds)32 int32_t AudioA2dpOffloadFlag::OffloadStopPlaying(const std::vector<int32_t> &sessionIds)
33 {
34     return Bluetooth::AudioA2dpManager::OffloadStopPlaying(sessionIds);
35 }
36 
SetA2dpOffloadFlag(BluetoothOffloadState state)37 void AudioA2dpOffloadFlag::SetA2dpOffloadFlag(BluetoothOffloadState state)
38 {
39     a2dpOffloadFlag_ = state;
40 }
41 
GetA2dpOffloadFlag()42 BluetoothOffloadState AudioA2dpOffloadFlag::GetA2dpOffloadFlag()
43 {
44     return a2dpOffloadFlag_;
45 }
46 
OffloadStartPlaying(const std::vector<int32_t> & sessionIds)47 int32_t AudioA2dpOffloadFlag::OffloadStartPlaying(const std::vector<int32_t> &sessionIds)
48 {
49     return Bluetooth::AudioA2dpManager::OffloadStartPlaying(sessionIds);
50 }
51 
GetCurrentOffloadConnectedState()52 A2dpOffloadConnectionState AudioA2dpOffloadFlag::GetCurrentOffloadConnectedState()
53 {
54     return currentOffloadConnectionState_;
55 }
56 
SetCurrentOffloadConnectedState(A2dpOffloadConnectionState currentOffloadConnectionState)57 void AudioA2dpOffloadFlag::SetCurrentOffloadConnectedState(A2dpOffloadConnectionState currentOffloadConnectionState)
58 {
59     currentOffloadConnectionState_ = currentOffloadConnectionState;
60 }
61 
IsA2dpOffloadConnected()62 bool AudioA2dpOffloadFlag::IsA2dpOffloadConnected()
63 {
64     return currentOffloadConnectionState_ == CONNECTION_STATUS_CONNECTED;
65 }
66 
67 }
68 }