• 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 
16 #include "bluetooth_map_mce_stub.h"
17 #include "bluetooth_log.h"
18 
19 namespace OHOS {
20 namespace Bluetooth {
BluetoothMapMceStub()21 BluetoothMapMceStub::BluetoothMapMceStub()
22 {
23     HILOGD("%{public}s start.", __func__);
24     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_REGISTER_OBSERVER)] =
25         &BluetoothMapMceStub::RegisterObserverInner;
26     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_DE_REGISTER_OBSERVER)] =
27         &BluetoothMapMceStub::DeregisterObserverInner;
28     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_CONNECT)] =
29         nullptr;
30     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_DISCONNECT)] =
31         &BluetoothMapMceStub::DisconnectInner;
32     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_ISCONNECTED)] =
33         &BluetoothMapMceStub::IsConnectedInner;
34     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_CONNECT_DEVICES)] =
35         &BluetoothMapMceStub::GetConnectDevicesInner;
36     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_DEVICES_BY_STATES)] =
37         &BluetoothMapMceStub::GetDevicesByStatesInner;
38     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_CONNECTION_STATE)] =
39         &BluetoothMapMceStub::GetConnectionStateInner;
40     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_SET_CONNECTION_STRATEGY)] =
41         &BluetoothMapMceStub::SetConnectionStrategyInner;
42     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_CONNECTION_STRATEGY)] =
43         &BluetoothMapMceStub::GetConnectionStrategyInner;
44     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_UNREAD_MESSAGES)] =
45         &BluetoothMapMceStub::GetUnreadMessagesInner;
46     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_SUPPORTED_FEATURES)] =
47         &BluetoothMapMceStub::GetSupportedFeaturesInner;
48     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_SEND_MESSAGE)] =
49         &BluetoothMapMceStub::SendMessageInner;
50     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_SET_NOTIFICATION_FILTER)] =
51         &BluetoothMapMceStub::SetNotificationFilterInner;
52     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_MESSAGES_LISTING)] =
53         &BluetoothMapMceStub::GetMessagesListingInner;
54     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_MESSAGE)] =
55         &BluetoothMapMceStub::GetMessageInner;
56     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_UPDATE_INBOX)] =
57         &BluetoothMapMceStub::UpdateInboxInner;
58     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_CONVERSATION_LISTING)] =
59         &BluetoothMapMceStub::GetConversationListingInner;
60     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_SET_MESSAGE_STATUS)] =
61         &BluetoothMapMceStub::SetMessageStatusInner;
62     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_SET_OWNER_STATUS)] =
63         &BluetoothMapMceStub::SetOwnerStatusInner;
64     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_OWNER_STATUS)] =
65         &BluetoothMapMceStub::GetOwnerStatusInner;
66     memberFuncMap_[static_cast<uint32_t>(BluetoothMapMceInterfaceCode::MCE_GET_MAS_INSTANCE_INFO)] =
67         &BluetoothMapMceStub::GetMasInstanceInfoInner;
68 }
69 
~BluetoothMapMceStub()70 BluetoothMapMceStub::~BluetoothMapMceStub()
71 {
72     HILOGD("%{public}s start.", __func__);
73     memberFuncMap_.clear();
74 }
75 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)76 int BluetoothMapMceStub::OnRemoteRequest(
77     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
78 {
79     HILOGD("BluetoothMapMceStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d",
80         code,
81         option.GetFlags());
82     std::u16string descriptor = BluetoothMapMceStub::GetDescriptor();
83     std::u16string remoteDescriptor = data.ReadInterfaceToken();
84     if (descriptor != remoteDescriptor) {
85         HILOGI("local descriptor is not equal to remote");
86         return ERR_INVALID_STATE;
87     }
88     auto itFunc = memberFuncMap_.find(code);
89     if (itFunc != memberFuncMap_.end()) {
90         auto memberFunc = itFunc->second;
91         if (memberFunc != nullptr) {
92             return (this->*memberFunc)(data, reply);
93         }
94     }
95     HILOGW("BluetoothMapMceStub::OnRemoteRequest, default case, need check.");
96     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
97 }
98 
RegisterObserverInner(MessageParcel & data,MessageParcel & reply)99 ErrCode BluetoothMapMceStub::RegisterObserverInner(MessageParcel &data, MessageParcel &reply)
100 {
101     HILOGI("BluetoothMapMceStub::RegisterObserverInner Triggered!");
102     sptr<IRemoteObject> remote = data.ReadRemoteObject();
103     const sptr<IBluetoothMapMceObserver> callback = OHOS::iface_cast<IBluetoothMapMceObserver>(remote);
104     RegisterObserver(callback);
105     return NO_ERROR;
106 }
107 
DeregisterObserverInner(MessageParcel & data,MessageParcel & reply)108 ErrCode BluetoothMapMceStub::DeregisterObserverInner(MessageParcel &data, MessageParcel &reply)
109 {
110     HILOGI("BluetoothMapMceStub::DeregisterObserverInner Triggered!");
111     sptr<IRemoteObject> remote = data.ReadRemoteObject();
112     const sptr<IBluetoothMapMceObserver> callback = OHOS::iface_cast<IBluetoothMapMceObserver>(remote);
113     DeregisterObserver(callback);
114     return NO_ERROR;
115 }
116 
ConnectInner(MessageParcel & data,MessageParcel & reply)117 ErrCode BluetoothMapMceStub::ConnectInner(MessageParcel &data, MessageParcel &reply)
118 {
119     HILOGI("BluetoothMapMceStub::ConnectInner Triggered!");
120     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
121     if (!device) {
122         return TRANSACTION_ERR;
123     }
124     int result = Connect(*device);
125     bool ret = reply.WriteInt32(result);
126     if (!ret) {
127         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
128         return ERR_INVALID_VALUE;
129     }
130     return NO_ERROR;
131 }
132 
DisconnectInner(MessageParcel & data,MessageParcel & reply)133 ErrCode BluetoothMapMceStub::DisconnectInner(MessageParcel &data, MessageParcel &reply)
134 {
135     HILOGI("BluetoothMapMceStub::DisconnectInner Triggered!");
136     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
137     if (!device) {
138         return TRANSACTION_ERR;
139     }
140     int result = Disconnect(*device);
141     bool ret = reply.WriteInt32(result);
142     if (!ret) {
143         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
144         return ERR_INVALID_VALUE;
145     }
146     return NO_ERROR;
147 }
148 
IsConnectedInner(MessageParcel & data,MessageParcel & reply)149 ErrCode BluetoothMapMceStub::IsConnectedInner(MessageParcel &data, MessageParcel &reply)
150 {
151     HILOGI("BluetoothMapMceStub::IsConnectedInner Triggered!");
152     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
153     if (!device) {
154         return TRANSACTION_ERR;
155     }
156     int result = IsConnected(*device);
157     bool ret = reply.WriteInt32(result);
158     if (!ret) {
159         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
160         return ERR_INVALID_VALUE;
161     }
162     return NO_ERROR;
163 }
164 
GetConnectDevicesInner(MessageParcel & data,MessageParcel & reply)165 ErrCode BluetoothMapMceStub::GetConnectDevicesInner(MessageParcel &data, MessageParcel &reply)
166 {
167     HILOGI("BluetoothMapMceStub::GetConnectDevicesInner Triggered!");
168     std::vector<BluetoothRawAddress> devices;
169     GetConnectDevices(devices);
170     reply.WriteInt32(devices.size());
171     int num = devices.size();
172     for (int i = 0; i < num; i++) {
173         bool ret = reply.WriteParcelable(&devices[i]);
174         if (!ret) {
175             HILOGE("WriteParcelable<GetConnectDevicesInner> failed");
176             return ERR_INVALID_VALUE;
177         }
178     }
179     return NO_ERROR;
180 }
181 
GetDevicesByStatesInner(MessageParcel & data,MessageParcel & reply)182 ErrCode BluetoothMapMceStub::GetDevicesByStatesInner(MessageParcel &data, MessageParcel &reply)
183 {
184     HILOGI("BluetoothMapMceStub::GetDevicesByStates Triggered!");
185     std::vector<int32_t> states;
186     if (!data.ReadInt32Vector(&states)) {
187         HILOGW("BluetoothMapMceStub::GetDevicesByStatesInner: get tmpState failed.");
188         return INVALID_DATA;
189     }
190     std::vector<BluetoothRawAddress> rawDevices;
191     GetDevicesByStates(states, rawDevices);
192     reply.WriteInt32(rawDevices.size());
193     int num = rawDevices.size();
194     for (int i = 0; i < num; i++) {
195         bool ret = reply.WriteParcelable(&rawDevices[i]);
196         if (!ret) {
197             HILOGE("WriteParcelable<GetDevicesByStatesInner> failed");
198             return ERR_INVALID_VALUE;
199         }
200     }
201     return NO_ERROR;
202 }
203 
GetConnectionStateInner(MessageParcel & data,MessageParcel & reply)204 ErrCode BluetoothMapMceStub::GetConnectionStateInner(MessageParcel &data, MessageParcel &reply)
205 {
206     HILOGI("BluetoothMapMceStub::GetConnectionStateInner Triggered!");
207     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
208     if (!device) {
209         return TRANSACTION_ERR;
210     }
211     int result = GetConnectionState(*device);
212     bool ret = reply.WriteInt32(result);
213     if (!ret) {
214         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
215         return ERR_INVALID_VALUE;
216     }
217     return NO_ERROR;
218 }
219 
SetConnectionStrategyInner(MessageParcel & data,MessageParcel & reply)220 ErrCode BluetoothMapMceStub::SetConnectionStrategyInner(MessageParcel &data, MessageParcel &reply)
221 {
222     HILOGI("BluetoothMapMceStub::SetConnectionStrategyInner Triggered!");
223     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
224     if (!device) {
225         return TRANSACTION_ERR;
226     }
227     int32_t strategy = data.ReadInt32();
228     int result = SetConnectionStrategy(*device, strategy);
229     bool ret = reply.WriteInt32(result);
230     if (!ret) {
231         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
232         return ERR_INVALID_VALUE;
233     }
234     return NO_ERROR;
235 }
236 
GetConnectionStrategyInner(MessageParcel & data,MessageParcel & reply)237 ErrCode BluetoothMapMceStub::GetConnectionStrategyInner(MessageParcel &data, MessageParcel &reply)
238 {
239     HILOGI("BluetoothMapMceStub::GetConnectionStrategyInner Triggered!");
240     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
241     if (!device) {
242         return TRANSACTION_ERR;
243     }
244     int result = GetConnectionStrategy(*device);
245     bool ret = reply.WriteInt32(result);
246     if (!ret) {
247         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
248         return ERR_INVALID_VALUE;
249     }
250     return NO_ERROR;
251 }
252 
GetUnreadMessagesInner(MessageParcel & data,MessageParcel & reply)253 ErrCode BluetoothMapMceStub::GetUnreadMessagesInner(MessageParcel &data, MessageParcel &reply)
254 {
255     HILOGI("BluetoothMapMceStub::GetUnreadMessagesInner Triggered!");
256     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
257     if (!device) {
258         return TRANSACTION_ERR;
259     }
260     int32_t msgType = data.ReadInt32();
261     int32_t max = data.ReadInt32();
262     int result = GetUnreadMessages(*device, msgType, max);
263     bool ret = reply.WriteInt32(result);
264     if (!ret) {
265         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
266         return ERR_INVALID_VALUE;
267     }
268     return NO_ERROR;
269 }
270 
GetSupportedFeaturesInner(MessageParcel & data,MessageParcel & reply)271 ErrCode BluetoothMapMceStub::GetSupportedFeaturesInner(MessageParcel &data, MessageParcel &reply)
272 {
273     HILOGI("BluetoothMapMceStub::GetSupportedFeaturesInner Triggered!");
274     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
275     if (!device) {
276         return TRANSACTION_ERR;
277     }
278     int result = GetSupportedFeatures(*device);
279     bool ret = reply.WriteInt32(result);
280     if (!ret) {
281         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
282         return ERR_INVALID_VALUE;
283     }
284     return NO_ERROR;
285 }
286 
SendMessageInner(MessageParcel & data,MessageParcel & reply)287 ErrCode BluetoothMapMceStub::SendMessageInner(MessageParcel &data, MessageParcel &reply)
288 {
289     HILOGI("BluetoothMapMceStub::SendMessageInner Triggered!");
290     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
291     if (!device) {
292         return TRANSACTION_ERR;
293     }
294     std::shared_ptr<BluetoothIProfileSendMessageParameters> msg(
295         data.ReadParcelable<BluetoothIProfileSendMessageParameters>());
296     int result = SendMessage(*device, *msg);
297 
298     bool ret = reply.WriteInt32(result);
299     if (!ret) {
300         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
301         return ERR_INVALID_VALUE;
302     }
303     return NO_ERROR;
304 }
305 
SetNotificationFilterInner(MessageParcel & data,MessageParcel & reply)306 ErrCode BluetoothMapMceStub::SetNotificationFilterInner(MessageParcel &data, MessageParcel &reply)
307 {
308     HILOGI("BluetoothMapMceStub::SetNotificationFilterInner Triggered!");
309     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
310     if (!device) {
311         return TRANSACTION_ERR;
312     }
313     int32_t mask = data.ReadInt32();
314     int result = SetNotificationFilter(*device, mask);
315     bool ret = reply.WriteInt32(result);
316     if (!ret) {
317         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
318         return ERR_INVALID_VALUE;
319     }
320     return NO_ERROR;
321 }
322 
GetMessagesListingInner(MessageParcel & data,MessageParcel & reply)323 ErrCode BluetoothMapMceStub::GetMessagesListingInner(MessageParcel &data, MessageParcel &reply)
324 {
325     HILOGI("BluetoothMapMceStub::GetMessagesListingInner Triggered!");
326     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
327     if (!device) {
328         return TRANSACTION_ERR;
329     }
330     std::shared_ptr<BluetoothIProfileGetMessagesListingParameters> msg(
331         data.ReadParcelable<BluetoothIProfileGetMessagesListingParameters>());
332     int result = GetMessagesListing(*device, *msg);
333     bool ret = reply.WriteInt32(result);
334     if (!ret) {
335         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
336         return ERR_INVALID_VALUE;
337     }
338     return NO_ERROR;
339 }
340 
GetMessageInner(MessageParcel & data,MessageParcel & reply)341 ErrCode BluetoothMapMceStub::GetMessageInner(MessageParcel &data, MessageParcel &reply)
342 {
343     HILOGI("BluetoothMapMceStub::GetMessagesListingInner Triggered!");
344     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
345     if (!device) {
346         return TRANSACTION_ERR;
347     }
348     int32_t msgType = data.ReadInt32();
349     const std::u16string msgHandle = data.ReadString16();
350     std::shared_ptr<BluetoothIProfileGetMessageParameters> msg(
351         data.ReadParcelable<BluetoothIProfileGetMessageParameters>());
352     int result = GetMessage(*device, msgType, msgHandle, *msg);
353     bool ret = reply.WriteInt32(result);
354     if (!ret) {
355         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
356         return ERR_INVALID_VALUE;
357     }
358     return NO_ERROR;
359 }
360 
UpdateInboxInner(MessageParcel & data,MessageParcel & reply)361 ErrCode BluetoothMapMceStub::UpdateInboxInner(MessageParcel &data, MessageParcel &reply)
362 {
363     HILOGI("BluetoothMapMceStub::UpdateInboxInner Triggered!");
364     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
365     if (!device) {
366         return TRANSACTION_ERR;
367     }
368     int32_t msgType = data.ReadInt32();
369     int result = UpdateInbox(*device, msgType);
370     bool ret = reply.WriteInt32(result);
371     if (!ret) {
372         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
373         return ERR_INVALID_VALUE;
374     }
375     return NO_ERROR;
376 }
377 
GetConversationListingInner(MessageParcel & data,MessageParcel & reply)378 ErrCode BluetoothMapMceStub::GetConversationListingInner(MessageParcel &data, MessageParcel &reply)
379 {
380     HILOGI("BluetoothMapMceStub::GetConversationListingInner Triggered!");
381     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
382     if (!device) {
383         return TRANSACTION_ERR;
384     }
385     std::shared_ptr<BluetoothIProfileGetConversationListingParameters> msg(
386         data.ReadParcelable<BluetoothIProfileGetConversationListingParameters>());
387     int result = GetConversationListing(*device, *msg);
388     bool ret = reply.WriteInt32(result);
389     if (!ret) {
390         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
391         return ERR_INVALID_VALUE;
392     }
393     return NO_ERROR;
394 }
395 
SetMessageStatusInner(MessageParcel & data,MessageParcel & reply)396 ErrCode BluetoothMapMceStub::SetMessageStatusInner(MessageParcel &data, MessageParcel &reply)
397 {
398     HILOGI("BluetoothMapMceStub::SetMessageStatusInner Triggered!");
399     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
400     if (!device) {
401         return TRANSACTION_ERR;
402     }
403     int32_t msgType = data.ReadInt32();
404     const std::u16string msgHandle = data.ReadString16();
405     int32_t statusIndicator = data.ReadInt32();
406     int32_t statusValue = data.ReadInt32();
407     const std::string extendedData = data.ReadString();
408     int result = SetMessageStatus(*device, msgType, msgHandle, statusIndicator, statusValue, extendedData);
409     bool ret = reply.WriteInt32(result);
410     if (!ret) {
411         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
412         return ERR_INVALID_VALUE;
413     }
414     return NO_ERROR;
415 }
416 
SetOwnerStatusInner(MessageParcel & data,MessageParcel & reply)417 ErrCode BluetoothMapMceStub::SetOwnerStatusInner(MessageParcel &data, MessageParcel &reply)
418 {
419     HILOGI("BluetoothMapMceStub::SetOwnerStatusInner Triggered!");
420     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
421     if (!device) {
422         return TRANSACTION_ERR;
423     }
424     std::shared_ptr<BluetoothIProfileSetOwnerStatusParameters> msg (
425         data.ReadParcelable<BluetoothIProfileSetOwnerStatusParameters>());
426     int result = SetOwnerStatus(*device, *msg);
427     bool ret = reply.WriteInt32(result);
428     if (!ret) {
429         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
430         return ERR_INVALID_VALUE;
431     }
432     return NO_ERROR;
433 }
434 
GetOwnerStatusInner(MessageParcel & data,MessageParcel & reply)435 ErrCode BluetoothMapMceStub::GetOwnerStatusInner(MessageParcel &data, MessageParcel &reply)
436 {
437     HILOGI("BluetoothMapMceStub::SetOwnerStatusInner Triggered!");
438     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
439     if (!device) {
440         return TRANSACTION_ERR;
441     }
442     const std::string conversationId = data.ReadString();
443     int result = GetOwnerStatus(*device, conversationId);
444     bool ret = reply.WriteInt32(result);
445     if (!ret) {
446         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
447         return ERR_INVALID_VALUE;
448     }
449     return NO_ERROR;
450 }
451 
GetMasInstanceInfoInner(MessageParcel & data,MessageParcel & reply)452 ErrCode BluetoothMapMceStub::GetMasInstanceInfoInner(MessageParcel &data, MessageParcel &reply)
453 {
454     HILOGI("BluetoothMapMceStub::GetMasInstanceInfoInner Triggered!");
455     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
456     if (!device) {
457         return TRANSACTION_ERR;
458     }
459     BluetoothIProfileMasInstanceInfoList result = GetMasInstanceInfo(*device);
460     bool ret = reply.WriteParcelable(&result);
461     if (!ret) {
462         HILOGE("BluetoothMapMceStub: reply writing failed in: %{public}s.", __func__);
463         return ERR_INVALID_VALUE;
464     }
465     return NO_ERROR;
466 }
467 }  // namespace Bluetooth
468 }  // namespace OHOS
469