1 /*
2 * Copyright (C) 2021 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_avrcp_ct_stub.h"
17 #include "bluetooth_log.h"
18 #include "ipc_types.h"
19 #include "string_ex.h"
20
21 namespace OHOS {
22 namespace Bluetooth {
BluetoothAvrcpCtStub()23 BluetoothAvrcpCtStub::BluetoothAvrcpCtStub()
24 {
25 HILOGD("%{public}s start.", __func__);
26 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_REGISTER_OBSERVER)] =
27 &BluetoothAvrcpCtStub::RegisterObserverInner;
28 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_UNREGISTER_OBSERVER)] =
29 &BluetoothAvrcpCtStub::UnregisterObserverInner;
30 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_CONNECTED_DEVICES)] =
31 &BluetoothAvrcpCtStub::GetConnectedDevicesInner;
32 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_DEVICES_BY_STATES)] =
33 &BluetoothAvrcpCtStub::GetDevicesByStatesInner;
34 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_DEVICE_STATE)] =
35 &BluetoothAvrcpCtStub::GetDeviceStateInner;
36 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_CONNECT)] =
37 &BluetoothAvrcpCtStub::ConnectInner;
38 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_DISCONNECT)] =
39 &BluetoothAvrcpCtStub::DisconnectInner;
40 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_PRESS_BUTTON)] =
41 &BluetoothAvrcpCtStub::PressButtonnner;
42 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_RELEASE_BUTTON)] =
43 &BluetoothAvrcpCtStub::ReleaseButtonInner;
44 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_UNIT_INFO)] =
45 &BluetoothAvrcpCtStub::GetUnitInfoInner;
46 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_SUB_UNIT_INFO)] =
47 &BluetoothAvrcpCtStub::GetSubUnitInfoInner;
48 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_SUPPORTED_COMPANIES)] =
49 &BluetoothAvrcpCtStub::GetSupportedCompaniesInner;
50 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_SUPPORTED_EVENTS)] =
51 &BluetoothAvrcpCtStub::GetSupportedEventsInner;
52 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_PLAYER_APP_SETTING_ATTRIBUTES)] =
53 &BluetoothAvrcpCtStub::GetPlayerAppSettingAttributesInner;
54 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_PLAYER_APP_SETTING_VALUES)] =
55 &BluetoothAvrcpCtStub::GetPlayerAppSettingValuesInner;
56 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_PLAYER_APP_SETTING_CURRENT_VALUE)] =
57 &BluetoothAvrcpCtStub::GetPlayerAppSettingCurrentValueInner;
58 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_SET_PLAYER_APP_SETTING_CURRENT_VALUE)] =
59 &BluetoothAvrcpCtStub::SetPlayerAppSettingCurrentValueInner;
60 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_PLAYER_APP_SETTING_ATTRIBUTE_TEXT)] =
61 &BluetoothAvrcpCtStub::GetPlayerAppSettingAttributeTextInner;
62 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_PLAYER_APP_SETTING_VALUES_TEXT)] =
63 &BluetoothAvrcpCtStub::GetPlayerAppSettingValueTextInner;
64 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_ELEMENT_ATTRIBUTES)] =
65 &BluetoothAvrcpCtStub::GetElementAttributesInner;
66 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_PLAYER_STATUS)] =
67 &BluetoothAvrcpCtStub::GetPlayStatusInner;
68 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_PLAY_ITEM)] =
69 &BluetoothAvrcpCtStub::PlayItemInner;
70 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_FOLDER_ITEMS)] =
71 &BluetoothAvrcpCtStub::GetFolderItemsInner;
72 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_TOTAL_NUMBER_OF_ITEMS)] =
73 &BluetoothAvrcpCtStub::GetTotalNumberOfItemsInner;
74 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_SET_ABSOLUTE_VOLUME)] =
75 &BluetoothAvrcpCtStub::SetAbsoluteVolumeInner;
76 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_ENABLE_NOTIFICATION)] =
77 &BluetoothAvrcpCtStub::EnableNotificationInner;
78 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_DISABLE_NOTIFICATION)] =
79 &BluetoothAvrcpCtStub::DisableNotificationInner;
80 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_GET_ITEM_ATTRIBUTES)] =
81 &BluetoothAvrcpCtStub::GetItemAttributesInner;
82 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_SET_BROWSERED_PLAYER)] =
83 &BluetoothAvrcpCtStub::SetBrowsedPlayerInner;
84 memberFuncMap_[static_cast<uint32_t>(IBluetoothAvrcpCt::Code::AVRCP_CT_MEDIA_PLAYER_LIST)] =
85 &BluetoothAvrcpCtStub::GetMeidaPlayerListInner;
86 }
87
~BluetoothAvrcpCtStub()88 BluetoothAvrcpCtStub::~BluetoothAvrcpCtStub()
89 {
90 HILOGD("%{public}s start.", __func__);
91 memberFuncMap_.clear();
92 }
93
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)94 int BluetoothAvrcpCtStub::OnRemoteRequest(
95 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
96 {
97 HILOGD("BluetoothAvrcpCtStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d",
98 code,
99 option.GetFlags());
100 std::u16string descriptor = BluetoothAvrcpCtStub::GetDescriptor();
101 std::u16string remoteDescriptor = data.ReadInterfaceToken();
102 if (descriptor != remoteDescriptor) {
103 HILOGI("local descriptor is not equal to remote");
104 return ERR_INVALID_STATE;
105 }
106
107 auto itFunc = memberFuncMap_.find(code);
108 if (itFunc != memberFuncMap_.end()) {
109 auto memberFunc = itFunc->second;
110 if (memberFunc != nullptr) {
111 return (this->*memberFunc)(data,reply);
112 }
113 }
114
115 HILOGW("BluetoothAvrcpCtStub::OnRemoteRequest, default case, need check.");
116 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
117 }
118
RegisterObserverInner(MessageParcel & data,MessageParcel & reply)119 ErrCode BluetoothAvrcpCtStub::RegisterObserverInner(MessageParcel &data, MessageParcel &reply)
120 {
121 sptr<IRemoteObject> tempObject = data.ReadRemoteObject();
122 sptr<IBluetoothAvrcpCtObserver> observer;
123 observer = iface_cast<IBluetoothAvrcpCtObserver>(tempObject);
124 RegisterObserver(observer);
125 return NO_ERROR;
126 }
127
UnregisterObserverInner(MessageParcel & data,MessageParcel & reply)128 ErrCode BluetoothAvrcpCtStub::UnregisterObserverInner(MessageParcel &data, MessageParcel &reply)
129 {
130 sptr<IRemoteObject> tempObject = data.ReadRemoteObject();
131 sptr<IBluetoothAvrcpCtObserver> observer;
132 observer = iface_cast<IBluetoothAvrcpCtObserver>(tempObject);
133 UnregisterObserver(observer);
134 return NO_ERROR;
135 }
136
GetConnectedDevicesInner(MessageParcel & data,MessageParcel & reply)137 ErrCode BluetoothAvrcpCtStub::GetConnectedDevicesInner(MessageParcel &data, MessageParcel &reply)
138 {
139 std::vector<RawAddress> rawAdds = GetConnectedDevices();
140 reply.WriteInt32(rawAdds.size());
141 for (auto rawAdd : rawAdds) {
142 if (!reply.WriteString(rawAdd.GetAddress())) {
143 HILOGE("GetConnectedDevicesInner: write WriteString failed");
144 return ERR_INVALID_STATE;
145 }
146 }
147 return NO_ERROR;
148 }
149
GetDevicesByStatesInner(MessageParcel & data,MessageParcel & reply)150 ErrCode BluetoothAvrcpCtStub::GetDevicesByStatesInner(MessageParcel &data, MessageParcel &reply)
151 {
152 std::vector<int32_t> states = {};
153 int32_t stateSize = data.ReadInt32();
154
155 for (int i = 0; i < stateSize; i++) {
156 int32_t state = data.ReadInt32();
157 states.push_back(state);
158 }
159
160 std::vector<RawAddress> rawAdds = GetDevicesByStates(states);
161 reply.WriteInt32(rawAdds.size());
162
163 for (auto rawAdd : rawAdds) {
164 if (!reply.WriteString(rawAdd.GetAddress())) {
165 HILOGE("GetConnectedDevicesInner: write WriteString failed");
166 return ERR_INVALID_STATE;
167 }
168 }
169 return NO_ERROR;
170 }
171
GetDeviceStateInner(MessageParcel & data,MessageParcel & reply)172 ErrCode BluetoothAvrcpCtStub::GetDeviceStateInner(MessageParcel &data, MessageParcel &reply)
173 {
174 int32_t state = GetDeviceState(RawAddress(data.ReadString()));
175 reply.WriteInt32(state);
176
177 return NO_ERROR;
178 }
179
ConnectInner(MessageParcel & data,MessageParcel & reply)180 ErrCode BluetoothAvrcpCtStub::ConnectInner(MessageParcel &data, MessageParcel &reply)
181 {
182 int32_t result = Connect(RawAddress(data.ReadString()));
183 reply.WriteInt32(result);
184
185 return NO_ERROR;
186 }
187
DisconnectInner(MessageParcel & data,MessageParcel & reply)188 ErrCode BluetoothAvrcpCtStub::DisconnectInner(MessageParcel &data, MessageParcel &reply)
189 {
190 int32_t result = Disconnect(RawAddress(data.ReadString()));
191 reply.WriteInt32(result);
192
193 return NO_ERROR;
194 }
195
PressButtonnner(MessageParcel & data,MessageParcel & reply)196 ErrCode BluetoothAvrcpCtStub::PressButtonnner(MessageParcel &data, MessageParcel &reply)
197 {
198 int32_t result = PressButton(RawAddress(data.ReadString()), data.ReadInt32());
199 reply.WriteInt32(result);
200
201 return NO_ERROR;
202 }
203
ReleaseButtonInner(MessageParcel & data,MessageParcel & reply)204 ErrCode BluetoothAvrcpCtStub::ReleaseButtonInner(MessageParcel &data, MessageParcel &reply)
205 {
206 int32_t result = ReleaseButton(RawAddress(data.ReadString()), data.ReadInt32());
207 reply.WriteInt32(result);
208
209 return NO_ERROR;
210 }
211
GetUnitInfoInner(MessageParcel & data,MessageParcel & reply)212 ErrCode BluetoothAvrcpCtStub::GetUnitInfoInner(MessageParcel &data, MessageParcel &reply)
213 {
214 int32_t result = GetUnitInfo(RawAddress(data.ReadString()));
215 reply.WriteInt32(result);
216
217 return NO_ERROR;
218 }
219
GetSubUnitInfoInner(MessageParcel & data,MessageParcel & reply)220 ErrCode BluetoothAvrcpCtStub::GetSubUnitInfoInner(MessageParcel &data, MessageParcel &reply)
221 {
222 int32_t result = GetSubUnitInfo(RawAddress(data.ReadString()));
223 reply.WriteInt32(result);
224
225 return NO_ERROR;
226 }
227
GetSupportedCompaniesInner(MessageParcel & data,MessageParcel & reply)228 ErrCode BluetoothAvrcpCtStub::GetSupportedCompaniesInner(MessageParcel &data, MessageParcel &reply)
229 {
230 int32_t result = GetSupportedCompanies(RawAddress(data.ReadString()));
231 reply.WriteInt32(result);
232
233 return NO_ERROR;
234 }
235
GetSupportedEventsInner(MessageParcel & data,MessageParcel & reply)236 ErrCode BluetoothAvrcpCtStub::GetSupportedEventsInner(MessageParcel &data, MessageParcel &reply)
237 {
238 int32_t result = GetSupportedEvents(RawAddress(data.ReadString()));
239 reply.WriteInt32(result);
240
241 return NO_ERROR;
242 }
243
GetPlayerAppSettingAttributesInner(MessageParcel & data,MessageParcel & reply)244 ErrCode BluetoothAvrcpCtStub::GetPlayerAppSettingAttributesInner(MessageParcel &data, MessageParcel &reply)
245 {
246 int32_t result = GetPlayerAppSettingAttributes(RawAddress(data.ReadString()));
247 reply.WriteInt32(result);
248
249 return NO_ERROR;
250 }
251
GetPlayerAppSettingValuesInner(MessageParcel & data,MessageParcel & reply)252 ErrCode BluetoothAvrcpCtStub::GetPlayerAppSettingValuesInner(MessageParcel &data, MessageParcel &reply)
253 {
254 int32_t result = GetPlayerAppSettingValues(RawAddress(data.ReadString()), data.ReadInt32());
255 reply.WriteInt32(result);
256
257 return NO_ERROR;
258 }
259
GetPlayerAppSettingCurrentValueInner(MessageParcel & data,MessageParcel & reply)260 ErrCode BluetoothAvrcpCtStub::GetPlayerAppSettingCurrentValueInner(MessageParcel &data, MessageParcel &reply)
261 {
262 RawAddress raw = RawAddress(data.ReadString());
263 std::vector<int32_t> attributes = {};
264 int32_t attributesSize = data.ReadInt32();
265
266 for (int i = 0; i < attributesSize; i++) {
267 int32_t attribute = data.ReadInt32();
268 attributes.push_back(attribute);
269 }
270 int32_t result = GetPlayerAppSettingCurrentValue(raw, attributes);
271 reply.WriteInt32(result);
272
273 return NO_ERROR;
274 }
275
SetPlayerAppSettingCurrentValueInner(MessageParcel & data,MessageParcel & reply)276 ErrCode BluetoothAvrcpCtStub::SetPlayerAppSettingCurrentValueInner(MessageParcel &data, MessageParcel &reply)
277 {
278 RawAddress raw = RawAddress(data.ReadString());
279 std::vector<int32_t> attributes = {};
280 int32_t attributesSize = data.ReadInt32();
281
282 for (int i = 0; i < attributesSize; i++) {
283 int32_t attribute = data.ReadInt32();
284 attributes.push_back(attribute);
285 }
286
287 std::vector<int32_t> values = {};
288 int32_t valuesSize = data.ReadInt32();
289
290 for (int i = 0; i < valuesSize; i++) {
291 int32_t value = data.ReadInt32();
292 values.push_back(value);
293 }
294
295 int32_t result = SetPlayerAppSettingCurrentValue(raw, attributes, values);
296 reply.WriteInt32(result);
297
298 return NO_ERROR;
299 }
300
GetPlayerAppSettingAttributeTextInner(MessageParcel & data,MessageParcel & reply)301 ErrCode BluetoothAvrcpCtStub::GetPlayerAppSettingAttributeTextInner(MessageParcel &data, MessageParcel &reply)
302 {
303 RawAddress raw = RawAddress(data.ReadString());
304 std::vector<int32_t> attributes = {};
305 int32_t attributesSize = data.ReadInt32();
306
307 for (int i = 0; i < attributesSize; i++) {
308 int32_t attribute = data.ReadInt32();
309 attributes.push_back(attribute);
310 }
311 int32_t result = GetPlayerAppSettingAttributeText(raw, attributes);
312 reply.WriteInt32(result);
313
314 return NO_ERROR;
315 }
316
GetPlayerAppSettingValueTextInner(MessageParcel & data,MessageParcel & reply)317 ErrCode BluetoothAvrcpCtStub::GetPlayerAppSettingValueTextInner(MessageParcel &data, MessageParcel &reply)
318 {
319 RawAddress raw = RawAddress(data.ReadString());
320 int32_t attributes = data.ReadInt32();
321 std::vector<int32_t> values = {};
322 int32_t valuesSize = data.ReadInt32();
323
324 for (int i = 0; i < valuesSize; i++) {
325 int32_t value = data.ReadInt32();
326 values.push_back(value);
327 }
328
329 int32_t result = GetPlayerAppSettingValueText(raw, attributes, values);
330 reply.WriteInt32(result);
331
332 return NO_ERROR;
333 }
334
GetElementAttributesInner(MessageParcel & data,MessageParcel & reply)335 ErrCode BluetoothAvrcpCtStub::GetElementAttributesInner(MessageParcel &data, MessageParcel &reply)
336 {
337 RawAddress raw = RawAddress(data.ReadString());
338 std::vector<int32_t> attributes = {};
339 int32_t attributesSize = data.ReadInt32();
340
341 for (int i = 0; i < attributesSize; i++) {
342 int32_t attribute = data.ReadInt32();
343 attributes.push_back(attribute);
344 }
345 int32_t result = GetElementAttributes(raw, attributes);
346 reply.WriteInt32(result);
347
348 return NO_ERROR;
349 }
350
GetPlayStatusInner(MessageParcel & data,MessageParcel & reply)351 ErrCode BluetoothAvrcpCtStub::GetPlayStatusInner(MessageParcel &data, MessageParcel &reply)
352 {
353 RawAddress raw = RawAddress(data.ReadString());
354 int32_t result = GetPlayStatus(raw);
355 reply.WriteInt32(result);
356
357 return NO_ERROR;
358 }
359
PlayItemInner(MessageParcel & data,MessageParcel & reply)360 ErrCode BluetoothAvrcpCtStub::PlayItemInner(MessageParcel &data, MessageParcel &reply)
361 {
362 RawAddress raw = RawAddress(data.ReadString());
363 int32_t result = PlayItem(raw, data.ReadInt32(), data.ReadInt64(), data.ReadInt32());
364 reply.WriteInt32(result);
365
366 return NO_ERROR;
367 }
368
GetFolderItemsInner(MessageParcel & data,MessageParcel & reply)369 ErrCode BluetoothAvrcpCtStub::GetFolderItemsInner(MessageParcel &data, MessageParcel &reply)
370 {
371 RawAddress raw = RawAddress(data.ReadString());
372 int32_t startItem = data.ReadInt32();
373 int32_t endItem = data.ReadInt32();
374 std::vector<int32_t> attributes = {};
375 int32_t attributesSize = data.ReadInt32();
376 for (int i = 0; i < attributesSize; i++) {
377 int32_t attribute = data.ReadInt32();
378 attributes.push_back(attribute);
379 }
380
381 int32_t result = GetFolderItems(raw, startItem, endItem, attributes);
382 reply.WriteInt32(result);
383
384 return NO_ERROR;
385 }
386
GetTotalNumberOfItemsInner(MessageParcel & data,MessageParcel & reply)387 ErrCode BluetoothAvrcpCtStub::GetTotalNumberOfItemsInner(MessageParcel &data, MessageParcel &reply)
388 {
389 RawAddress raw = RawAddress(data.ReadString());
390 int32_t scope = data.ReadInt32();
391 int32_t result = GetTotalNumberOfItems(raw, scope);
392 reply.WriteInt32(result);
393
394 return NO_ERROR;
395 }
396
SetAbsoluteVolumeInner(MessageParcel & data,MessageParcel & reply)397 ErrCode BluetoothAvrcpCtStub::SetAbsoluteVolumeInner(MessageParcel &data, MessageParcel &reply)
398 {
399 RawAddress raw = RawAddress(data.ReadString());
400 int32_t volume = data.ReadInt32();
401 int32_t result = SetAbsoluteVolume(raw, volume);
402 reply.WriteInt32(result);
403
404 return NO_ERROR;
405 }
406
EnableNotificationInner(MessageParcel & data,MessageParcel & reply)407 ErrCode BluetoothAvrcpCtStub::EnableNotificationInner(MessageParcel &data, MessageParcel &reply)
408 {
409 RawAddress raw = RawAddress(data.ReadString());
410 std::vector<int32_t> events = {};
411 int32_t attributesSize = data.ReadInt32();
412
413 for (int i = 0; i < attributesSize; i++) {
414 int32_t attribute = data.ReadInt32();
415 events.push_back(attribute);
416 }
417 int32_t interval = data.ReadInt32();
418 int32_t result = EnableNotification(raw, events, interval);
419 reply.WriteInt32(result);
420
421 return NO_ERROR;
422 }
423
DisableNotificationInner(MessageParcel & data,MessageParcel & reply)424 ErrCode BluetoothAvrcpCtStub::DisableNotificationInner(MessageParcel &data, MessageParcel &reply)
425 {
426 RawAddress raw = RawAddress(data.ReadString());
427 std::vector<int32_t> events = {};
428 int32_t attributesSize = data.ReadInt32();
429
430 for (int i = 0; i < attributesSize; i++) {
431 int32_t attribute = data.ReadInt32();
432 events.push_back(attribute);
433 }
434 int32_t result = DisableNotification(raw, events);
435 reply.WriteInt32(result);
436
437 return NO_ERROR;
438 }
439
GetItemAttributesInner(MessageParcel & data,MessageParcel & reply)440 ErrCode BluetoothAvrcpCtStub::GetItemAttributesInner(MessageParcel &data, MessageParcel &reply)
441 {
442 RawAddress raw = RawAddress(data.ReadString());
443 int64_t uid = data.ReadInt64();
444 int32_t uidCounter = data.ReadInt32();
445 std::vector<int32_t> events = {};
446 int32_t attributesSize = data.ReadInt32();
447
448 for (int i = 0; i < attributesSize; i++) {
449 int32_t attribute = data.ReadInt32();
450 events.push_back(attribute);
451 }
452 int32_t result = GetItemAttributes(raw, uid, uidCounter, events);
453 reply.WriteInt32(result);
454
455 return NO_ERROR;
456 }
457
SetBrowsedPlayerInner(MessageParcel & data,MessageParcel & reply)458 ErrCode BluetoothAvrcpCtStub::SetBrowsedPlayerInner(MessageParcel &data, MessageParcel &reply)
459 {
460 RawAddress raw = RawAddress(data.ReadString());
461 int32_t playerId = data.ReadInt32();
462
463 int32_t result = SetBrowsedPlayer(raw, playerId);
464 reply.WriteInt32(result);
465
466 return NO_ERROR;
467
468 }
469
GetMeidaPlayerListInner(MessageParcel & data,MessageParcel & reply)470 ErrCode BluetoothAvrcpCtStub::GetMeidaPlayerListInner(MessageParcel &data, MessageParcel &reply)
471 {
472 RawAddress raw = RawAddress(data.ReadString());
473 int32_t startItem = data.ReadInt32();
474 int32_t endItem = data.ReadInt32();
475
476 int32_t result = GetMeidaPlayerList(raw, startItem, endItem);
477 reply.WriteInt32(result);
478
479 return NO_ERROR;
480 }
481 } // namespace Bluetooth
482 } // namespace OHOS
483