• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-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 #include <cinttypes>
16 #include "bluetooth_def.h"
17 #include "bluetooth_errorcode.h"
18 #include "bluetooth_hitrace.h"
19 #include "bluetooth_log.h"
20 #include "bluetooth_utils_server.h"
21 #include "hisysevent.h"
22 #include "interface_profile_manager.h"
23 #include "interface_profile_a2dp_src.h"
24 #include "remote_observer_list.h"
25 #include "interface_adapter_manager.h"
26 #include "permission_utils.h"
27 #include "bluetooth_a2dp_source_server.h"
28 
29 namespace OHOS {
30 namespace Bluetooth {
31 class A2dpSourceObserver : public IA2dpObserver {
32 public:
33     A2dpSourceObserver() = default;
34     ~A2dpSourceObserver() override = default;
35 
OnConnectionStateChanged(const RawAddress & device,int state)36     void OnConnectionStateChanged(const RawAddress &device, int state) override
37     {
38         HILOGI("addr: %{public}s, state: %{public}d", GET_ENCRYPT_ADDR(device), state);
39         if (state == static_cast<int>(BTConnectState::CONNECTED) ||
40             state == static_cast<int>(BTConnectState::DISCONNECTED)) {
41             HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::BT_SERVICE, "A2DP_CONNECTED_STATE",
42                 OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, "STATE", state);
43         }
44         observers_->ForEach([device, state](sptr<IBluetoothA2dpSourceObserver> observer) {
45             observer->OnConnectionStateChanged(device, state,
46                 static_cast<uint32_t>(ConnChangeCause::CONNECT_CHANGE_COMMON_CAUSE));
47         });
48     }
49 
OnCaptureConnectionStateChanged(const RawAddress & device,int state,const A2dpSrcCodecInfo & info)50     void OnCaptureConnectionStateChanged(const RawAddress &device, int state, const A2dpSrcCodecInfo &info) override
51     {
52         HILOGI("addr: %{public}s, state: %{public}d", GET_ENCRYPT_ADDR(device), state);
53         observers_->ForEach([device, state, info](sptr<IBluetoothA2dpSourceObserver> observer) {
54             BluetoothA2dpCodecInfo tmpInfo {};
55             tmpInfo.bitsPerSample = info.bitsPerSample;
56             tmpInfo.channelMode = info.channelMode;
57             tmpInfo.codecType = info.codecType;
58             tmpInfo.sampleRate = info.sampleRate;
59             observer->OnCaptureConnectionStateChanged(device, state, tmpInfo);
60         });
61     }
62 
OnPlayingStatusChaned(const RawAddress & device,int playingState,int error)63     void OnPlayingStatusChaned(const RawAddress &device, int playingState, int error) override
64     {
65         HILOGI("addr: %{public}s, state: %{public}d, error: %{public}d",
66             GET_ENCRYPT_ADDR(device), playingState, error);
67         observers_->ForEach([device, playingState, error](sptr<IBluetoothA2dpSourceObserver> observer) {
68             observer->OnPlayingStatusChanged(device, playingState, error);
69         });
70     }
71 
OnConfigurationChanged(const RawAddress & device,const A2dpSrcCodecInfo & info,int error)72     void OnConfigurationChanged(const RawAddress &device, const A2dpSrcCodecInfo &info, int error) override
73     {
74         HILOGI("addr: %{public}s, error: %{public}d", GET_ENCRYPT_ADDR(device), error);
75         observers_->ForEach([device, info, error](sptr<IBluetoothA2dpSourceObserver> observer) {
76             BluetoothA2dpCodecInfo  tmpInfo {};
77             tmpInfo.bitsPerSample = info.bitsPerSample;
78             tmpInfo.channelMode = info.channelMode;
79             tmpInfo.codecPriority = info.codecPriority;
80             tmpInfo.codecType = info.codecType;
81             tmpInfo.sampleRate = info.sampleRate;
82             tmpInfo.codecSpecific1 = info.codecSpecific1;
83             tmpInfo.codecSpecific2 = info.codecSpecific2;
84             tmpInfo.codecSpecific3 = info.codecSpecific3;
85             tmpInfo.codecSpecific4 = info.codecSpecific4;
86 
87             observer->OnConfigurationChanged(device, tmpInfo, error);
88         });
89     }
90 
OnMediaStackChanged(const RawAddress & device,int action)91     void OnMediaStackChanged(const RawAddress &device, int action) override
92     {
93         HILOGI("addr: %{public}s, action: %{public}d", GET_ENCRYPT_ADDR(device), action);
94     }
95 
SetObserver(RemoteObserverList<IBluetoothA2dpSourceObserver> * observers)96     void SetObserver(RemoteObserverList<IBluetoothA2dpSourceObserver> *observers)
97     {
98         observers_ = observers;
99     }
100 
101 private:
102     RemoteObserverList<IBluetoothA2dpSourceObserver> *observers_;
103 };
104 
105 struct BluetoothA2dpSourceServer::impl {
106     impl();
107     ~impl();
108 
109     /// sys state observer
110     class SystemStateObserver;
111     std::unique_ptr<SystemStateObserver> systemStateObserver_ = nullptr;
112 
113     RemoteObserverList<IBluetoothA2dpSourceObserver> observers_;
114     std::unique_ptr<A2dpSourceObserver> observerImp_{std::make_unique<A2dpSourceObserver>()};
115     IProfileA2dpSrc *a2dpSrcService_ = nullptr;
116 };
117 
118 class BluetoothA2dpSourceServer::impl::SystemStateObserver : public ISystemStateObserver {
119 public:
SystemStateObserver(BluetoothA2dpSourceServer::impl * pimpl)120     SystemStateObserver(BluetoothA2dpSourceServer::impl *pimpl) : pimpl_(pimpl) {};
121     ~SystemStateObserver() override = default;
122 
OnSystemStateChange(const BTSystemState state)123     void OnSystemStateChange(const BTSystemState state) override
124     {
125         IProfileManager *serviceMgr = IProfileManager::GetInstance();
126         if (!pimpl_) {
127             HILOGI("failed: pimpl_ is null");
128             return;
129         }
130 
131         switch (state) {
132             case BTSystemState::ON:
133                 if (serviceMgr != nullptr) {
134                     pimpl_->a2dpSrcService_ =
135                         (IProfileA2dpSrc *)serviceMgr->GetProfileService(PROFILE_NAME_A2DP_SRC);
136                     if (pimpl_->a2dpSrcService_ != nullptr) {
137                         pimpl_->a2dpSrcService_->RegisterObserver(pimpl_->observerImp_.get());
138                     }
139                 }
140                 break;
141             case BTSystemState::OFF:
142                 pimpl_->a2dpSrcService_ = nullptr;
143                 break;
144             default:
145                 break;
146         }
147     }
148 
149 private:
150     BluetoothA2dpSourceServer::impl *pimpl_ = nullptr;
151 };
152 
impl()153 BluetoothA2dpSourceServer::impl::impl()
154 {
155     HILOGI("starts");
156 }
157 
~impl()158 BluetoothA2dpSourceServer::impl::~impl()
159 {
160     HILOGI("starts");
161 }
162 
BluetoothA2dpSourceServer()163 BluetoothA2dpSourceServer::BluetoothA2dpSourceServer()
164 {
165     HILOGI("starts");
166     pimpl = std::make_unique<impl>();
167     pimpl->observerImp_->SetObserver(&(pimpl->observers_));
168     pimpl->systemStateObserver_ = std::make_unique<impl::SystemStateObserver>(pimpl.get());
169     IAdapterManager::GetInstance()->RegisterSystemStateObserver(*(pimpl->systemStateObserver_));
170 
171     IProfileManager *serviceMgr = IProfileManager::GetInstance();
172     if (serviceMgr != nullptr) {
173         pimpl->a2dpSrcService_ = (IProfileA2dpSrc *)serviceMgr->GetProfileService(PROFILE_NAME_A2DP_SRC);
174         if (pimpl->a2dpSrcService_ != nullptr) {
175             pimpl->a2dpSrcService_->RegisterObserver(pimpl->observerImp_.get());
176         }
177     }
178 }
179 
~BluetoothA2dpSourceServer()180 BluetoothA2dpSourceServer::~BluetoothA2dpSourceServer()
181 {
182     HILOGI("starts");
183     IAdapterManager::GetInstance()->DeregisterSystemStateObserver(*(pimpl->systemStateObserver_));
184     if (pimpl->a2dpSrcService_ != nullptr) {
185         pimpl->a2dpSrcService_->DeregisterObserver(pimpl->observerImp_.get());
186     }
187 }
188 
RegisterObserver(const sptr<IBluetoothA2dpSourceObserver> & observer)189 void BluetoothA2dpSourceServer::RegisterObserver(const sptr<IBluetoothA2dpSourceObserver> &observer)
190 {
191     HILOGI("starts");
192     if (observer == nullptr) {
193         HILOGI("observer is null");
194         return;
195     }
196     auto func = std::bind(&BluetoothA2dpSourceServer::DeregisterObserver, this, std::placeholders::_1);
197     pimpl->observers_.Register(observer, func);
198     if (pimpl->a2dpSrcService_ == nullptr) {
199         return;
200     }
201     // During A2DP HDF Registration, check the current status and callback
202     RawAddress device = GetActiveSinkDevice();
203     int state = static_cast<int>(BTConnectState::DISCONNECTED);
204     GetDeviceState(static_cast<const RawAddress &>(device), state);
205     if (state == static_cast<int>(BTConnectState::CONNECTED)) {
206         HILOGI("onConnectionStateChanged");
207         observer->OnConnectionStateChanged(device, state,
208             static_cast<uint32_t>(ConnChangeCause::CONNECT_CHANGE_COMMON_CAUSE));
209     }
210 }
211 
DeregisterObserver(const sptr<IBluetoothA2dpSourceObserver> & observer)212 void BluetoothA2dpSourceServer::DeregisterObserver(const sptr<IBluetoothA2dpSourceObserver> &observer)
213 {
214     HILOGI("starts");
215     if (observer == nullptr) {
216         HILOGE("observer is null");
217         return;
218     }
219 
220     if (pimpl != nullptr) {
221         pimpl->observers_.Deregister(observer);
222     }
223 }
224 
Connect(const RawAddress & device)225 int32_t BluetoothA2dpSourceServer::Connect(const RawAddress &device)
226 {
227     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
228     if (!PermissionUtils::CheckSystemHapApp()) {
229         HILOGE("check system api failed.");
230         return BT_ERR_SYSTEM_PERMISSION_FAILED;
231     }
232     if (PermissionUtils::VerifyDiscoverBluetoothPermission() == PERMISSION_DENIED) {
233         HILOGE("Connect error, check permission failed");
234         return BT_ERR_SYSTEM_PERMISSION_FAILED;
235     }
236     OHOS::Bluetooth::BluetoothHiTrace::BluetoothStartAsyncTrace("A2DP_SRC_CONNECT", 1);
237     int32_t result = pimpl->a2dpSrcService_->Connect(device);
238     OHOS::Bluetooth::BluetoothHiTrace::BluetoothFinishAsyncTrace("A2DP_SRC_CONNECT", 1);
239     return result;
240 }
241 
Disconnect(const RawAddress & device)242 int32_t BluetoothA2dpSourceServer::Disconnect(const RawAddress &device)
243 {
244     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
245     if (!PermissionUtils::CheckSystemHapApp()) {
246         HILOGE("check system api failed.");
247         return BT_ERR_SYSTEM_PERMISSION_FAILED;
248     }
249     if (PermissionUtils::VerifyDiscoverBluetoothPermission() == PERMISSION_DENIED) {
250         HILOGE("Disconnect error, check permission failed");
251         return BT_ERR_SYSTEM_PERMISSION_FAILED;
252     }
253     return pimpl->a2dpSrcService_->Disconnect(device);
254 }
255 
GetDeviceState(const RawAddress & device,int & state)256 int BluetoothA2dpSourceServer::GetDeviceState(const RawAddress &device, int &state)
257 {
258     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
259     if (PermissionUtils::VerifyUseBluetoothPermission() == PERMISSION_DENIED) {
260         HILOGE("false, check permission failed");
261         return RET_NO_SUPPORT;
262     }
263     state = pimpl->a2dpSrcService_->GetDeviceState(device);
264     return NO_ERROR;
265 }
266 
GetDevicesByStates(const std::vector<int32_t> & states,std::vector<RawAddress> & rawAddrs)267 int BluetoothA2dpSourceServer::GetDevicesByStates(const std::vector<int32_t> &states, std::vector<RawAddress> &rawAddrs)
268 {
269     HILOGI("starts");
270     if (PermissionUtils::VerifyUseBluetoothPermission() == PERMISSION_DENIED) {
271         HILOGE("false, check permission failed");
272         return BT_ERR_PERMISSION_FAILED;
273     }
274     std::vector<int> tmpStates;
275     for (int32_t state : states) {
276         HILOGI("state = %{public}d", state);
277         tmpStates.push_back((int)state);
278     }
279 
280     rawAddrs = pimpl->a2dpSrcService_->GetDevicesByStates(tmpStates);
281     return NO_ERROR;
282 }
283 
GetPlayingState(const RawAddress & device,int & state)284 int32_t BluetoothA2dpSourceServer::GetPlayingState(const RawAddress &device, int &state)
285 {
286     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
287     if (PermissionUtils::VerifyUseBluetoothPermission() == PERMISSION_DENIED) {
288         HILOGE("false, check permission failed");
289         return BT_ERR_SYSTEM_PERMISSION_FAILED;
290     }
291     int ret = pimpl->a2dpSrcService_->GetPlayingState(device, state);
292     if (ret != NO_ERROR) {
293         return BT_ERR_INTERNAL_ERROR;
294     }
295     return NO_ERROR;
296 }
297 
SetConnectStrategy(const RawAddress & device,int strategy)298 int BluetoothA2dpSourceServer::SetConnectStrategy(const RawAddress &device, int strategy)
299 {
300     if (!PermissionUtils::CheckSystemHapApp()) {
301         HILOGE("check system api failed.");
302         return BT_ERR_SYSTEM_PERMISSION_FAILED;
303     }
304     HILOGI("addr: %{public}s, strategy: %{public}d", GET_ENCRYPT_ADDR(device), strategy);
305     return pimpl->a2dpSrcService_->SetConnectStrategy(device, strategy);
306 }
307 
GetConnectStrategy(const RawAddress & device,int & strategy)308 int BluetoothA2dpSourceServer::GetConnectStrategy(const RawAddress &device, int &strategy)
309 {
310     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
311     strategy = pimpl->a2dpSrcService_->GetConnectStrategy(device);
312     return NO_ERROR;
313 }
314 
SetActiveSinkDevice(const RawAddress & device)315 int BluetoothA2dpSourceServer::SetActiveSinkDevice(const RawAddress &device)
316 {
317     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
318     return pimpl->a2dpSrcService_->SetActiveSinkDevice(device);
319 }
320 
GetActiveSinkDevice()321 RawAddress BluetoothA2dpSourceServer::GetActiveSinkDevice()
322 {
323     HILOGI("starts");
324     return pimpl->a2dpSrcService_->GetActiveSinkDevice();
325 }
326 
GetCodecStatus(const RawAddress & device)327 BluetoothA2dpCodecStatus BluetoothA2dpSourceServer::GetCodecStatus(const RawAddress &device)
328 {
329     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
330     bluetooth::RawAddress addr(device.GetAddress());
331     bluetooth::A2dpSrcCodecStatus ret;
332     BluetoothA2dpCodecStatus codeStatus;
333     BluetoothA2dpCodecInfo serviceInfo;
334     ret = pimpl->a2dpSrcService_->GetCodecStatus(addr);
335 
336     codeStatus.codecInfo.codecPriority = ret.codecInfo.codecPriority;
337     codeStatus.codecInfo.codecType = ret.codecInfo.codecType;
338     codeStatus.codecInfo.sampleRate = ret.codecInfo.sampleRate;
339     codeStatus.codecInfo.bitsPerSample = ret.codecInfo.bitsPerSample;
340     codeStatus.codecInfo.channelMode = ret.codecInfo.channelMode;
341     codeStatus.codecInfo.codecSpecific1 = ret.codecInfo.codecSpecific1;
342     codeStatus.codecInfo.codecSpecific2 = ret.codecInfo.codecSpecific2;
343     codeStatus.codecInfo.codecSpecific3 = ret.codecInfo.codecSpecific3;
344     codeStatus.codecInfo.codecSpecific4 = ret.codecInfo.codecSpecific4;
345 
346     for (auto it = ret.codecInfoConfirmedCap.begin(); it != ret.codecInfoConfirmedCap.end(); it++) {
347         serviceInfo.codecPriority = it->codecPriority;
348         serviceInfo.codecType = it->codecType;
349         serviceInfo.sampleRate = it->sampleRate;
350         serviceInfo.bitsPerSample = it->bitsPerSample;
351         serviceInfo.channelMode = it->channelMode;
352         serviceInfo.codecSpecific1 = it->codecSpecific1;
353         serviceInfo.codecSpecific2 = it->codecSpecific2;
354         serviceInfo.codecSpecific3 = it->codecSpecific3;
355         serviceInfo.codecSpecific4 = it->codecSpecific4;
356         codeStatus.codecInfoConfirmCap.push_back(serviceInfo);
357     }
358 
359     for (auto it = ret.codecInfoLocalCap.begin(); it != ret.codecInfoLocalCap.end(); it++) {
360         serviceInfo.codecPriority = it->codecPriority;
361         serviceInfo.codecType = it->codecType;
362         serviceInfo.sampleRate = it->sampleRate;
363         serviceInfo.bitsPerSample = it->bitsPerSample;
364         serviceInfo.channelMode = it->channelMode;
365         serviceInfo.codecSpecific1 = it->codecSpecific1;
366         serviceInfo.codecSpecific2 = it->codecSpecific2;
367         serviceInfo.codecSpecific3 = it->codecSpecific3;
368         serviceInfo.codecSpecific4 = it->codecSpecific4;
369         codeStatus.codecInfoLocalCap.push_back(serviceInfo);
370     }
371 
372     return codeStatus;
373 }
374 
GetCodecPreference(const RawAddress & device,BluetoothA2dpCodecInfo & info)375 int BluetoothA2dpSourceServer::GetCodecPreference(const RawAddress &device, BluetoothA2dpCodecInfo &info)
376 {
377     return  NO_ERROR;
378 }
379 
SetCodecPreference(const RawAddress & device,const BluetoothA2dpCodecInfo & info)380 int BluetoothA2dpSourceServer::SetCodecPreference(const RawAddress &device, const BluetoothA2dpCodecInfo &info)
381 {
382     HILOGI("BluetoothA2dpSourceServer::SetCodecPreference starts, codecPriority = %{public}u,"
383            "codecPriority = %{public}u, sampleRate = %{public}u, bitsPerSample = %{public}d, "
384            "channelMode = %{public}d, codecSpecific1 = %{public}llu, codecSpecific2 = %{public}llu, "
385            "codecSpecific3 = %{public}llu, codecSpecific4 = %{public}llu",
386            info.codecPriority, info.codecType, info.sampleRate, info.bitsPerSample, info.channelMode,
387            (unsigned long long)info.codecSpecific1, (unsigned long long)info.codecSpecific2,
388            (unsigned long long)info.codecSpecific3, (unsigned long long)info.codecSpecific4);
389     bluetooth::A2dpSrcCodecInfo setInfo;
390 
391     setInfo.bitsPerSample = info.bitsPerSample;
392     setInfo.channelMode = info.channelMode;
393     setInfo.codecPriority = info.codecPriority;
394     setInfo.codecType = info.codecType;
395     setInfo.sampleRate = info.sampleRate;
396     setInfo.codecSpecific1 = info.codecSpecific1;
397     setInfo.codecSpecific2 = info.codecSpecific2;
398     setInfo.codecSpecific3 = info.codecSpecific3;
399     setInfo.codecSpecific4 = info.codecSpecific4;
400 
401     return pimpl->a2dpSrcService_->SetCodecPreference(device, setInfo);
402 }
403 
SwitchOptionalCodecs(const RawAddress & device,bool isEnable)404 void BluetoothA2dpSourceServer::SwitchOptionalCodecs(const RawAddress &device, bool isEnable)
405 {
406     HILOGI("addr: %{public}s, isEnable = %{public}d", GET_ENCRYPT_ADDR(device), isEnable);
407     pimpl->a2dpSrcService_->SwitchOptionalCodecs(device, isEnable);
408 }
409 
GetOptionalCodecsSupportState(const RawAddress & device)410 int BluetoothA2dpSourceServer::GetOptionalCodecsSupportState(const RawAddress &device)
411 {
412     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
413     return pimpl->a2dpSrcService_->GetOptionalCodecsSupportState(device);
414 }
415 
StartPlaying(const RawAddress & device)416 int BluetoothA2dpSourceServer::StartPlaying(const RawAddress &device)
417 {
418     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
419     return pimpl->a2dpSrcService_->StartPlaying(device);
420 }
421 
SuspendPlaying(const RawAddress & device)422 int BluetoothA2dpSourceServer::SuspendPlaying(const RawAddress &device)
423 {
424     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
425     return pimpl->a2dpSrcService_->SuspendPlaying(device);
426 }
427 
StopPlaying(const RawAddress & device)428 int BluetoothA2dpSourceServer::StopPlaying(const RawAddress &device)
429 {
430     HILOGI("addr: %{public}s", GET_ENCRYPT_ADDR(device));
431     return pimpl->a2dpSrcService_->StopPlaying(device);
432 }
433 
WriteFrame(const uint8_t * data,uint32_t size)434 int BluetoothA2dpSourceServer::WriteFrame(const uint8_t *data, uint32_t size)
435 {
436     HILOGI("size = %{public}u", size);
437     return pimpl->a2dpSrcService_->WriteFrame(data, size);
438 }
439 
GetRenderPosition(const RawAddress & device,uint32_t & delayValue,uint64_t & sendDataSize,uint32_t & timeStamp)440 int BluetoothA2dpSourceServer::GetRenderPosition(const RawAddress &device, uint32_t &delayValue, uint64_t &sendDataSize,
441                                                  uint32_t &timeStamp)
442 {
443     HILOGI("starts");
444     int ret = pimpl->a2dpSrcService_->GetRenderPosition(device, delayValue, sendDataSize, timeStamp);
445     HILOGI("delayValue = %{public}u, sendDataSize = %{public}" PRIu64 ", timeStamp = %{public}u", delayValue,
446         sendDataSize, timeStamp);
447     return ret;
448 }
449 
OffloadStartPlaying(const RawAddress & device,const std::vector<int32_t> & sessionsId)450 int BluetoothA2dpSourceServer::OffloadStartPlaying(const RawAddress &device, const std::vector<int32_t> &sessionsId)
451 {
452     return BT_ERR_API_NOT_SUPPORT;
453 }
454 
OffloadStopPlaying(const RawAddress & device,const std::vector<int32_t> & sessionsId)455 int BluetoothA2dpSourceServer::OffloadStopPlaying(const RawAddress &device, const std::vector<int32_t> &sessionsId)
456 {
457     return BT_ERR_API_NOT_SUPPORT;
458 }
A2dpOffloadSessionPathRequest(const RawAddress & device,const std::vector<BluetoothA2dpStreamInfo> & info)459 int BluetoothA2dpSourceServer::A2dpOffloadSessionPathRequest(const RawAddress &device,
460     const std::vector<BluetoothA2dpStreamInfo> &info)
461 {
462     return BT_ERR_API_NOT_SUPPORT;
463 }
464 
GetOffloadCodecStatus(const RawAddress & device)465 BluetoothA2dpOffloadCodecStatus BluetoothA2dpSourceServer::GetOffloadCodecStatus(const RawAddress &device)
466 {
467     BluetoothA2dpOffloadCodecStatus ret;
468     HILOGI("enter");
469     return ret;
470 }
471 
EnableAutoPlay(const RawAddress & device)472 int BluetoothA2dpSourceServer::EnableAutoPlay(const RawAddress &device)
473 {
474     return BT_ERR_API_NOT_SUPPORT;
475 }
476 
DisableAutoPlay(const RawAddress & device,const int duration)477 int BluetoothA2dpSourceServer::DisableAutoPlay(const RawAddress &device, const int duration)
478 {
479     return BT_ERR_API_NOT_SUPPORT;
480 }
481 
GetAutoPlayDisabledDuration(const RawAddress & device,int & duration)482 int BluetoothA2dpSourceServer::GetAutoPlayDisabledDuration(const RawAddress &device, int &duration)
483 {
484     return BT_ERR_API_NOT_SUPPORT;
485 }
486 
GetVirtualDeviceList(std::vector<std::string> & devices)487 void BluetoothA2dpSourceServer::GetVirtualDeviceList(std::vector<std::string> &devices)
488 {
489     return;
490 }
491 
UpdateVirtualDevice(int32_t action,const std::string & address)492 void BluetoothA2dpSourceServer::UpdateVirtualDevice(int32_t action, const std::string &address)
493 {
494     return;
495 }
496 }  // namespace Bluetooth
497 }  // namespace OHOS
498