• 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_host_stub.h"
17 #include "bluetooth_log.h"
18 #include "bluetooth_errorcode.h"
19 #include "ipc_types.h"
20 #include "raw_address.h"
21 #include "string_ex.h"
22 #include "permission_utils.h"
23 
24 namespace OHOS {
25 namespace Bluetooth {
26 const std::map<uint32_t, std::function<ErrCode(BluetoothHostStub *, MessageParcel &, MessageParcel &)>>
27     BluetoothHostStub::memberFuncMap_ = {
28         {BluetoothHostInterfaceCode::BT_REGISTER_OBSERVER,
29             std::bind(&BluetoothHostStub::RegisterObserverInner, std::placeholders::_1, std::placeholders::_2,
30                 std::placeholders::_3)},
31         {BluetoothHostInterfaceCode::BT_DEREGISTER_OBSERVER,
32             std::bind(&BluetoothHostStub::DeregisterObserverInner, std::placeholders::_1, std::placeholders::_2,
33                 std::placeholders::_3)},
34         {BluetoothHostInterfaceCode::BT_ENABLE,
35             std::bind(&BluetoothHostStub::EnableBtInner, std::placeholders::_1, std::placeholders::_2,
36                 std::placeholders::_3)},
37         {BluetoothHostInterfaceCode::BT_DISABLE,
38             std::bind(&BluetoothHostStub::DisableBtInner, std::placeholders::_1, std::placeholders::_2,
39                 std::placeholders::_3)},
40         {BluetoothHostInterfaceCode::BT_GETPROFILE,
41             std::bind(&BluetoothHostStub::GetProfileInner, std::placeholders::_1, std::placeholders::_2,
42                 std::placeholders::_3)},
43         {BluetoothHostInterfaceCode::BT_GET_BLE,
44             std::bind(&BluetoothHostStub::GetBleRemoteInner, std::placeholders::_1, std::placeholders::_2,
45                 std::placeholders::_3)},
46         {BluetoothHostInterfaceCode::BT_FACTORY_RESET,
47             std::bind(&BluetoothHostStub::BluetoothFactoryResetInner, std::placeholders::_1, std::placeholders::_2,
48                 std::placeholders::_3)},
49         {BluetoothHostInterfaceCode::BT_GETSTATE,
50             std::bind(&BluetoothHostStub::GetBtStateInner, std::placeholders::_1, std::placeholders::_2,
51                 std::placeholders::_3)},
52         {BluetoothHostInterfaceCode::BT_GET_LOCAL_ADDRESS,
53             std::bind(&BluetoothHostStub::GetLocalAddressInner, std::placeholders::_1, std::placeholders::_2,
54                 std::placeholders::_3)},
55         {BluetoothHostInterfaceCode::BT_DISABLE_BLE,
56             std::bind(&BluetoothHostStub::DisableBleInner, std::placeholders::_1, std::placeholders::_2,
57                 std::placeholders::_3)},
58         {BluetoothHostInterfaceCode::BT_ENABLE_BLE,
59             std::bind(&BluetoothHostStub::EnableBleInner, std::placeholders::_1, std::placeholders::_2,
60                 std::placeholders::_3)},
61         {BluetoothHostInterfaceCode::BT_GET_PROFILE_LIST,
62             std::bind(&BluetoothHostStub::GetProfileListInner, std::placeholders::_1, std::placeholders::_2,
63                 std::placeholders::_3)},
64         {BluetoothHostInterfaceCode::BT_GET_MAXNUM_CONNECTED_AUDIODEVICES,
65             std::bind(&BluetoothHostStub::GetMaxNumConnectedAudioDevicesInner, std::placeholders::_1,
66                 std::placeholders::_2, std::placeholders::_3)},
67         {BluetoothHostInterfaceCode::BT_GET_BT_STATE,
68             std::bind(&BluetoothHostStub::GetBtConnectionStateInner, std::placeholders::_1, std::placeholders::_2,
69                 std::placeholders::_3)},
70         {BluetoothHostInterfaceCode::BT_GET_BT_PROFILE_CONNSTATE,
71             std::bind(&BluetoothHostStub::GetBtProfileConnStateInner, std::placeholders::_1, std::placeholders::_2,
72                 std::placeholders::_3)},
73         {BluetoothHostInterfaceCode::BT_GET_LOCAL_DEVICE_CLASS,
74             std::bind(&BluetoothHostStub::GetLocalDeviceClassInner, std::placeholders::_1, std::placeholders::_2,
75                 std::placeholders::_3)},
76         {BluetoothHostInterfaceCode::BT_SET_LOCAL_DEVICE_CLASS,
77             std::bind(&BluetoothHostStub::SetLocalDeviceClassInner, std::placeholders::_1, std::placeholders::_2,
78                 std::placeholders::_3)},
79         {BluetoothHostInterfaceCode::BT_GET_LOCAL_NAME,
80             std::bind(&BluetoothHostStub::GetLocalNameInner, std::placeholders::_1, std::placeholders::_2,
81                 std::placeholders::_3)},
82         {BluetoothHostInterfaceCode::BT_SET_LOCAL_NAME,
83             std::bind(&BluetoothHostStub::SetLocalNameInner, std::placeholders::_1, std::placeholders::_2,
84                 std::placeholders::_3)},
85         {BluetoothHostInterfaceCode::BT_GET_BT_SCAN_MODE,
86             std::bind(&BluetoothHostStub::GetBtScanModeInner, std::placeholders::_1, std::placeholders::_2,
87                 std::placeholders::_3)},
88         {BluetoothHostInterfaceCode::BT_SET_BT_SCAN_MODE,
89             std::bind(&BluetoothHostStub::SetBtScanModeInner, std::placeholders::_1, std::placeholders::_2,
90                 std::placeholders::_3)},
91         {BluetoothHostInterfaceCode::BT_GET_BONDABLE_MODE,
92             std::bind(&BluetoothHostStub::GetBondableModeInner, std::placeholders::_1, std::placeholders::_2,
93                 std::placeholders::_3)},
94         {BluetoothHostInterfaceCode::BT_SET_BONDABLE_MODE,
95             std::bind(&BluetoothHostStub::SetBondableModeInner, std::placeholders::_1, std::placeholders::_2,
96                 std::placeholders::_3)},
97         {BluetoothHostInterfaceCode::BT_START_BT_DISCOVERY,
98             std::bind(&BluetoothHostStub::StartBtDiscoveryInner, std::placeholders::_1, std::placeholders::_2,
99                 std::placeholders::_3)},
100         {BluetoothHostInterfaceCode::BT_CANCEL_BT_DISCOVERY,
101             std::bind(&BluetoothHostStub::CancelBtDiscoveryInner, std::placeholders::_1, std::placeholders::_2,
102                 std::placeholders::_3)},
103         {BluetoothHostInterfaceCode::BT_IS_BT_DISCOVERING,
104             std::bind(&BluetoothHostStub::IsBtDiscoveringInner, std::placeholders::_1, std::placeholders::_2,
105                 std::placeholders::_3)},
106         {BluetoothHostInterfaceCode::BT_GET_BT_DISCOVERY_END_MILLIS,
107             std::bind(&BluetoothHostStub::GetBtDiscoveryEndMillisInner, std::placeholders::_1, std::placeholders::_2,
108                 std::placeholders::_3)},
109         {BluetoothHostInterfaceCode::BT_GET_PAIRED_DEVICES,
110             std::bind(&BluetoothHostStub::GetPairedDevicesInner, std::placeholders::_1, std::placeholders::_2,
111                 std::placeholders::_3)},
112         {BluetoothHostInterfaceCode::BT_REMOVE_PAIR,
113             std::bind(&BluetoothHostStub::RemovePairInner, std::placeholders::_1, std::placeholders::_2,
114                 std::placeholders::_3)},
115         {BluetoothHostInterfaceCode::BT_REMOVE_ALL_PAIRS,
116             std::bind(&BluetoothHostStub::RemoveAllPairsInner, std::placeholders::_1, std::placeholders::_2,
117                 std::placeholders::_3)},
118         {BluetoothHostInterfaceCode::BT_REGISTER_REMOTE_DEVICE_OBSERVER,
119             std::bind(&BluetoothHostStub::RegisterRemoteDeviceObserverInner, std::placeholders::_1,
120                 std::placeholders::_2, std::placeholders::_3)},
121         {BluetoothHostInterfaceCode::BT_DEREGISTER_REMOTE_DEVICE_OBSERVER,
122             std::bind(&BluetoothHostStub::DeregisterRemoteDeviceObserverInner, std::placeholders::_1,
123                 std::placeholders::_2, std::placeholders::_3)},
124         {BluetoothHostInterfaceCode::BT_GET_BLE_MAX_ADVERTISING_DATALENGTH,
125             std::bind(&BluetoothHostStub::GetBleMaxAdvertisingDataLengthInner, std::placeholders::_1,
126                 std::placeholders::_2, std::placeholders::_3)},
127         {BluetoothHostInterfaceCode::GET_DEVICE_TYPE,
128             std::bind(&BluetoothHostStub::GetDeviceTypeInner, std::placeholders::_1, std::placeholders::_2,
129                 std::placeholders::_3)},
130         {BluetoothHostInterfaceCode::GET_PHONEBOOK_PERMISSION,
131             std::bind(&BluetoothHostStub::GetPhonebookPermissionInner, std::placeholders::_1, std::placeholders::_2,
132                 std::placeholders::_3)},
133         {BluetoothHostInterfaceCode::SET_PHONEBOOK_PERMISSION,
134             nullptr},
135         {BluetoothHostInterfaceCode::GET_MESSAGE_PERMISSION,
136             std::bind(&BluetoothHostStub::GetMessagePermissionInner, std::placeholders::_1, std::placeholders::_2,
137                 std::placeholders::_3)},
138         {BluetoothHostInterfaceCode::SET_MESSAGE_PERMISSION,
139             nullptr},
140         {BluetoothHostInterfaceCode::GET_POWER_MODE,
141             std::bind(&BluetoothHostStub::GetPowerModeInner, std::placeholders::_1, std::placeholders::_2,
142                 std::placeholders::_3)},
143         {BluetoothHostInterfaceCode::GET_DEVICE_NAME,
144             std::bind(&BluetoothHostStub::GetDeviceNameInner, std::placeholders::_1, std::placeholders::_2,
145                 std::placeholders::_3)},
146         {BluetoothHostInterfaceCode::GET_DEVICE_ALIAS,
147             std::bind(&BluetoothHostStub::GetDeviceAliasInner, std::placeholders::_1, std::placeholders::_2,
148                 std::placeholders::_3)},
149         {BluetoothHostInterfaceCode::SET_DEVICE_ALIAS,
150             std::bind(&BluetoothHostStub::SetDeviceAliasInner, std::placeholders::_1, std::placeholders::_2,
151                 std::placeholders::_3)},
152         {BluetoothHostInterfaceCode::GET_DEVICE_BATTERY_INFO,
153             std::bind(&BluetoothHostStub::GetRemoteDeviceBatteryInfoInner, std::placeholders::_1, std::placeholders::_2,
154                 std::placeholders::_3)},
155         {BluetoothHostInterfaceCode::GET_PAIR_STATE,
156             std::bind(&BluetoothHostStub::GetPairStateInner, std::placeholders::_1, std::placeholders::_2,
157                 std::placeholders::_3)},
158         {BluetoothHostInterfaceCode::START_PAIR,
159             std::bind(&BluetoothHostStub::StartPairInner, std::placeholders::_1, std::placeholders::_2,
160                 std::placeholders::_3)},
161         {BluetoothHostInterfaceCode::CANCEL_PAIRING,
162             std::bind(&BluetoothHostStub::CancelPairingInner, std::placeholders::_1, std::placeholders::_2,
163                 std::placeholders::_3)},
164         {BluetoothHostInterfaceCode::IS_BONDED_FROM_LOCAL,
165             std::bind(&BluetoothHostStub::IsBondedFromLocalInner, std::placeholders::_1, std::placeholders::_2,
166                 std::placeholders::_3)},
167         {BluetoothHostInterfaceCode::IS_ACL_CONNECTED,
168             std::bind(&BluetoothHostStub::IsAclConnectedInner, std::placeholders::_1, std::placeholders::_2,
169                 std::placeholders::_3)},
170         {BluetoothHostInterfaceCode::IS_ACL_ENCRYPTED,
171             std::bind(&BluetoothHostStub::IsAclEncryptedInner, std::placeholders::_1, std::placeholders::_2,
172                 std::placeholders::_3)},
173         {BluetoothHostInterfaceCode::GET_DEVICE_CLASS,
174             std::bind(&BluetoothHostStub::GetDeviceClassInner, std::placeholders::_1, std::placeholders::_2,
175                 std::placeholders::_3)},
176         {BluetoothHostInterfaceCode::SET_DEVICE_PIN,
177             std::bind(&BluetoothHostStub::SetDevicePinInner, std::placeholders::_1, std::placeholders::_2,
178                 std::placeholders::_3)},
179         {BluetoothHostInterfaceCode::SET_DEVICE_PAIRING_CONFIRMATION,
180             std::bind(&BluetoothHostStub::SetDevicePairingConfirmationInner, std::placeholders::_1,
181                 std::placeholders::_2, std::placeholders::_3)},
182         {BluetoothHostInterfaceCode::SET_DEVICE_PASSKEY,
183             std::bind(&BluetoothHostStub::SetDevicePasskeyInner, std::placeholders::_1, std::placeholders::_2,
184                 std::placeholders::_3)},
185         {BluetoothHostInterfaceCode::PAIR_REQUEST_PEPLY,
186             std::bind(&BluetoothHostStub::PairRequestReplyInner, std::placeholders::_1, std::placeholders::_2,
187                 std::placeholders::_3)},
188         {BluetoothHostInterfaceCode::READ_REMOTE_RSSI_VALUE,
189             std::bind(&BluetoothHostStub::ReadRemoteRssiValueInner, std::placeholders::_1, std::placeholders::_2,
190                 std::placeholders::_3)},
191         {BluetoothHostInterfaceCode::GET_LOCAL_SUPPORTED_UUIDS,
192             std::bind(&BluetoothHostStub::GetLocalSupportedUuidsInner, std::placeholders::_1, std::placeholders::_2,
193                 std::placeholders::_3)},
194         {BluetoothHostInterfaceCode::GET_DEVICE_UUIDS,
195             std::bind(&BluetoothHostStub::GetDeviceUuidsInner, std::placeholders::_1, std::placeholders::_2,
196                 std::placeholders::_3)},
197         {BluetoothHostInterfaceCode::GET_LOCAL_PROFILE_UUIDS,
198             std::bind(&BluetoothHostStub::GetLocalProfileUuidsInner, std::placeholders::_1, std::placeholders::_2,
199                 std::placeholders::_3)},
200         {BluetoothHostInterfaceCode::BT_REGISTER_BLE_ADAPTER_OBSERVER,
201             std::bind(&BluetoothHostStub::RegisterBleAdapterObserverInner, std::placeholders::_1, std::placeholders::_2,
202                 std::placeholders::_3)},
203         {BluetoothHostInterfaceCode::BT_DEREGISTER_BLE_ADAPTER_OBSERVER,
204             std::bind(&BluetoothHostStub::DeregisterBleAdapterObserverInner, std::placeholders::_1,
205                 std::placeholders::_2, std::placeholders::_3)},
206         {BluetoothHostInterfaceCode::BT_REGISTER_BLE_PERIPHERAL_OBSERVER,
207             std::bind(&BluetoothHostStub::RegisterBlePeripheralCallbackInner, std::placeholders::_1,
208                 std::placeholders::_2, std::placeholders::_3)},
209         {BluetoothHostInterfaceCode::BT_DEREGISTER_BLE_PERIPHERAL_OBSERVER,
210             std::bind(&BluetoothHostStub::DeregisterBlePeripheralCallbackInner, std::placeholders::_1,
211                 std::placeholders::_2, std::placeholders::_3)},
212         {BluetoothHostInterfaceCode::BT_SET_FAST_SCAN,
213             std::bind(&BluetoothHostStub::SetFastScanInner, std::placeholders::_1,
214                 std::placeholders::_2, std::placeholders::_3)},
215         {BluetoothHostInterfaceCode::GET_RANDOM_ADDRESS, std::bind(&BluetoothHostStub::GetRandomAddressInner,
216             std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
217         {BluetoothHostInterfaceCode::SYNC_RANDOM_ADDRESS, std::bind(&BluetoothHostStub::SyncRandomAddressInner,
218             std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
219         {BluetoothHostInterfaceCode::START_CREDIBLE_PAIR,
220             std::bind(&BluetoothHostStub::StartCrediblePairInner, std::placeholders::_1, std::placeholders::_2,
221                 std::placeholders::_3)},
222         {BluetoothHostInterfaceCode::CONNECT_ALLOWED_PROFILES,
223             std::bind(&BluetoothHostStub::ConnectAllowedProfilesInner, std::placeholders::_1, std::placeholders::_2,
224                 std::placeholders::_3)},
225         {BluetoothHostInterfaceCode::DISCONNECT_ALLOWED_PROFILES,
226             std::bind(&BluetoothHostStub::DisconnectAllowedProfilesInner, std::placeholders::_1, std::placeholders::_2,
227                 std::placeholders::_3)},
228         {BluetoothHostInterfaceCode::SET_CUSTOM_TYPE,
229             std::bind(&BluetoothHostStub::SetDeviceCustomTypeInner, std::placeholders::_1, std::placeholders::_2,
230                 std::placeholders::_3)},
231         {BluetoothHostInterfaceCode::SATELLITE_CONTROL,
232             std::bind(&BluetoothHostStub::SatelliteControlInner, std::placeholders::_1, std::placeholders::_2,
233                 std::placeholders::_3)},
234         {BluetoothHostInterfaceCode::UPDATE_VIRTUAL_DEVICE,
235             std::bind(&BluetoothHostStub::UpdateVirtualDeviceInner,
236                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
237         {BluetoothHostInterfaceCode::GET_VIRTUAL_AUTO_CONN_SWITCH,
238             std::bind(&BluetoothHostStub::IsSupportVirtualAutoConnectInner,
239                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
240         {BluetoothHostInterfaceCode::SET_VIRTUAL_AUTO_CONN_TYPE,
241             std::bind(&BluetoothHostStub::SetVirtualAutoConnectTypeInner,
242                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
243         {BluetoothHostInterfaceCode::SET_FAST_SCAN_LEVEL,
244             std::bind(&BluetoothHostStub::SetFastScanLevelInner,
245                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
246         {BluetoothHostInterfaceCode::BT_REGISTER_RESOURCE_MANAGER_OBSERVER,
247             std::bind(&BluetoothHostStub::RegisterBtResourceManagerObserverInner,
248                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
249         {BluetoothHostInterfaceCode::BT_DEREGISTER_RESOURCE_MANAGER_OBSERVER,
250             std::bind(&BluetoothHostStub::DeregisterBtResourceManagerObserverInner,
251                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
252         {BluetoothHostInterfaceCode::GET_CONNECTION_TIME,
253             std::bind(&BluetoothHostStub::GetLastConnectionTimeInner,
254                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
255         {BluetoothHostInterfaceCode::BT_UPDATE_CLOUD_DEVICE,
256             std::bind(&BluetoothHostStub::UpdateCloudBluetoothDevInner,
257                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
258         {BluetoothHostInterfaceCode::GET_CLOUD_BOND_STATE,
259             std::bind(&BluetoothHostStub::GetCloudBondStateInner,
260                 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)},
261 };
262 
BluetoothHostStub()263 BluetoothHostStub::BluetoothHostStub(){};
~BluetoothHostStub()264 BluetoothHostStub::~BluetoothHostStub()
265 {}
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)266 int32_t BluetoothHostStub::OnRemoteRequest(
267     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
268 {
269     HILOGI("BluetoothHostStub::OnRemoteRequest, cmd = %{public}u, flags= %{public}d", code, option.GetFlags());
270     if (BluetoothHostStub::GetDescriptor() != data.ReadInterfaceToken()) {
271         HILOGE("BluetoothHostStub::OnRemoteRequest, local descriptor is not equal to remote");
272         return ERR_INVALID_STATE;
273     }
274     auto itFunc = memberFuncMap_.find(code);
275     if (itFunc != memberFuncMap_.end()) {
276         auto memberFunc = itFunc->second;
277         if (memberFunc != nullptr) {
278             return memberFunc(this, data, reply);
279         }
280     }
281     HILOGW("BluetoothHostStub::OnRemoteRequest, default case, need check.");
282     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
283 }
284 
RegisterObserverInner(MessageParcel & data,MessageParcel & reply)285 ErrCode BluetoothHostStub::RegisterObserverInner(MessageParcel &data, MessageParcel &reply)
286 {
287     HILOGI("BluetoothHostStub::RegisterObserverInner starts");
288     sptr<IRemoteObject> remote = data.ReadRemoteObject();
289     const sptr<IBluetoothHostObserver> observer = OHOS::iface_cast<IBluetoothHostObserver>(remote);
290     RegisterObserver(observer);
291     return NO_ERROR;
292 }
293 
DeregisterObserverInner(MessageParcel & data,MessageParcel & reply)294 ErrCode BluetoothHostStub::DeregisterObserverInner(MessageParcel &data, MessageParcel &reply)
295 {
296     HILOGI("BluetoothHostStub::DeregisterObserverInner starts");
297     sptr<IRemoteObject> remote = data.ReadRemoteObject();
298     const sptr<IBluetoothHostObserver> observer = OHOS::iface_cast<IBluetoothHostObserver>(remote);
299     DeregisterObserver(observer);
300     return NO_ERROR;
301 }
302 
EnableBtInner(MessageParcel & data,MessageParcel & reply)303 int32_t BluetoothHostStub::EnableBtInner(MessageParcel &data, MessageParcel &reply)
304 {
305     int32_t result = EnableBt();
306     bool ret = reply.WriteInt32(result);
307     if (!ret) {
308         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
309         return ERR_INVALID_VALUE;
310     }
311     return NO_ERROR;
312 }
313 
DisableBtInner(MessageParcel & data,MessageParcel & reply)314 int32_t BluetoothHostStub::DisableBtInner(MessageParcel &data, MessageParcel &reply)
315 {
316     int32_t result = DisableBt();
317     bool ret = reply.WriteInt32(result);
318     if (!ret) {
319         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
320         return BT_ERR_IPC_TRANS_FAILED;
321     }
322     return NO_ERROR;
323 }
324 
GetProfileInner(MessageParcel & data,MessageParcel & reply)325 ErrCode BluetoothHostStub::GetProfileInner(MessageParcel &data, MessageParcel &reply)
326 {
327     HILOGI("BluetoothHostStub::GetProfileInner starts");
328     std::string name = data.ReadString();
329     sptr<IRemoteObject> result = GetProfile(name);
330     bool ret = reply.WriteRemoteObject(result);
331     if (!ret) {
332         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
333         return TRANSACTION_ERR;
334     }
335     return NO_ERROR;
336 }
337 
GetBleRemoteInner(MessageParcel & data,MessageParcel & reply)338 ErrCode BluetoothHostStub::GetBleRemoteInner(MessageParcel &data, MessageParcel &reply)
339 {
340     HILOGI("BluetoothHostStub::GetBleRemoteInner starts");
341     std::string name = data.ReadString();
342     sptr<IRemoteObject> result = GetBleRemote(name);
343     bool ret = reply.WriteRemoteObject(result);
344     if (!ret) {
345         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
346         return TRANSACTION_ERR;
347     }
348     return NO_ERROR;
349 }
350 
BluetoothFactoryResetInner(MessageParcel & data,MessageParcel & reply)351 int32_t BluetoothHostStub::BluetoothFactoryResetInner(MessageParcel &data, MessageParcel &reply)
352 {
353     int32_t result = BluetoothFactoryReset();
354     bool ret = reply.WriteInt32(result);
355     if (!ret) {
356         HILOGE("WriteInt32 failed");
357         return ERR_INVALID_VALUE;
358     }
359     return NO_ERROR;
360 }
361 
GetBtStateInner(MessageParcel & data,MessageParcel & reply)362 ErrCode BluetoothHostStub::GetBtStateInner(MessageParcel &data, MessageParcel &reply)
363 {
364     HILOGI("BluetoothHostStub::GetBtStateInner starts");
365     int32_t state = 0;
366     int32_t result = GetBtState(state);
367     (void)reply.WriteInt32(result);
368     (void)reply.WriteInt32(state);
369     return NO_ERROR;
370 }
371 
GetLocalAddressInner(MessageParcel & data,MessageParcel & reply)372 int32_t BluetoothHostStub::GetLocalAddressInner(MessageParcel &data, MessageParcel &reply)
373 {
374     std::string addr = "00:00:00:00:00:00";
375     int32_t result = GetLocalAddress(addr);
376 
377     CHECK_AND_RETURN_LOG_RET(reply.WriteInt32(result), BT_ERR_IPC_TRANS_FAILED, "writing res failed");
378     CHECK_AND_RETURN_LOG_RET((result == BT_NO_ERROR), NO_ERROR, "get local addr failed");
379     CHECK_AND_RETURN_LOG_RET(reply.WriteString(addr), BT_ERR_IPC_TRANS_FAILED, "writing addr failed");
380     return NO_ERROR;
381 }
382 
DisableBleInner(MessageParcel & data,MessageParcel & reply)383 int32_t BluetoothHostStub::DisableBleInner(MessageParcel &data, MessageParcel &reply)
384 {
385     int32_t result = DisableBle();
386     bool ret = reply.WriteInt32(result);
387     if (!ret) {
388         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
389         return BT_ERR_IPC_TRANS_FAILED;
390     }
391     return NO_ERROR;
392 }
393 
EnableBleInner(MessageParcel & data,MessageParcel & reply)394 int32_t BluetoothHostStub::EnableBleInner(MessageParcel &data, MessageParcel &reply)
395 {
396     int32_t result = EnableBle();
397     bool ret = reply.WriteInt32(result);
398     if (!ret) {
399         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
400         return BT_ERR_IPC_TRANS_FAILED;
401     }
402     return NO_ERROR;
403 }
404 
GetProfileListInner(MessageParcel & data,MessageParcel & reply)405 ErrCode BluetoothHostStub::GetProfileListInner(MessageParcel &data, MessageParcel &reply)
406 {
407     std::vector<uint32_t> result = GetProfileList();
408     bool ret = reply.WriteUInt32Vector(result);
409     if (!ret) {
410         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
411         return TRANSACTION_ERR;
412     }
413     return NO_ERROR;
414 }
415 
GetMaxNumConnectedAudioDevicesInner(MessageParcel & data,MessageParcel & reply)416 ErrCode BluetoothHostStub::GetMaxNumConnectedAudioDevicesInner(MessageParcel &data, MessageParcel &reply)
417 {
418     int32_t result = GetMaxNumConnectedAudioDevices();
419     bool ret = reply.WriteInt32(result);
420     if (!ret) {
421         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
422         return TRANSACTION_ERR;
423     }
424     return NO_ERROR;
425 }
426 
GetBtConnectionStateInner(MessageParcel & data,MessageParcel & reply)427 int32_t BluetoothHostStub::GetBtConnectionStateInner(MessageParcel &data, MessageParcel &reply)
428 {
429     HILOGI("BluetoothHostStub::GetBtConnectionStateInner starts");
430     int32_t state = 0;
431     int32_t result = GetBtConnectionState(state);
432     bool ret = reply.WriteInt32(result);
433     if (!ret) {
434         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
435         return BT_ERR_IPC_TRANS_FAILED;
436     }
437     ret = reply.WriteInt32(state);
438     if (!ret) {
439         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
440         return BT_ERR_IPC_TRANS_FAILED;
441     }
442     return NO_ERROR;
443 }
444 
GetBtProfileConnStateInner(MessageParcel & data,MessageParcel & reply)445 int32_t BluetoothHostStub::GetBtProfileConnStateInner(MessageParcel &data, MessageParcel &reply)
446 {
447     uint32_t profileId;
448     data.ReadUint32(profileId);
449     int32_t state = 0;
450     int32_t result = GetBtProfileConnState(profileId, state);
451     bool ret = reply.WriteInt32(result);
452     if (!ret) {
453         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
454         return BT_ERR_IPC_TRANS_FAILED;
455     }
456     ret = reply.WriteInt32(state);
457     if (!ret) {
458         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
459         return BT_ERR_IPC_TRANS_FAILED;
460     }
461     return NO_ERROR;
462 }
463 
GetLocalDeviceClassInner(MessageParcel & data,MessageParcel & reply)464 ErrCode BluetoothHostStub::GetLocalDeviceClassInner(MessageParcel &data, MessageParcel &reply)
465 {
466     int32_t result = GetLocalDeviceClass();
467     bool ret = reply.WriteInt32(result);
468     if (!ret) {
469         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
470         return TRANSACTION_ERR;
471     }
472     return NO_ERROR;
473 }
474 
SetLocalDeviceClassInner(MessageParcel & data,MessageParcel & reply)475 ErrCode BluetoothHostStub::SetLocalDeviceClassInner(MessageParcel &data, MessageParcel &reply)
476 {
477     int32_t deviceClass;
478     data.ReadInt32(deviceClass);
479     bool result = SetLocalDeviceClass(deviceClass);
480     bool ret = reply.WriteInt32(result);
481     if (!ret) {
482         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
483         return TRANSACTION_ERR;
484     }
485     return NO_ERROR;
486 }
487 
GetLocalNameInner(MessageParcel & data,MessageParcel & reply)488 int32_t BluetoothHostStub::GetLocalNameInner(MessageParcel &data, MessageParcel &reply)
489 {
490     std::string name = "";
491     int32_t result = GetLocalName(name);
492     bool ret = reply.WriteInt32(result);
493     if (!ret) {
494         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
495         return BT_ERR_IPC_TRANS_FAILED;
496     }
497     ret = reply.WriteString(name);
498     if (!ret) {
499         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
500         return BT_ERR_IPC_TRANS_FAILED;
501     }
502     return NO_ERROR;
503 }
504 
SetLocalNameInner(MessageParcel & data,MessageParcel & reply)505 int32_t BluetoothHostStub::SetLocalNameInner(MessageParcel &data, MessageParcel &reply)
506 {
507     std::string name;
508     data.ReadString(name);
509     int32_t result = SetLocalName(name);
510     bool ret = reply.WriteInt32(result);
511     if (!ret) {
512         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
513         return BT_ERR_IPC_TRANS_FAILED;
514     }
515 
516     return NO_ERROR;
517 }
518 
GetDeviceTypeInner(MessageParcel & data,MessageParcel & reply)519 ErrCode BluetoothHostStub::GetDeviceTypeInner(MessageParcel &data, MessageParcel &reply)
520 {
521     int32_t transport;
522     if (!data.ReadInt32(transport)) {
523         HILOGE("BluetoothHostStub::GetDeviceType transport failed");
524         return TRANSACTION_ERR;
525     }
526     std::string address;
527     if (!data.ReadString(address)) {
528         HILOGE("BluetoothHostStub::GetDeviceType address failed");
529         return TRANSACTION_ERR;
530     }
531     int result = GetDeviceType(transport, address);
532     bool ret = reply.WriteInt32(result);
533     if (!ret) {
534         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
535         return ERR_INVALID_VALUE;
536     }
537     return NO_ERROR;
538 }
539 
GetBtScanModeInner(MessageParcel & data,MessageParcel & reply)540 int32_t BluetoothHostStub::GetBtScanModeInner(MessageParcel &data, MessageParcel &reply)
541 {
542     int32_t scanMode = 0;
543     int32_t result = GetBtScanMode(scanMode);
544     bool ret = reply.WriteInt32(result);
545     if (!ret) {
546         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
547         return BT_ERR_IPC_TRANS_FAILED;
548     }
549     ret = reply.WriteInt32(scanMode);
550     if (!ret) {
551         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
552         return BT_ERR_IPC_TRANS_FAILED;
553     }
554     return NO_ERROR;
555 }
556 
GetPhonebookPermissionInner(MessageParcel & data,MessageParcel & reply)557 ErrCode BluetoothHostStub::GetPhonebookPermissionInner(MessageParcel &data, MessageParcel &reply)
558 {
559     std::string address;
560     if (!data.ReadString(address)) {
561         HILOGE("BluetoothHostStub::GetPhonebookPermission address failed");
562         return TRANSACTION_ERR;
563     }
564     int result = GetPhonebookPermission(address);
565     bool ret = reply.WriteInt32(result);
566     if (!ret) {
567         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
568         return TRANSACTION_ERR;
569     }
570     return NO_ERROR;
571 }
572 
SetBtScanModeInner(MessageParcel & data,MessageParcel & reply)573 int32_t BluetoothHostStub::SetBtScanModeInner(MessageParcel &data, MessageParcel &reply)
574 {
575     int32_t mode;
576     data.ReadInt32(mode);
577     int32_t duration;
578     data.ReadInt32(duration);
579     int32_t result = SetBtScanMode(mode, duration);
580     bool ret = reply.WriteInt32(result);
581     if (!ret) {
582         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
583         return BT_ERR_IPC_TRANS_FAILED;
584     }
585     return NO_ERROR;
586 }
587 
SetPhonebookPermissionInner(MessageParcel & data,MessageParcel & reply)588 ErrCode BluetoothHostStub::SetPhonebookPermissionInner(MessageParcel &data, MessageParcel &reply)
589 {
590     std::string address;
591     if (!data.ReadString(address)) {
592         HILOGE("BluetoothHostStub::SetPhonebookPermission address failed");
593         return TRANSACTION_ERR;
594     }
595     int32_t permission;
596     if (!data.ReadInt32(permission)) {
597         HILOGE("BluetoothHostStub::SetPhonebookPermission permission failed");
598         return TRANSACTION_ERR;
599     }
600     bool result = SetPhonebookPermission(address, permission);
601     bool ret = reply.WriteBool(result);
602     if (!ret) {
603         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
604         return ERR_INVALID_VALUE;
605     }
606     return NO_ERROR;
607 }
608 
GetBondableModeInner(MessageParcel & data,MessageParcel & reply)609 ErrCode BluetoothHostStub::GetBondableModeInner(MessageParcel &data, MessageParcel &reply)
610 {
611     int32_t transport;
612     data.ReadInt32(transport);
613     int32_t result = GetBondableMode(transport);
614     bool ret = reply.WriteInt32(result);
615     if (!ret) {
616         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
617         return TRANSACTION_ERR;
618     }
619     return NO_ERROR;
620 }
GetMessagePermissionInner(MessageParcel & data,MessageParcel & reply)621 ErrCode BluetoothHostStub::GetMessagePermissionInner(MessageParcel &data, MessageParcel &reply)
622 {
623     std::string address;
624     if (!data.ReadString(address)) {
625         HILOGE("BluetoothHostStub::GetMessagePermission address failed");
626         return TRANSACTION_ERR;
627     }
628     int result = GetMessagePermission(address);
629     bool ret = reply.WriteInt32(result);
630     if (!ret) {
631         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
632         return TRANSACTION_ERR;
633     }
634     return NO_ERROR;
635 }
636 
SetBondableModeInner(MessageParcel & data,MessageParcel & reply)637 ErrCode BluetoothHostStub::SetBondableModeInner(MessageParcel &data, MessageParcel &reply)
638 {
639     int32_t transport;
640     data.ReadInt32(transport);
641     int32_t mode;
642     data.ReadInt32(mode);
643 
644     bool result = SetBondableMode(transport, mode);
645     bool ret = reply.WriteInt32(result);
646     if (!ret) {
647         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
648         return ERR_INVALID_VALUE;
649     }
650     return NO_ERROR;
651 }
652 
SetMessagePermissionInner(MessageParcel & data,MessageParcel & reply)653 ErrCode BluetoothHostStub::SetMessagePermissionInner(MessageParcel &data, MessageParcel &reply)
654 {
655     std::string address;
656     if (!data.ReadString(address)) {
657         HILOGE("BluetoothHostStub::SetMessagePermission address failed");
658         return TRANSACTION_ERR;
659     }
660     int32_t permission;
661     if (!data.ReadInt32(permission)) {
662         HILOGE("BluetoothHostStub::SetMessagePermission permission failed");
663         return TRANSACTION_ERR;
664     }
665     bool result = SetMessagePermission(address, permission);
666     bool ret = reply.WriteBool(result);
667     if (!ret) {
668         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
669         return TRANSACTION_ERR;
670     }
671     return NO_ERROR;
672 }
673 
GetPowerModeInner(MessageParcel & data,MessageParcel & reply)674 ErrCode BluetoothHostStub::GetPowerModeInner(MessageParcel &data, MessageParcel &reply)
675 {
676     std::string address;
677     if (!data.ReadString(address)) {
678         HILOGE("BluetoothHostStub::GetPowerMode address failed");
679         return TRANSACTION_ERR;
680     }
681     int result = GetPowerMode(address);
682     bool ret = reply.WriteInt32(result);
683     if (!ret) {
684         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
685         return TRANSACTION_ERR;
686     }
687     return NO_ERROR;
688 }
689 
StartBtDiscoveryInner(MessageParcel & data,MessageParcel & reply)690 int32_t BluetoothHostStub::StartBtDiscoveryInner(MessageParcel &data, MessageParcel &reply)
691 {
692     int32_t result = StartBtDiscovery();
693     bool ret = reply.WriteInt32(result);
694     if (!ret) {
695         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
696         return BT_ERR_IPC_TRANS_FAILED;
697     }
698     return NO_ERROR;
699 }
700 
CancelBtDiscoveryInner(MessageParcel & data,MessageParcel & reply)701 int32_t BluetoothHostStub::CancelBtDiscoveryInner(MessageParcel &data, MessageParcel &reply)
702 {
703     int32_t result = CancelBtDiscovery();
704     bool ret = reply.WriteInt32(result);
705     if (!ret) {
706         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
707         return BT_ERR_IPC_TRANS_FAILED;
708     }
709     return NO_ERROR;
710 }
711 
GetDeviceNameInner(MessageParcel & data,MessageParcel & reply)712 int32_t BluetoothHostStub::GetDeviceNameInner(MessageParcel &data, MessageParcel &reply)
713 {
714     int32_t transport;
715     if (!data.ReadInt32(transport)) {
716         HILOGE("BluetoothHostStub::GetDeviceName transport failed");
717         return BT_ERR_IPC_TRANS_FAILED;
718     }
719     std::string address;
720     if (!data.ReadString(address)) {
721         HILOGE("BluetoothHostStub::GetDeviceName address failed");
722         return BT_ERR_IPC_TRANS_FAILED;
723     }
724     bool alias = true;
725     if (!data.ReadBool(alias)) {
726         HILOGE("BluetoothHostStub::GetDeviceName alias failed");
727         return BT_ERR_IPC_TRANS_FAILED;
728     }
729     std::string name = "";
730     int32_t result = GetDeviceName(transport, address, name, alias);
731     bool ret = reply.WriteInt32(result);
732     if (!ret) {
733         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
734         return BT_ERR_IPC_TRANS_FAILED;
735     }
736     ret = reply.WriteString(name);
737     if (!ret) {
738         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
739         return BT_ERR_IPC_TRANS_FAILED;
740     }
741     return NO_ERROR;
742 }
743 
GetDeviceAliasInner(MessageParcel & data,MessageParcel & reply)744 ErrCode BluetoothHostStub::GetDeviceAliasInner(MessageParcel &data, MessageParcel &reply)
745 {
746     std::string address;
747     if (!data.ReadString(address)) {
748         HILOGE("BluetoothHostStub::GetDeviceAlias address failed");
749         return TRANSACTION_ERR;
750     }
751     std::string result = GetDeviceAlias(address);
752     bool ret = reply.WriteString(result);
753     if (!ret) {
754         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
755         return TRANSACTION_ERR;
756     }
757     return NO_ERROR;
758 }
759 
IsBtDiscoveringInner(MessageParcel & data,MessageParcel & reply)760 ErrCode BluetoothHostStub::IsBtDiscoveringInner(MessageParcel &data, MessageParcel &reply)
761 {
762     bool isDiscovering = false;
763     int32_t transport;
764     data.ReadInt32(transport);
765     int32_t result = IsBtDiscovering(isDiscovering, transport);
766     bool ret = reply.WriteInt32(result);
767     if (!ret) {
768         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
769         return BT_ERR_IPC_TRANS_FAILED;
770     }
771     ret = reply.WriteBool(isDiscovering);
772     if (!ret) {
773         HILOGE("BluetoothHostStub: reply isDiscovering writing failed in: %{public}s.", __func__);
774         return BT_ERR_IPC_TRANS_FAILED;
775     }
776     return BT_NO_ERROR;
777 }
778 
SetDeviceAliasInner(MessageParcel & data,MessageParcel & reply)779 ErrCode BluetoothHostStub::SetDeviceAliasInner(MessageParcel &data, MessageParcel &reply)
780 {
781     std::string address;
782     if (!data.ReadString(address)) {
783         HILOGE("BluetoothHostStub::SetDeviceAlias address failed");
784         return TRANSACTION_ERR;
785     }
786     std::string aliasName;
787     if (!data.ReadString(aliasName)) {
788         HILOGE("BluetoothHostStub::SetDeviceAlias aliasName failed");
789         return TRANSACTION_ERR;
790     }
791     int32_t res = SetDeviceAlias(address, aliasName);
792     bool ret = reply.WriteInt32(res);
793     if (!ret) {
794         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
795         return TRANSACTION_ERR;
796     }
797     return NO_ERROR;
798 }
799 
GetRemoteDeviceBatteryInfoInner(MessageParcel & data,MessageParcel & reply)800 int32_t BluetoothHostStub::GetRemoteDeviceBatteryInfoInner(MessageParcel &data, MessageParcel &reply)
801 {
802     std::string address;
803     if (!data.ReadString(address)) {
804         HILOGE("BluetoothHostStub::GetRemoteDeviceBattery address failed");
805         return TRANSACTION_ERR;
806     }
807     BluetoothBatteryInfo info;
808     int ret = GetRemoteDeviceBatteryInfo(address, info);
809     CHECK_AND_RETURN_LOG_RET(reply.WriteInt32(ret), BT_ERR_INTERNAL_ERROR, "write ret failed");
810     CHECK_AND_RETURN_LOG_RET(reply.WriteParcelable(&info), BT_ERR_INTERNAL_ERROR,
811         "write battery failed");
812     return BT_NO_ERROR;
813 }
814 
GetBtDiscoveryEndMillisInner(MessageParcel & data,MessageParcel & reply)815 ErrCode BluetoothHostStub::GetBtDiscoveryEndMillisInner(MessageParcel &data, MessageParcel &reply)
816 {
817     int64_t result = GetBtDiscoveryEndMillis();
818     bool ret = reply.WriteInt64(result);
819     if (!ret) {
820         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
821         return TRANSACTION_ERR;
822     }
823     return NO_ERROR;
824 }
825 
GetPairStateInner(MessageParcel & data,MessageParcel & reply)826 ErrCode BluetoothHostStub::GetPairStateInner(MessageParcel &data, MessageParcel &reply)
827 {
828     int32_t transport;
829     if (!data.ReadInt32(transport)) {
830         HILOGE("BluetoothHostStub::GetPairState transport failed");
831         return TRANSACTION_ERR;
832     }
833     std::string address;
834     if (!data.ReadString(address)) {
835         HILOGE("BluetoothHostStub::GetPairState address failed");
836         return TRANSACTION_ERR;
837     }
838     int32_t pairState;
839     int result = GetPairState(transport, address, pairState);
840     bool ret = reply.WriteInt32(result);
841     if (!ret) {
842         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
843         return BT_ERR_IPC_TRANS_FAILED;
844     }
845     ret = reply.WriteInt32(pairState);
846     if (!ret) {
847         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
848         return BT_ERR_IPC_TRANS_FAILED;
849     }
850     return BT_NO_ERROR;
851 }
852 
GetPairedDevicesInner(MessageParcel & data,MessageParcel & reply)853 int32_t BluetoothHostStub::GetPairedDevicesInner(MessageParcel &data, MessageParcel &reply)
854 {
855     std::vector<BluetoothRawAddress> pairDevice;
856     int32_t result = GetPairedDevices(pairDevice);
857     bool ret = true;
858     if (!reply.WriteInt32(pairDevice.size())) {
859         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
860         return BT_ERR_IPC_TRANS_FAILED;
861     } else {
862         for (auto device : pairDevice) {
863             reply.WriteParcelable(&device);
864         }
865     }
866     ret = reply.WriteInt32(result);
867     if (!ret) {
868         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
869         return BT_ERR_IPC_TRANS_FAILED;
870     }
871     return NO_ERROR;
872 }
873 
StartPairInner(MessageParcel & data,MessageParcel & reply)874 int32_t BluetoothHostStub::StartPairInner(MessageParcel &data, MessageParcel &reply)
875 {
876     int32_t transport;
877     if (!data.ReadInt32(transport)) {
878         HILOGE("BluetoothHostStub::StartPair transport failed");
879         return BT_ERR_IPC_TRANS_FAILED;
880     }
881     std::string address;
882     if (!data.ReadString(address)) {
883         HILOGE("BluetoothHostStub::StartPair address failed");
884         return BT_ERR_IPC_TRANS_FAILED;
885     }
886     int32_t result = StartPair(transport, address);
887     bool ret = reply.WriteInt32(result);
888     if (!ret) {
889         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
890         return BT_ERR_IPC_TRANS_FAILED;
891     }
892     return NO_ERROR;
893 }
894 
RemovePairInner(MessageParcel & data,MessageParcel & reply)895 int32_t BluetoothHostStub::RemovePairInner(MessageParcel &data, MessageParcel &reply)
896 {
897     int32_t transport = data.ReadInt32();
898     sptr<BluetoothRawAddress> device = data.ReadStrongParcelable<BluetoothRawAddress>();
899     int32_t result = RemovePair(transport, device);
900     bool ret = reply.WriteInt32(result);
901     if (!ret) {
902         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
903         return TRANSACTION_ERR;
904     }
905     return NO_ERROR;
906 }
907 
CancelPairingInner(MessageParcel & data,MessageParcel & reply)908 ErrCode BluetoothHostStub::CancelPairingInner(MessageParcel &data, MessageParcel &reply)
909 {
910     int32_t transport;
911     if (!data.ReadInt32(transport)) {
912         HILOGE("BluetoothHostStub::CancelPairing transport failed");
913         return TRANSACTION_ERR;
914     }
915     std::string address;
916     if (!data.ReadString(address)) {
917         HILOGE("BluetoothHostStub::CancelPairing address failed");
918         return TRANSACTION_ERR;
919     }
920     bool result = CancelPairing(transport, address);
921     bool ret = reply.WriteBool(result);
922     if (!ret) {
923         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
924         return TRANSACTION_ERR;
925     }
926     return NO_ERROR;
927 }
928 
RemoveAllPairsInner(MessageParcel & data,MessageParcel & reply)929 ErrCode BluetoothHostStub::RemoveAllPairsInner(MessageParcel &data, MessageParcel &reply)
930 {
931     bool result = RemoveAllPairs();
932     bool ret = reply.WriteBool(result);
933     if (!ret) {
934         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
935         return TRANSACTION_ERR;
936     }
937 
938     return NO_ERROR;
939 }
940 
IsBondedFromLocalInner(MessageParcel & data,MessageParcel & reply)941 ErrCode BluetoothHostStub::IsBondedFromLocalInner(MessageParcel &data, MessageParcel &reply)
942 {
943     int32_t transport;
944     if (!data.ReadInt32(transport)) {
945         HILOGE("BluetoothHostStub::IsBondedFromLocal transport failed");
946         return TRANSACTION_ERR;
947     }
948     std::string address;
949     if (!data.ReadString(address)) {
950         HILOGE("BluetoothHostStub::IsBondedFromLocal address failed");
951         return TRANSACTION_ERR;
952     }
953     bool result = IsBondedFromLocal(transport, address);
954     bool ret = reply.WriteBool(result);
955     if (!ret) {
956         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
957         return TRANSACTION_ERR;
958     }
959     return NO_ERROR;
960 }
961 
SetDevicePinInner(MessageParcel & data,MessageParcel & reply)962 int32_t BluetoothHostStub::SetDevicePinInner(MessageParcel &data, MessageParcel &reply)
963 {
964     std::string address;
965     if (!data.ReadString(address)) {
966         HILOGE("BluetoothHostStub::SetDevicePin address failed");
967         return BT_ERR_IPC_TRANS_FAILED;
968     }
969     std::string pin;
970     if (!data.ReadString(pin)) {
971         HILOGE("BluetoothHostStub::SetDevicePin pin failed");
972         return BT_ERR_IPC_TRANS_FAILED;
973     }
974     int32_t result = SetDevicePin(address, pin);
975     bool ret = reply.WriteInt32(result);
976     if (!ret) {
977         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
978         return BT_ERR_IPC_TRANS_FAILED;
979     }
980     return NO_ERROR;
981 }
982 
IsAclConnectedInner(MessageParcel & data,MessageParcel & reply)983 ErrCode BluetoothHostStub::IsAclConnectedInner(MessageParcel &data, MessageParcel &reply)
984 {
985     int32_t transport;
986     if (!data.ReadInt32(transport)) {
987         HILOGE("BluetoothHostStub::IsAclConnected transport failed");
988         return TRANSACTION_ERR;
989     }
990     std::string address;
991     if (!data.ReadString(address)) {
992         HILOGE("BluetoothHostStub::IsAclConnected address failed");
993         return TRANSACTION_ERR;
994     }
995     bool result = IsAclConnected(transport, address);
996     bool ret = reply.WriteBool(result);
997     if (!ret) {
998         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
999         return TRANSACTION_ERR;
1000     }
1001     if (!ret) {
1002         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1003         return TRANSACTION_ERR;
1004     }
1005     return NO_ERROR;
1006 }
1007 
RegisterRemoteDeviceObserverInner(MessageParcel & data,MessageParcel & reply)1008 ErrCode BluetoothHostStub::RegisterRemoteDeviceObserverInner(MessageParcel &data, MessageParcel &reply)
1009 {
1010     auto tempObject = data.ReadRemoteObject();
1011     sptr<IBluetoothRemoteDeviceObserver> observer;
1012     observer = iface_cast<IBluetoothRemoteDeviceObserver>(tempObject);
1013     RegisterRemoteDeviceObserver(observer);
1014     return NO_ERROR;
1015 }
1016 
DeregisterRemoteDeviceObserverInner(MessageParcel & data,MessageParcel & reply)1017 ErrCode BluetoothHostStub::DeregisterRemoteDeviceObserverInner(MessageParcel &data, MessageParcel &reply)
1018 {
1019     auto tempObject = data.ReadRemoteObject();
1020     sptr<IBluetoothRemoteDeviceObserver> observer;
1021     observer = iface_cast<IBluetoothRemoteDeviceObserver>(tempObject);
1022     DeregisterRemoteDeviceObserver(observer);
1023     return NO_ERROR;
1024 }
1025 
GetBleMaxAdvertisingDataLengthInner(MessageParcel & data,MessageParcel & reply)1026 ErrCode BluetoothHostStub::GetBleMaxAdvertisingDataLengthInner(MessageParcel &data, MessageParcel &reply)
1027 {
1028     int32_t result = GetBleMaxAdvertisingDataLength();
1029     bool ret = reply.WriteInt32(result);
1030     if (!ret) {
1031         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1032         return TRANSACTION_ERR;
1033     }
1034     return NO_ERROR;
1035 }
1036 
IsAclEncryptedInner(MessageParcel & data,MessageParcel & reply)1037 ErrCode BluetoothHostStub::IsAclEncryptedInner(MessageParcel &data, MessageParcel &reply)
1038 {
1039     int32_t transport;
1040     if (!data.ReadInt32(transport)) {
1041         HILOGE("BluetoothHostStub::IsAclEncrypted transport failed");
1042         return TRANSACTION_ERR;
1043     }
1044     std::string address;
1045     if (!data.ReadString(address)) {
1046         HILOGE("BluetoothHostStub::IsAclEncrypted address failed");
1047         return TRANSACTION_ERR;
1048     }
1049     bool result = IsAclEncrypted(transport, address);
1050     bool ret = reply.WriteBool(result);
1051     if (!ret) {
1052         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1053         return TRANSACTION_ERR;
1054     }
1055     return NO_ERROR;
1056 }
1057 
GetDeviceClassInner(MessageParcel & data,MessageParcel & reply)1058 int32_t BluetoothHostStub::GetDeviceClassInner(MessageParcel &data, MessageParcel &reply)
1059 {
1060     std::string address;
1061     if (!data.ReadString(address)) {
1062         HILOGE("BluetoothHostStub::GetDeviceClass address failed");
1063         return BT_ERR_IPC_TRANS_FAILED;
1064     }
1065     int32_t cod = 0;
1066     int result = GetDeviceClass(address, cod);
1067     bool ret = reply.WriteInt32(result);
1068     if (!ret) {
1069         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1070         return BT_ERR_IPC_TRANS_FAILED;
1071     }
1072     ret = reply.WriteInt32(cod);
1073     if (!ret) {
1074         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1075         return BT_ERR_IPC_TRANS_FAILED;
1076     }
1077     return NO_ERROR;
1078 }
1079 
SetDevicePairingConfirmationInner(MessageParcel & data,MessageParcel & reply)1080 int32_t BluetoothHostStub::SetDevicePairingConfirmationInner(MessageParcel &data, MessageParcel &reply)
1081 {
1082     int32_t transport;
1083     if (!data.ReadInt32(transport)) {
1084         HILOGE("BluetoothHostStub::SetDevicePairingConfirmation transport failed");
1085         return BT_ERR_IPC_TRANS_FAILED;
1086     }
1087     std::string address;
1088     if (!data.ReadString(address)) {
1089         HILOGE("BluetoothHostStub::SetDevicePairingConfirmation address failed");
1090         return BT_ERR_IPC_TRANS_FAILED;
1091     }
1092     bool accept = false;
1093     if (!data.ReadBool(accept)) {
1094         HILOGE("BluetoothHostStub::SetDevicePairingConfirmation accept failed");
1095         return BT_ERR_IPC_TRANS_FAILED;
1096     }
1097     int32_t result = SetDevicePairingConfirmation(transport, address, accept);
1098     bool ret = reply.WriteInt32(result);
1099     if (!ret) {
1100         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1101         return BT_ERR_IPC_TRANS_FAILED;
1102     }
1103     return NO_ERROR;
1104 }
1105 
SetDevicePasskeyInner(MessageParcel & data,MessageParcel & reply)1106 ErrCode BluetoothHostStub::SetDevicePasskeyInner(MessageParcel &data, MessageParcel &reply)
1107 {
1108     int32_t transport;
1109     if (!data.ReadInt32(transport)) {
1110         HILOGE("BluetoothHostStub::SetDevicePasskey transport failed");
1111         return TRANSACTION_ERR;
1112     }
1113     std::string address;
1114     if (!data.ReadString(address)) {
1115         HILOGE("BluetoothHostStub::SetDevicePasskey address failed");
1116         return TRANSACTION_ERR;
1117     }
1118     int32_t passkey;
1119     if (!data.ReadInt32(passkey)) {
1120         HILOGE("BluetoothHostStub::SetDevicePasskey passkey failed");
1121         return TRANSACTION_ERR;
1122     }
1123     bool accept = false;
1124     if (!data.ReadBool(accept)) {
1125         HILOGE("BluetoothHostStub::SetDevicePasskey accept failed");
1126         return TRANSACTION_ERR;
1127     }
1128     bool result = SetDevicePasskey(transport, address, passkey, accept);
1129     bool ret = reply.WriteBool(result);
1130     if (!ret) {
1131         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1132         return TRANSACTION_ERR;
1133     }
1134     return NO_ERROR;
1135 }
1136 
PairRequestReplyInner(MessageParcel & data,MessageParcel & reply)1137 ErrCode BluetoothHostStub::PairRequestReplyInner(MessageParcel &data, MessageParcel &reply)
1138 {
1139     int32_t transport;
1140     if (!data.ReadInt32(transport)) {
1141         HILOGE("BluetoothHostStub::PairRequestReply transport failed");
1142         return TRANSACTION_ERR;
1143     }
1144     std::string address;
1145     if (!data.ReadString(address)) {
1146         HILOGE("BluetoothHostStub::PairRequestReply address failed");
1147         return TRANSACTION_ERR;
1148     }
1149     bool accept = false;
1150     if (!data.ReadBool(accept)) {
1151         HILOGE("BluetoothHostStub::PairRequestReply accept failed");
1152         return TRANSACTION_ERR;
1153     }
1154     bool result = PairRequestReply(transport, address, accept);
1155     bool ret = reply.WriteBool(result);
1156     if (!ret) {
1157         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1158         return TRANSACTION_ERR;
1159     }
1160     return NO_ERROR;
1161 }
1162 
ReadRemoteRssiValueInner(MessageParcel & data,MessageParcel & reply)1163 ErrCode BluetoothHostStub::ReadRemoteRssiValueInner(MessageParcel &data, MessageParcel &reply)
1164 {
1165     std::string address;
1166     if (!data.ReadString(address)) {
1167         HILOGE("BluetoothHostStub::ReadRemoteRssiValue address failed");
1168         return TRANSACTION_ERR;
1169     }
1170     bool result = ReadRemoteRssiValue(address);
1171     bool ret = reply.WriteBool(result);
1172     if (!ret) {
1173         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1174         return TRANSACTION_ERR;
1175     }
1176     return NO_ERROR;
1177 }
1178 
GetLocalSupportedUuidsInner(MessageParcel & data,MessageParcel & reply)1179 ErrCode BluetoothHostStub::GetLocalSupportedUuidsInner(MessageParcel &data, MessageParcel &reply)
1180 {
1181     std::vector<std::string> uuids;
1182     GetLocalSupportedUuids(uuids);
1183     int32_t size = uuids.size();
1184     bool ret = reply.WriteInt32(size);
1185     if (!ret) {
1186         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1187         return TRANSACTION_ERR;
1188     }
1189     for (auto uuid : uuids) {
1190         if (!reply.WriteString(uuid)) {
1191             HILOGE("BluetoothHostStub: GetLocalSupportedUuidsInner write uuid error");
1192             return TRANSACTION_ERR;
1193         }
1194     }
1195     return NO_ERROR;
1196 }
1197 
GetDeviceUuidsInner(MessageParcel & data,MessageParcel & reply)1198 ErrCode BluetoothHostStub::GetDeviceUuidsInner(MessageParcel &data, MessageParcel &reply)
1199 {
1200     std::string address;
1201     std::vector<std::string> uuids;
1202     if (!data.ReadString(address)) {
1203         HILOGE("BluetoothHostProxy::GetDeviceUuids Read address error");
1204         return TRANSACTION_ERR;
1205     }
1206     int res = GetDeviceUuids(address, uuids);
1207     int32_t size = uuids.size();
1208     bool ret = reply.WriteInt32(size);
1209     if (!ret) {
1210         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1211         return TRANSACTION_ERR;
1212     }
1213     for (auto uuid : uuids) {
1214         if (!reply.WriteString(uuid)) {
1215             HILOGE("BluetoothHostStub: GetDeviceUuidsInner write uuid error");
1216             return TRANSACTION_ERR;
1217         }
1218     }
1219     if (!reply.WriteInt32(res)) {
1220         HILOGE("BluetoothHostStub: GetDeviceUuidsInner write result error");
1221         return TRANSACTION_ERR;
1222     }
1223     return NO_ERROR;
1224 }
1225 
GetLocalProfileUuidsInner(MessageParcel & data,MessageParcel & reply)1226 ErrCode BluetoothHostStub::GetLocalProfileUuidsInner(MessageParcel &data, MessageParcel &reply)
1227 {
1228     return NO_ERROR;
1229 }
1230 
RegisterBleAdapterObserverInner(MessageParcel & data,MessageParcel & reply)1231 ErrCode BluetoothHostStub::RegisterBleAdapterObserverInner(MessageParcel &data, MessageParcel &reply)
1232 {
1233     auto tempObject = data.ReadRemoteObject();
1234     sptr<IBluetoothHostObserver> observer;
1235     observer = iface_cast<IBluetoothHostObserver>(tempObject);
1236     RegisterBleAdapterObserver(observer);
1237     return NO_ERROR;
1238 }
1239 
DeregisterBleAdapterObserverInner(MessageParcel & data,MessageParcel & reply)1240 ErrCode BluetoothHostStub::DeregisterBleAdapterObserverInner(MessageParcel &data, MessageParcel &reply)
1241 {
1242     auto tempObject = data.ReadRemoteObject();
1243     sptr<IBluetoothHostObserver> observer;
1244     observer = iface_cast<IBluetoothHostObserver>(tempObject);
1245     DeregisterBleAdapterObserver(observer);
1246     return NO_ERROR;
1247 }
1248 
RegisterBlePeripheralCallbackInner(MessageParcel & data,MessageParcel & reply)1249 ErrCode BluetoothHostStub::RegisterBlePeripheralCallbackInner(MessageParcel &data, MessageParcel &reply)
1250 {
1251     auto tempObject = data.ReadRemoteObject();
1252     sptr<IBluetoothBlePeripheralObserver> observer;
1253     observer = iface_cast<IBluetoothBlePeripheralObserver>(tempObject);
1254     RegisterBlePeripheralCallback(observer);
1255     return NO_ERROR;
1256 }
1257 
DeregisterBlePeripheralCallbackInner(MessageParcel & data,MessageParcel & reply)1258 ErrCode BluetoothHostStub::DeregisterBlePeripheralCallbackInner(MessageParcel &data, MessageParcel &reply)
1259 {
1260     auto tempObject = data.ReadRemoteObject();
1261     sptr<IBluetoothBlePeripheralObserver> observer;
1262     observer = iface_cast<IBluetoothBlePeripheralObserver>(tempObject);
1263     DeregisterBlePeripheralCallback(observer);
1264     return NO_ERROR;
1265 }
1266 
SetFastScanInner(MessageParcel & data,MessageParcel & reply)1267 int32_t BluetoothHostStub::SetFastScanInner(MessageParcel &data, MessageParcel &reply)
1268 {
1269     return NO_ERROR;
1270 }
1271 
GetRandomAddressInner(MessageParcel & data,MessageParcel & reply)1272 ErrCode BluetoothHostStub::GetRandomAddressInner(MessageParcel &data, MessageParcel &reply)
1273 {
1274     return NO_ERROR;
1275 }
1276 
SyncRandomAddressInner(MessageParcel & data,MessageParcel & reply)1277 ErrCode BluetoothHostStub::SyncRandomAddressInner(MessageParcel &data, MessageParcel &reply)
1278 {
1279     return NO_ERROR;
1280 }
1281 
StartCrediblePairInner(MessageParcel & data,MessageParcel & reply)1282 ErrCode BluetoothHostStub::StartCrediblePairInner(MessageParcel &data, MessageParcel &reply)
1283 {
1284     std::string address = data.ReadString();
1285     int32_t transport = data.ReadInt32();
1286     int result = StartCrediblePair(transport, address);
1287     bool ret = reply.WriteInt32(result);
1288     if (!ret) {
1289         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1290     }
1291     return NO_ERROR;
1292 }
1293 
SatelliteControlInner(MessageParcel & data,MessageParcel & reply)1294 ErrCode BluetoothHostStub::SatelliteControlInner(MessageParcel &data, MessageParcel &reply)
1295 {
1296     return NO_ERROR;
1297 }
1298 
ConnectAllowedProfilesInner(MessageParcel & data,MessageParcel & reply)1299 int32_t BluetoothHostStub::ConnectAllowedProfilesInner(MessageParcel &data, MessageParcel &reply)
1300 {
1301     return BT_ERR_API_NOT_SUPPORT;
1302 }
1303 
DisconnectAllowedProfilesInner(MessageParcel & data,MessageParcel & reply)1304 int32_t BluetoothHostStub::DisconnectAllowedProfilesInner(MessageParcel &data, MessageParcel &reply)
1305 {
1306     return BT_ERR_API_NOT_SUPPORT;
1307 }
1308 
SetDeviceCustomTypeInner(MessageParcel & data,MessageParcel & reply)1309 int32_t BluetoothHostStub::SetDeviceCustomTypeInner(MessageParcel &data, MessageParcel &reply)
1310 {
1311     std::string address;
1312     if (!data.ReadString(address)) {
1313         HILOGE("BluetoothHostStub::SetDeviceCustomType address failed");
1314         return TRANSACTION_ERR;
1315     }
1316     int32_t customType;
1317     if (!data.ReadInt32(customType)) {
1318         HILOGE("BluetoothHostStub::SetDeviceCustomType customType failed");
1319         return TRANSACTION_ERR;
1320     }
1321     bool ret = reply.WriteInt32(BT_ERR_API_NOT_SUPPORT);
1322     if (!ret) {
1323         HILOGE("BluetoothHostStub: reply writing failed in: %{public}s.", __func__);
1324         return TRANSACTION_ERR;
1325     }
1326     return BT_ERR_API_NOT_SUPPORT;
1327 }
1328 
UpdateVirtualDeviceInner(MessageParcel & data,MessageParcel & reply)1329 int32_t BluetoothHostStub::UpdateVirtualDeviceInner(MessageParcel &data, MessageParcel &reply)
1330 {
1331     return BT_ERR_API_NOT_SUPPORT;
1332 }
1333 
IsSupportVirtualAutoConnectInner(MessageParcel & data,MessageParcel & reply)1334 int32_t BluetoothHostStub::IsSupportVirtualAutoConnectInner(MessageParcel &data, MessageParcel &reply)
1335 {
1336     return BT_ERR_API_NOT_SUPPORT;
1337 }
1338 
SetVirtualAutoConnectTypeInner(MessageParcel & data,MessageParcel & reply)1339 int32_t BluetoothHostStub::SetVirtualAutoConnectTypeInner(MessageParcel &data, MessageParcel &reply)
1340 {
1341     return BT_ERR_API_NOT_SUPPORT;
1342 }
1343 
SetFastScanLevelInner(MessageParcel & data,MessageParcel & reply)1344 int32_t BluetoothHostStub::SetFastScanLevelInner(MessageParcel &data, MessageParcel &reply)
1345 {
1346     return BT_ERR_API_NOT_SUPPORT;
1347 }
1348 
EnableBluetoothToRestrictModeInner(MessageParcel & data,MessageParcel & reply)1349 int32_t BluetoothHostStub::EnableBluetoothToRestrictModeInner(MessageParcel &data, MessageParcel &reply)
1350 {
1351     return BT_ERR_API_NOT_SUPPORT;
1352 }
1353 
RegisterBtResourceManagerObserverInner(MessageParcel & data,MessageParcel & reply)1354 int32_t BluetoothHostStub::RegisterBtResourceManagerObserverInner(MessageParcel &data, MessageParcel &reply)
1355 {
1356     auto tempObject = data.ReadRemoteObject();
1357     sptr<IBluetoothResourceManagerObserver> observer;
1358     observer = iface_cast<IBluetoothResourceManagerObserver>(tempObject);
1359     CHECK_AND_RETURN_LOG_RET(observer != nullptr, ERR_INVALID_VALUE, "observer is nullptr");
1360     RegisterBtResourceManagerObserver(observer);
1361     return NO_ERROR;
1362 }
1363 
DeregisterBtResourceManagerObserverInner(MessageParcel & data,MessageParcel & reply)1364 int32_t BluetoothHostStub::DeregisterBtResourceManagerObserverInner(MessageParcel &data, MessageParcel &reply)
1365 {
1366     auto tempObject = data.ReadRemoteObject();
1367     sptr<IBluetoothResourceManagerObserver> observer;
1368     observer = iface_cast<IBluetoothResourceManagerObserver>(tempObject);
1369     CHECK_AND_RETURN_LOG_RET(observer != nullptr, ERR_INVALID_VALUE, "observer is nullptr");
1370     DeregisterBtResourceManagerObserver(observer);
1371     return NO_ERROR;
1372 }
1373 
GetLastConnectionTimeInner(MessageParcel & data,MessageParcel & reply)1374 int32_t BluetoothHostStub::GetLastConnectionTimeInner(MessageParcel &data, MessageParcel &reply)
1375 {
1376     return NO_ERROR;
1377 }
1378 
UpdateCloudBluetoothDevInner(MessageParcel & data,MessageParcel & reply)1379 int32_t BluetoothHostStub::UpdateCloudBluetoothDevInner(MessageParcel &data, MessageParcel &reply)
1380 {
1381     return NO_ERROR;
1382 }
1383 
GetCloudBondStateInner(MessageParcel & data,MessageParcel & reply)1384 int32_t BluetoothHostStub::GetCloudBondStateInner(MessageParcel &data, MessageParcel &reply)
1385 {
1386     return NO_ERROR;
1387 }
1388 }  // namespace Bluetooth
1389 }  // namespace OHOS
1390