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