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
16 #include "bluetooth_a2dp_src_stub.h"
17 #include "bluetooth_log.h"
18 #include "bluetooth_errorcode.h"
19 #include "ipc_types.h"
20 #include "parcel_bt_uuid.h"
21 #include "raw_address.h"
22
23 namespace OHOS {
24 namespace Bluetooth {
25 using namespace OHOS::bluetooth;
26 const int32_t A2DP_MAX_SRC_CONNECTION_NUMS = 0x07;
BluetoothA2dpSrcStub()27 BluetoothA2dpSrcStub::BluetoothA2dpSrcStub()
28 {
29 HILOGD("%{public}s start.", __func__);
30 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_CONNECT)] =
31 &BluetoothA2dpSrcStub::ConnectInner;
32 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_DISCONNECT)] =
33 &BluetoothA2dpSrcStub::DisconnectInner;
34 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_REGISTER_OBSERVER)] =
35 &BluetoothA2dpSrcStub::RegisterObserverInner;
36 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_DEREGISTER_OBSERVER)] =
37 &BluetoothA2dpSrcStub::DeregisterObserverInner;
38 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_DEVICE_BY_STATES)] =
39 &BluetoothA2dpSrcStub::GetDevicesByStatesInner;
40 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_DEVICE_STATE)] =
41 &BluetoothA2dpSrcStub::GetDeviceStateInner;
42 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_PLAYING_STATE)] =
43 &BluetoothA2dpSrcStub::GetPlayingStateInner;
44 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_SET_CONNECT_STRATEGY)] =
45 &BluetoothA2dpSrcStub::SetConnectStrategyInner;
46 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_CONNECT_STRATEGY)] =
47 &BluetoothA2dpSrcStub::GetConnectStrategyInner;
48 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_SET_ACTIVE_SINK_DEVICE)] =
49 &BluetoothA2dpSrcStub::SetActiveSinkDeviceInner;
50 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_ACTIVE_SINK_DEVICE)] =
51 &BluetoothA2dpSrcStub::GetActiveSinkDeviceInner;
52 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_CODEC_STATUS)] =
53 &BluetoothA2dpSrcStub::GetCodecStatusInner;
54 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_CODEC_PREFERENCE)] =
55 &BluetoothA2dpSrcStub::GetCodecPreferenceInner;
56 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_SET_CODEC_PREFERENCE)] =
57 &BluetoothA2dpSrcStub::SetCodecPreferenceInner;
58 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_SWITCH_OPTIONAL_CODECS)] =
59 &BluetoothA2dpSrcStub::SwitchOptionalCodecsInner;
60 memberFuncMap_[static_cast<uint32_t>(
61 BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_OPTIONAL_CODECS_SUPPORT_STATE)] =
62 &BluetoothA2dpSrcStub::GetOptionalCodecsSupportStateInner;
63 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_START_PLAYING)] =
64 &BluetoothA2dpSrcStub::StartPlayingInner;
65 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_SUSPEND_PLAYING)] =
66 &BluetoothA2dpSrcStub::SuspendPlayingInner;
67 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_STOP_PLAYING)] =
68 &BluetoothA2dpSrcStub::StopPlayingInner;
69 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_WRITE_FRAME)] =
70 &BluetoothA2dpSrcStub::WriteFrameInner;
71 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_RENDER_POSITION)] =
72 &BluetoothA2dpSrcStub::GetRenderPositionInner;
73 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_OFFLOAD_START_PLAYING)] =
74 &BluetoothA2dpSrcStub::OffloadStartPlayingInner;
75 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_OFFLOAD_STOP_PLAYING)] =
76 &BluetoothA2dpSrcStub::OffloadStopPlayingInner;
77 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_OFFLOAD_SESSION_REQUEST)] =
78 &BluetoothA2dpSrcStub::A2dpOffloadSessionPathRequestInner;
79 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_OFFLOAD_GET_CODEC_STATUS)] =
80 &BluetoothA2dpSrcStub::GetOffloadCodecStatusInner;
81 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_ENABLE_AUTO_PLAY)] =
82 &BluetoothA2dpSrcStub::EnableAutoPlayInner;
83 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_DISABLE_AUTO_PLAY)] =
84 &BluetoothA2dpSrcStub::DisableAutoPlayInner;
85 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_AUTO_PLAY_DISABLED_DURATION)] =
86 &BluetoothA2dpSrcStub::GetAutoPlayDisabledDurationInner;
87 memberFuncMap_[static_cast<uint32_t>(BluetoothA2dpSrcInterfaceCode::BT_A2DP_SRC_GET_VIRTUALDEVICE_LIST)] =
88 &BluetoothA2dpSrcStub::GetVirtualDeviceListInner;
89 }
90
~BluetoothA2dpSrcStub()91 BluetoothA2dpSrcStub::~BluetoothA2dpSrcStub()
92 {
93 HILOGD("%{public}s start.", __func__);
94 memberFuncMap_.clear();
95 }
96
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)97 int BluetoothA2dpSrcStub::OnRemoteRequest(
98 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
99 {
100 HILOGI("BluetoothA2dpSrcStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d", code, option.GetFlags());
101 if (BluetoothA2dpSrcStub::GetDescriptor() != data.ReadInterfaceToken()) {
102 HILOGI("local descriptor is not equal to remote");
103 return ERR_INVALID_STATE;
104 }
105 auto itFunc = memberFuncMap_.find(code);
106 if (itFunc != memberFuncMap_.end()) {
107 auto memberFunc = itFunc->second;
108 if (memberFunc != nullptr) {
109 return (this->*memberFunc)(data, reply);
110 }
111 }
112 HILOGW("BluetoothA2dpSrcStub::OnRemoteRequest, default case, need check.");
113 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
114 }
115
ConnectInner(MessageParcel & data,MessageParcel & reply)116 int32_t BluetoothA2dpSrcStub::ConnectInner(MessageParcel &data, MessageParcel &reply)
117 {
118 std::string addr = data.ReadString();
119
120 int32_t result = Connect(RawAddress(addr));
121
122 bool ret = reply.WriteInt32(result);
123 if (!ret) {
124 HILOGE("BluetoothA2dpSrcStub: ConnectInner reply writing failed in: %{public}s.", __func__);
125 return TRANSACTION_ERR;
126 }
127
128 return NO_ERROR;
129 }
130
DisconnectInner(MessageParcel & data,MessageParcel & reply)131 int32_t BluetoothA2dpSrcStub::DisconnectInner(MessageParcel &data, MessageParcel &reply)
132 {
133 std::string addr = data.ReadString();
134
135 int32_t result = Disconnect(RawAddress(addr));
136
137 bool ret = reply.WriteInt32(result);
138 if (!ret) {
139 HILOGE("BluetoothA2dpSrcStub: DisconnectInner reply writing failed in: %{public}s.", __func__);
140 return TRANSACTION_ERR;
141 }
142
143 return NO_ERROR;
144 }
145
RegisterObserverInner(MessageParcel & data,MessageParcel & reply)146 ErrCode BluetoothA2dpSrcStub::RegisterObserverInner(MessageParcel &data, MessageParcel &reply)
147 {
148 sptr<IRemoteObject> remote = data.ReadRemoteObject();
149 const sptr<IBluetoothA2dpSourceObserver> observer = OHOS::iface_cast<IBluetoothA2dpSourceObserver>(remote);
150 RegisterObserver(observer);
151
152 return NO_ERROR;
153 }
154
DeregisterObserverInner(MessageParcel & data,MessageParcel & reply)155 ErrCode BluetoothA2dpSrcStub::DeregisterObserverInner(MessageParcel &data, MessageParcel &reply)
156 {
157 sptr<IRemoteObject> remote = data.ReadRemoteObject();
158 const sptr<IBluetoothA2dpSourceObserver> observer = OHOS::iface_cast<IBluetoothA2dpSourceObserver>(remote);
159 DeregisterObserver(observer);
160
161 return NO_ERROR;
162 }
163
GetDevicesByStatesInner(MessageParcel & data,MessageParcel & reply)164 ErrCode BluetoothA2dpSrcStub::GetDevicesByStatesInner(MessageParcel &data, MessageParcel &reply)
165 {
166 std::vector<int32_t> states = {};
167 int32_t stateSize = data.ReadInt32();
168 if (stateSize > A2DP_MAX_SRC_CONNECTION_NUMS) {
169 return ERR_INVALID_DATA;
170 }
171
172 for (int i = 0; i < stateSize; i++) {
173 int32_t state = data.ReadInt32();
174 states.push_back(state);
175 }
176
177 std::vector<RawAddress> rawAdds;
178 int ret = GetDevicesByStates(states,rawAdds);
179 if (!reply.WriteInt32(ret)) {
180 HILOGE("reply WriteInt32 failed");
181 return TRANSACTION_ERR;
182 }
183
184 if (ret == NO_ERROR) {
185 if (!reply.WriteInt32(rawAdds.size())) {
186 HILOGE("reply WriteInt32 failed");
187 return TRANSACTION_ERR;
188 }
189 }
190
191 for (auto rawAdd : rawAdds) {
192 if (!reply.WriteString(rawAdd.GetAddress())) {
193 HILOGE("write WriteString failed");
194 return TRANSACTION_ERR;
195 }
196 }
197 return NO_ERROR;
198 }
199
GetDeviceStateInner(MessageParcel & data,MessageParcel & reply)200 ErrCode BluetoothA2dpSrcStub::GetDeviceStateInner(MessageParcel &data, MessageParcel &reply)
201 {
202 int state = 0;
203 std::string addr = data.ReadString();
204
205 int result = GetDeviceState(RawAddress(addr), state);
206 if (!reply.WriteInt32(result)) {
207 HILOGE("reply WriteInt32 failed");
208 return TRANSACTION_ERR;
209 }
210
211 if (result == NO_ERROR) {
212 if (!reply.WriteInt32(state)) {
213 HILOGE("reply WriteInt32 failed");
214 return TRANSACTION_ERR;
215 }
216 }
217 return NO_ERROR;
218 }
219
GetPlayingStateInner(MessageParcel & data,MessageParcel & reply)220 int32_t BluetoothA2dpSrcStub::GetPlayingStateInner(MessageParcel &data, MessageParcel &reply)
221 {
222 std::string addr = data.ReadString();
223 int32_t state = 0;
224 int32_t result = GetPlayingState(RawAddress(addr), state);
225
226 (void)reply.WriteInt32(result);
227 (void)reply.WriteInt32(state);
228 return NO_ERROR;
229 }
230
SetConnectStrategyInner(MessageParcel & data,MessageParcel & reply)231 ErrCode BluetoothA2dpSrcStub::SetConnectStrategyInner(MessageParcel &data, MessageParcel &reply)
232 {
233 std::string addr = data.ReadString();
234 int strategy = data.ReadInt32();
235
236 int result = SetConnectStrategy(RawAddress(addr), strategy);
237
238 bool ret = reply.WriteInt32(result);
239 if (!ret) {
240 HILOGE("BluetoothA2dpSrcStub: SetConnectStrategyInner reply writing failed in: %{public}s.", __func__);
241 return TRANSACTION_ERR;
242 }
243
244 return NO_ERROR;
245 }
246
GetConnectStrategyInner(MessageParcel & data,MessageParcel & reply)247 ErrCode BluetoothA2dpSrcStub::GetConnectStrategyInner(MessageParcel &data, MessageParcel &reply)
248 {
249 std::string addr = data.ReadString();
250 int strategy = 0;
251 int result = GetConnectStrategy(RawAddress(addr), strategy);
252
253 bool ret = reply.WriteInt32(result);
254 if (!ret) {
255 HILOGE("BluetoothA2dpSrcStub: GetConnectStrategyInner reply writing failed in: %{public}s.", __func__);
256 return TRANSACTION_ERR;
257 }
258
259 if (!reply.WriteInt32(strategy)) {
260 HILOGE("BluetoothA2dpSrcStub: GetConnectStrategyInner reply writing failed in: %{public}s.", __func__);
261 return TRANSACTION_ERR;
262 }
263
264 return NO_ERROR;
265 }
266
SetActiveSinkDeviceInner(MessageParcel & data,MessageParcel & reply)267 ErrCode BluetoothA2dpSrcStub::SetActiveSinkDeviceInner(MessageParcel &data, MessageParcel &reply)
268 {
269 std::string addr = data.ReadString();
270 int result = SetActiveSinkDevice(RawAddress(addr));
271
272 bool ret = reply.WriteInt32(result);
273 if (!ret) {
274 HILOGE("BluetoothA2dpSrcStub: SetActiveSinkDeviceInner reply writing failed in: %{public}s.", __func__);
275 return TRANSACTION_ERR;
276 }
277
278 return NO_ERROR;
279 }
280
GetActiveSinkDeviceInner(MessageParcel & data,MessageParcel & reply)281 ErrCode BluetoothA2dpSrcStub::GetActiveSinkDeviceInner(MessageParcel &data, MessageParcel &reply)
282 {
283 RawAddress adds = GetActiveSinkDevice();
284
285 if (!reply.WriteString(adds.GetAddress())) {
286 HILOGE("GetActiveSinkDeviceInner: write WriteString failed");
287 return ERR_INVALID_STATE;
288 }
289
290 return NO_ERROR;
291 }
292
GetCodecStatusInner(MessageParcel & data,MessageParcel & reply)293 ErrCode BluetoothA2dpSrcStub::GetCodecStatusInner(MessageParcel &data, MessageParcel &reply)
294 {
295 std::string addr = data.ReadString();
296 BluetoothA2dpCodecStatus result = GetCodecStatus(RawAddress(addr));
297
298 bool ret = reply.WriteParcelable(&result);
299 if (!ret) {
300 HILOGE("BluetoothA2dpSrcStub: GetCodecStatusInner reply writing failed in: %{public}s.", __func__);
301 return TRANSACTION_ERR;
302 }
303
304 return NO_ERROR;
305 }
306
GetCodecPreferenceInner(MessageParcel & data,MessageParcel & reply)307 int32_t BluetoothA2dpSrcStub::GetCodecPreferenceInner(MessageParcel &data, MessageParcel &reply)
308 {
309 HILOGI("NOT SUPPORT NOW");
310 return NO_ERROR;
311 }
312
SetCodecPreferenceInner(MessageParcel & data,MessageParcel & reply)313 int32_t BluetoothA2dpSrcStub::SetCodecPreferenceInner(MessageParcel &data, MessageParcel &reply)
314 {
315 std::string addr = data.ReadString();
316 std::shared_ptr<BluetoothA2dpCodecInfo> info(data.ReadParcelable<BluetoothA2dpCodecInfo>());
317 if (!info) {
318 return TRANSACTION_ERR;
319 }
320 int result = SetCodecPreference(RawAddress(addr), *info);
321
322 bool ret = reply.WriteInt32(result);
323 if (!ret) {
324 HILOGE("BluetoothA2dpSrcStub: SetCodecPreferenceInner reply writing failed in: %{public}s.", __func__);
325 return TRANSACTION_ERR;
326 }
327
328 return NO_ERROR;
329 }
330
SwitchOptionalCodecsInner(MessageParcel & data,MessageParcel & reply)331 ErrCode BluetoothA2dpSrcStub::SwitchOptionalCodecsInner(MessageParcel &data, MessageParcel &reply)
332 {
333 std::string addr = data.ReadString();
334 bool isEnable = data.ReadBool();
335 SwitchOptionalCodecs(RawAddress(addr), isEnable);
336 return NO_ERROR;
337 }
338
GetOptionalCodecsSupportStateInner(MessageParcel & data,MessageParcel & reply)339 ErrCode BluetoothA2dpSrcStub::GetOptionalCodecsSupportStateInner(MessageParcel &data, MessageParcel &reply)
340 {
341 std::string addr = data.ReadString();
342 int result = GetOptionalCodecsSupportState(RawAddress(addr));
343
344 bool ret = reply.WriteInt32(result);
345 if (!ret) {
346 HILOGE("BluetoothA2dpSrcStub: GetOptionalCodecsSupportStateInner reply writing failed in: %{public}s.",
347 __func__);
348 return TRANSACTION_ERR;
349 }
350
351 return NO_ERROR;
352 }
353
StartPlayingInner(MessageParcel & data,MessageParcel & reply)354 ErrCode BluetoothA2dpSrcStub::StartPlayingInner(MessageParcel &data, MessageParcel &reply)
355 {
356 std::string addr = data.ReadString();
357 int result = StartPlaying(RawAddress(addr));
358
359 bool ret = reply.WriteInt32(result);
360 if (!ret) {
361 HILOGE("BluetoothA2dpSrcStub: StartPlayingInner reply writing failed in: %{public}s.", __func__);
362 return TRANSACTION_ERR;
363 }
364
365 return NO_ERROR;
366 }
367
SuspendPlayingInner(MessageParcel & data,MessageParcel & reply)368 ErrCode BluetoothA2dpSrcStub::SuspendPlayingInner(MessageParcel &data, MessageParcel &reply)
369 {
370 std::string addr = data.ReadString();
371 int result = SuspendPlaying(RawAddress(addr));
372
373 bool ret = reply.WriteInt32(result);
374 if (!ret) {
375 HILOGE("BluetoothA2dpSrcStub: SuspendPlayingInner reply writing failed in: %{public}s.", __func__);
376 return TRANSACTION_ERR;
377 }
378
379 return NO_ERROR;
380 }
381
StopPlayingInner(MessageParcel & data,MessageParcel & reply)382 ErrCode BluetoothA2dpSrcStub::StopPlayingInner(MessageParcel &data, MessageParcel &reply)
383 {
384 std::string addr = data.ReadString();
385 int result = StopPlaying(RawAddress(addr));
386
387 bool ret = reply.WriteInt32(result);
388 if (!ret) {
389 HILOGE("BluetoothA2dpSrcStub: StopPlayingInner reply writing failed in: %{public}s.", __func__);
390 return TRANSACTION_ERR;
391 }
392
393 return NO_ERROR;
394 }
395
WriteFrameInner(MessageParcel & data,MessageParcel & reply)396 ErrCode BluetoothA2dpSrcStub::WriteFrameInner(MessageParcel &data, MessageParcel &reply)
397 {
398 std::vector<uint8_t> dataVector;
399 if (!data.ReadUInt8Vector(&dataVector)) {
400 HILOGE("BluetoothA2dpSrcStub: WriteFrameInner data reading failed in: %{public}s.", __func__);
401 return TRANSACTION_ERR;
402 }
403
404 int ret = WriteFrame(dataVector.data(), dataVector.size());
405 if (!reply.WriteInt32(ret)) {
406 HILOGE("BluetoothA2dpSrcStub: WriteFrameInner reply writing failed in: %{public}s.", __func__);
407 return TRANSACTION_ERR;
408 }
409
410 return NO_ERROR;
411 }
412
GetRenderPositionInner(MessageParcel & data,MessageParcel & reply)413 ErrCode BluetoothA2dpSrcStub::GetRenderPositionInner(MessageParcel &data, MessageParcel &reply)
414 {
415 uint32_t delayValue;
416 uint64_t sendDataSize;
417 uint32_t timeStamp;
418 int result = GetRenderPosition(RawAddress(data.ReadString()), delayValue, sendDataSize, timeStamp);
419 if (!reply.WriteUint32(result)) {
420 return TRANSACTION_ERR;
421 }
422 if (!reply.WriteUint32(delayValue)) {
423 HILOGE("BluetoothA2dpSrcStub: GetRenderPositionInner reply writing failed in: %{public}s.", __func__);
424 return TRANSACTION_ERR;
425 }
426 if (!reply.WriteUint64(sendDataSize)) {
427 HILOGE("BluetoothA2dpSrcStub: GetRenderPositionInner reply writing failed in: %{public}s.", __func__);
428 return TRANSACTION_ERR;
429 }
430 if (!reply.WriteUint32(timeStamp)) {
431 HILOGE("BluetoothA2dpSrcStub: GetRenderPositionInner reply writing failed in: %{public}s.", __func__);
432 return TRANSACTION_ERR;
433 }
434 return NO_ERROR;
435 }
436
OffloadStartPlayingInner(MessageParcel & data,MessageParcel & reply)437 ErrCode BluetoothA2dpSrcStub::OffloadStartPlayingInner(MessageParcel &data, MessageParcel &reply)
438 {
439 HILOGI("Not Support");
440 return BT_ERR_API_NOT_SUPPORT;
441 }
442
OffloadStopPlayingInner(MessageParcel & data,MessageParcel & reply)443 ErrCode BluetoothA2dpSrcStub::OffloadStopPlayingInner(MessageParcel &data, MessageParcel &reply)
444 {
445 HILOGI("Not Support");
446 return BT_ERR_API_NOT_SUPPORT;
447 }
448
A2dpOffloadSessionPathRequestInner(MessageParcel & data,MessageParcel & reply)449 ErrCode BluetoothA2dpSrcStub::A2dpOffloadSessionPathRequestInner(MessageParcel &data, MessageParcel &reply)
450 {
451 HILOGI("Not Support");
452 return BT_ERR_API_NOT_SUPPORT;
453 }
454
GetOffloadCodecStatusInner(MessageParcel & data,MessageParcel & reply)455 ErrCode BluetoothA2dpSrcStub::GetOffloadCodecStatusInner(MessageParcel &data, MessageParcel &reply)
456 {
457 HILOGI("Not Support");
458 return BT_ERR_API_NOT_SUPPORT;
459 }
460
EnableAutoPlayInner(MessageParcel & data,MessageParcel & reply)461 ErrCode BluetoothA2dpSrcStub::EnableAutoPlayInner(MessageParcel &data, MessageParcel &reply)
462 {
463 HILOGI("Not Support");
464 if (!reply.WriteInt32(BT_ERR_API_NOT_SUPPORT)) {
465 HILOGE("BluetoothA2dpSrcStub: WriteFrameInner reply writing failed in: %{public}s.", __func__);
466 return TRANSACTION_ERR;
467 }
468 return NO_ERROR;
469 }
470
DisableAutoPlayInner(MessageParcel & data,MessageParcel & reply)471 ErrCode BluetoothA2dpSrcStub::DisableAutoPlayInner(MessageParcel &data, MessageParcel &reply)
472 {
473 HILOGI("Not Support");
474 if (!reply.WriteInt32(BT_ERR_API_NOT_SUPPORT)) {
475 HILOGE("BluetoothA2dpSrcStub: WriteFrameInner reply writing failed in: %{public}s.", __func__);
476 return TRANSACTION_ERR;
477 }
478 return NO_ERROR;
479 }
480
GetAutoPlayDisabledDurationInner(MessageParcel & data,MessageParcel & reply)481 ErrCode BluetoothA2dpSrcStub::GetAutoPlayDisabledDurationInner(MessageParcel &data, MessageParcel &reply)
482 {
483 HILOGI("Not Support");
484 if (!reply.WriteInt32(BT_ERR_API_NOT_SUPPORT)) {
485 HILOGE("BluetoothA2dpSrcStub: WriteFrameInner reply writing failed in: %{public}s.", __func__);
486 return TRANSACTION_ERR;
487 }
488 return NO_ERROR;
489 }
490
GetVirtualDeviceListInner(MessageParcel & data,MessageParcel & reply)491 ErrCode BluetoothA2dpSrcStub::GetVirtualDeviceListInner(MessageParcel &data, MessageParcel &reply)
492 {
493 HILOGI("Not Support");
494 if (!reply.WriteInt32(BT_ERR_API_NOT_SUPPORT)) {
495 HILOGE("BluetoothA2dpSrcStub: WriteFrameInner reply writing failed in: %{public}s.", __func__);
496 return TRANSACTION_ERR;
497 }
498 return NO_ERROR;
499 }
500 } // namespace Bluetooth
501 } // namespace OHOS