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_hfp_hf_stub.h"
17 #include "bluetooth_log.h"
18
19 namespace OHOS {
20 namespace Bluetooth {
BluetoothHfpHfStub()21 BluetoothHfpHfStub::BluetoothHfpHfStub() {
22 HILOGD("%{public}s start.", __func__);
23 memberFuncMap_[static_cast<uint32_t>(
24 BluetoothHfpHfInterfaceCode::BT_HFP_HF_CONNECT_SCO)] =
25 &BluetoothHfpHfStub::ConnectScoInner;
26 memberFuncMap_[static_cast<uint32_t>(
27 BluetoothHfpHfInterfaceCode::BT_HFP_HF_DISCONNECT_SCO)] =
28 &BluetoothHfpHfStub::DisconnectScoInner;
29 memberFuncMap_[static_cast<uint32_t>(
30 BluetoothHfpHfInterfaceCode::BT_HFP_HF_GET_DEVICES_BY_STATES)] =
31 &BluetoothHfpHfStub::GetDevicesByStatesInner;
32 memberFuncMap_[static_cast<uint32_t>(
33 BluetoothHfpHfInterfaceCode::BT_HFP_HF_GET_DEVICE_STATE)] =
34 &BluetoothHfpHfStub::GetDeviceStateInner;
35 memberFuncMap_[static_cast<uint32_t>(
36 BluetoothHfpHfInterfaceCode::BT_HFP_HF_GET_SCO_STATE)] =
37 &BluetoothHfpHfStub::GetScoStateInner;
38 memberFuncMap_[static_cast<uint32_t>(
39 BluetoothHfpHfInterfaceCode::BT_HFP_HF_SEND_DTMF_TONE)] =
40 &BluetoothHfpHfStub::SendDTMFToneInner;
41 memberFuncMap_[static_cast<uint32_t>(
42 BluetoothHfpHfInterfaceCode::BT_HFP_HF_CONNECT)] =
43 nullptr;
44 memberFuncMap_[static_cast<uint32_t>(
45 BluetoothHfpHfInterfaceCode::BT_HFP_HF_DISCONNECT)] =
46 &BluetoothHfpHfStub::DisconnectInner;
47 memberFuncMap_[static_cast<uint32_t>(
48 BluetoothHfpHfInterfaceCode::BT_HFP_HF_OPEN_VOICE_RECOGNITION)] =
49 &BluetoothHfpHfStub::OpenVoiceRecognitionInner;
50 memberFuncMap_[static_cast<uint32_t>(
51 BluetoothHfpHfInterfaceCode::BT_HFP_HF_CLOSE_VOICE_RECOGNITION)] =
52 &BluetoothHfpHfStub::CloseVoiceRecognitionInner;
53 memberFuncMap_[static_cast<uint32_t>(
54 BluetoothHfpHfInterfaceCode::BT_HFP_HF_GET_CURRENT_CALL_LIST)] =
55 &BluetoothHfpHfStub::GetCurrentCallListInner;
56 memberFuncMap_[static_cast<uint32_t>(
57 BluetoothHfpHfInterfaceCode::BT_HFP_HF_ACCEPT_INCOMING_CALL)] =
58 &BluetoothHfpHfStub::AcceptIncomingCallInner;
59 memberFuncMap_[static_cast<uint32_t>(
60 BluetoothHfpHfInterfaceCode::BT_HFP_HF_HOLD_ACTIVE_CALL)] =
61 &BluetoothHfpHfStub::HoldActiveCallInner;
62 memberFuncMap_[static_cast<uint32_t>(
63 BluetoothHfpHfInterfaceCode::BT_HFP_HF_REJECT_INCOMING_CALL)] =
64 &BluetoothHfpHfStub::RejectIncomingCallInner;
65 memberFuncMap_[static_cast<uint32_t>(
66 BluetoothHfpHfInterfaceCode::BT_HFP_HF_SEND_KEY_PRESSED)] =
67 &BluetoothHfpHfStub::SendKeyPressedInner;
68 memberFuncMap_[static_cast<uint32_t>(
69 BluetoothHfpHfInterfaceCode::BT_HFP_HF_HANDLE_INCOMING_CALL)] =
70 &BluetoothHfpHfStub::HandleIncomingCallInner;
71 memberFuncMap_[static_cast<uint32_t>(
72 BluetoothHfpHfInterfaceCode::BT_HFP_HF_HANDLE_MULLTI_CALL)] =
73 &BluetoothHfpHfStub::HandleMultiCallInner;
74 memberFuncMap_[static_cast<uint32_t>(
75 BluetoothHfpHfInterfaceCode::BT_HFP_HF_DIAL_LAST_NUMBER)] =
76 &BluetoothHfpHfStub::DialLastNumberInner;
77 memberFuncMap_[static_cast<uint32_t>(
78 BluetoothHfpHfInterfaceCode::BT_HFP_HF_DIAL_MEMORY)] =
79 &BluetoothHfpHfStub::DialMemoryInner;
80 memberFuncMap_[static_cast<uint32_t>(
81 BluetoothHfpHfInterfaceCode::BT_HFP_HF_SEND_VOICE_TAG)] =
82 &BluetoothHfpHfStub::SendVoiceTagInner;
83 memberFuncMap_[static_cast<uint32_t>(
84 BluetoothHfpHfInterfaceCode::BT_HFP_HF_FINISH_ATIVE_CALL)] =
85 &BluetoothHfpHfStub::FinishActiveCallInner;
86 memberFuncMap_[static_cast<uint32_t>(
87 BluetoothHfpHfInterfaceCode::BT_HFP_HF_START_DIAL)] =
88 &BluetoothHfpHfStub::StartDialInner;
89 memberFuncMap_[static_cast<uint32_t>(
90 BluetoothHfpHfInterfaceCode::BT_HFP_HF_REGISTER_OBSERVER)] =
91 &BluetoothHfpHfStub::RegisterObserverInner;
92 memberFuncMap_[static_cast<uint32_t>(
93 BluetoothHfpHfInterfaceCode::BT_HFP_HF_DEREGISTER_OBSERVER)] =
94 &BluetoothHfpHfStub::DeregisterObserverInner;
95
96 HILOGD("%{public}s ends.", __func__);
97 }
98
~BluetoothHfpHfStub()99 BluetoothHfpHfStub::~BluetoothHfpHfStub() {
100 HILOGD("%{public}s start.", __func__);
101 memberFuncMap_.clear();
102 }
103
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)104 int BluetoothHfpHfStub::OnRemoteRequest(
105 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) {
106 HILOGD("BluetoothHfpHfStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d", code, option.GetFlags());
107 std::u16string descriptor = BluetoothHfpHfStub::GetDescriptor();
108 std::u16string remoteDescriptor = data.ReadInterfaceToken();
109 if (descriptor != remoteDescriptor) {
110 HILOGI("local descriptor is not equal to remote");
111 return ERR_INVALID_STATE;
112 }
113
114 auto itFunc = memberFuncMap_.find(code);
115 if (itFunc != memberFuncMap_.end()) {
116 auto memberFunc = itFunc->second;
117 if (memberFunc != nullptr) {
118 return (this->*memberFunc)(data, reply);
119 }
120 }
121 HILOGW("BluetoothHfpHfStub::OnRemoteRequest, default case, need check.");
122 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
123 }
124
ConnectScoInner(MessageParcel & data,MessageParcel & reply)125 ErrCode BluetoothHfpHfStub::ConnectScoInner(MessageParcel &data, MessageParcel &reply) {
126 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
127 if (!device) {
128 return TRANSACTION_ERR;
129 }
130 int result = ConnectSco(*device);
131 if (!reply.WriteBool(result)) {
132 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
133 return ERR_INVALID_VALUE;
134 }
135 return NO_ERROR;
136 }
137
DisconnectScoInner(MessageParcel & data,MessageParcel & reply)138 ErrCode BluetoothHfpHfStub::DisconnectScoInner(MessageParcel &data, MessageParcel &reply) {
139 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
140 if (!device) {
141 return TRANSACTION_ERR;
142 }
143 int result = DisconnectSco(*device);
144 if (!reply.WriteBool(result)) {
145 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
146 return ERR_INVALID_VALUE;
147 }
148 return NO_ERROR;
149 }
150
GetDevicesByStatesInner(MessageParcel & data,MessageParcel & reply)151 ErrCode BluetoothHfpHfStub::GetDevicesByStatesInner(MessageParcel &data, MessageParcel &reply) {
152 std::vector<BluetoothRawAddress> devices;
153 std::vector<int> states;
154 data.ReadInt32Vector(&states);
155 GetDevicesByStates(states, devices);
156 uint32_t devNum = devices.size();
157 if (!reply.WriteUint32(devNum)) {
158 HILOGE("BluetoothHfpHfStub:WriteInt32 failed in: %{public}s.", __func__);
159 return ERR_INVALID_VALUE;
160 }
161 for (uint32_t i = 0; i < devNum; i++) {
162 if (!reply.WriteParcelable(&devices[i])) {
163 HILOGE("BluetoothHfpHfStub:WriteParcelable failed in: %{public}s.", __func__);
164 return ERR_INVALID_VALUE;
165 }
166 }
167 return NO_ERROR;
168 }
169
GetDeviceStateInner(MessageParcel & data,MessageParcel & reply)170 ErrCode BluetoothHfpHfStub::GetDeviceStateInner(MessageParcel &data, MessageParcel &reply) {
171 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
172 if (!device) {
173 return TRANSACTION_ERR;
174 }
175 int result = GetDeviceState(*device);
176 if (!reply.WriteInt32(result)) {
177 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
178 return ERR_INVALID_VALUE;
179 }
180 return NO_ERROR;
181 }
182
GetScoStateInner(MessageParcel & data,MessageParcel & reply)183 ErrCode BluetoothHfpHfStub::GetScoStateInner(MessageParcel &data, MessageParcel &reply) {
184 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
185 if (!device) {
186 return TRANSACTION_ERR;
187 }
188 int result = GetScoState(*device);
189 if (!reply.WriteInt32(result)) {
190 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
191 return ERR_INVALID_VALUE;
192 }
193 return NO_ERROR;
194 }
195
SendDTMFToneInner(MessageParcel & data,MessageParcel & reply)196 ErrCode BluetoothHfpHfStub::SendDTMFToneInner(MessageParcel &data, MessageParcel &reply) {
197 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
198 if (!device) {
199 return TRANSACTION_ERR;
200 }
201 uint8_t code = data.ReadUint8();
202 int result = SendDTMFTone(*device, code);
203 if (!reply.WriteInt32(result)) {
204 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
205 return ERR_INVALID_VALUE;
206 }
207 return NO_ERROR;
208 }
209
ConnectInner(MessageParcel & data,MessageParcel & reply)210 ErrCode BluetoothHfpHfStub::ConnectInner(MessageParcel &data, MessageParcel &reply) {
211 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
212 if (!device) {
213 return TRANSACTION_ERR;
214 }
215 int result = Connect(*device);
216 if (!reply.WriteInt32(result)) {
217 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
218 return ERR_INVALID_VALUE;
219 }
220 return NO_ERROR;
221 }
222
DisconnectInner(MessageParcel & data,MessageParcel & reply)223 ErrCode BluetoothHfpHfStub::DisconnectInner(MessageParcel &data, MessageParcel &reply) {
224 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
225 if (!device) {
226 return TRANSACTION_ERR;
227 }
228 int result = Disconnect(*device);
229 if (!reply.WriteInt32(result)) {
230 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
231 return ERR_INVALID_VALUE;
232 }
233 return NO_ERROR;
234 }
235
OpenVoiceRecognitionInner(MessageParcel & data,MessageParcel & reply)236 ErrCode BluetoothHfpHfStub::OpenVoiceRecognitionInner(MessageParcel &data, MessageParcel &reply) {
237 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
238 if (!device) {
239 return TRANSACTION_ERR;
240 }
241 int result = OpenVoiceRecognition(*device);
242 if (!reply.WriteBool(result)) {
243 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
244 return ERR_INVALID_VALUE;
245 }
246 return NO_ERROR;
247 }
248
CloseVoiceRecognitionInner(MessageParcel & data,MessageParcel & reply)249 ErrCode BluetoothHfpHfStub::CloseVoiceRecognitionInner(MessageParcel &data, MessageParcel &reply) {
250 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
251 if (!device) {
252 return TRANSACTION_ERR;
253 }
254 int result = CloseVoiceRecognition(*device);
255 if (!reply.WriteBool(result)) {
256 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
257 return ERR_INVALID_VALUE;
258 }
259 return NO_ERROR;
260 }
261
GetCurrentCallListInner(MessageParcel & data,MessageParcel & reply)262 ErrCode BluetoothHfpHfStub::GetCurrentCallListInner(MessageParcel &data, MessageParcel &reply) {
263 std::vector<BluetoothHfpHfCall> calls;
264 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
265 if (!device) {
266 return TRANSACTION_ERR;
267 }
268 GetCurrentCallList(*device, calls);
269 uint32_t callNum = calls.size();
270 if (!reply.WriteUint32(callNum)) {
271 HILOGE("BluetoothHfpHfStub:WriteInt32 failed in: %{public}s.", __func__);
272 return ERR_INVALID_VALUE;
273 }
274 for (uint32_t i = 0; i < callNum; i++) {
275 if (!reply.WriteParcelable(&calls[i])) {
276 HILOGE("BluetoothHfpHfStub:WriteParcelable failed in: %{public}s.", __func__);
277 return ERR_INVALID_VALUE;
278 }
279 }
280 return NO_ERROR;
281 }
282
AcceptIncomingCallInner(MessageParcel & data,MessageParcel & reply)283 ErrCode BluetoothHfpHfStub::AcceptIncomingCallInner(MessageParcel &data, MessageParcel &reply) {
284 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
285 if (!device) {
286 return TRANSACTION_ERR;
287 }
288 int flag = data.ReadInt32();
289 int result = AcceptIncomingCall(*device, flag);
290 if (!reply.WriteBool(result)) {
291 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
292 return ERR_INVALID_VALUE;
293 }
294 return NO_ERROR;
295 }
296
HoldActiveCallInner(MessageParcel & data,MessageParcel & reply)297 ErrCode BluetoothHfpHfStub::HoldActiveCallInner(MessageParcel &data, MessageParcel &reply) {
298 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
299 if (!device) {
300 return TRANSACTION_ERR;
301 }
302 int result = HoldActiveCall(*device);
303 if (!reply.WriteBool(result)) {
304 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
305 return ERR_INVALID_VALUE;
306 }
307 return NO_ERROR;
308 }
309
SendKeyPressedInner(MessageParcel & data,MessageParcel & reply)310 ErrCode BluetoothHfpHfStub::SendKeyPressedInner(MessageParcel &data, MessageParcel &reply) {
311 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
312 if (!device) {
313 return TRANSACTION_ERR;
314 }
315 int result = SendKeyPressed(*device);
316 if (!reply.WriteBool(result)) {
317 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
318 return ERR_INVALID_VALUE;
319 }
320 return NO_ERROR;
321 }
322
RejectIncomingCallInner(MessageParcel & data,MessageParcel & reply)323 ErrCode BluetoothHfpHfStub::RejectIncomingCallInner(MessageParcel &data, MessageParcel &reply) {
324 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
325 if (!device) {
326 return TRANSACTION_ERR;
327 }
328 int result = RejectIncomingCall(*device);
329 if (!reply.WriteBool(result)) {
330 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
331 return ERR_INVALID_VALUE;
332 }
333 return NO_ERROR;
334 }
335
HandleIncomingCallInner(MessageParcel & data,MessageParcel & reply)336 ErrCode BluetoothHfpHfStub::HandleIncomingCallInner(MessageParcel &data, MessageParcel &reply)
337 {
338 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
339 if (!device) {
340 HILOGE("BluetoothHfpHfStub: device is not exist.");
341 return TRANSACTION_ERR;
342 }
343 int flag = data.ReadInt32();
344 int result = HandleIncomingCall(*device, flag);
345 if (!reply.WriteBool(result)) {
346 HILOGE("BluetoothHfpHfStub: reply writing failed.");
347 return ERR_INVALID_VALUE;
348 }
349 return NO_ERROR;
350 }
351
HandleMultiCallInner(MessageParcel & data,MessageParcel & reply)352 ErrCode BluetoothHfpHfStub::HandleMultiCallInner(MessageParcel &data, MessageParcel &reply)
353 {
354 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
355 if (!device) {
356 HILOGE("BluetoothHfpHfStub: device is not exist.");
357 return TRANSACTION_ERR;
358 }
359 int flag = data.ReadInt32();
360 int index = data.ReadInt32();
361 int result = HandleMultiCall(*device, flag, index);
362 if (!reply.WriteBool(result)) {
363 HILOGE("BluetoothHfpHfStub: reply writing failed.");
364 return ERR_INVALID_VALUE;
365 }
366 return NO_ERROR;
367 }
368
DialLastNumberInner(MessageParcel & data,MessageParcel & reply)369 ErrCode BluetoothHfpHfStub::DialLastNumberInner(MessageParcel &data, MessageParcel &reply)
370 {
371 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
372 if (!device) {
373 HILOGE("BluetoothHfpHfStub: device is not exist.");
374 return TRANSACTION_ERR;
375 }
376 int result = DialLastNumber(*device);
377 if (!reply.WriteBool(result)) {
378 HILOGE("BluetoothHfpHfStub: reply writing failed.");
379 return ERR_INVALID_VALUE;
380 }
381 return NO_ERROR;
382 }
383
DialMemoryInner(MessageParcel & data,MessageParcel & reply)384 ErrCode BluetoothHfpHfStub::DialMemoryInner(MessageParcel &data, MessageParcel &reply)
385 {
386 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
387 if (!device) {
388 HILOGE("BluetoothHfpHfStub: device is not exist.");
389 return TRANSACTION_ERR;
390 }
391 int index = data.ReadInt32();
392 HILOGE("BluetoothHfpHfStub: reply writing failed. index = %{publilc}d", index);
393 int result = DialMemory(*device, index);
394 if (!reply.WriteBool(result)) {
395 HILOGE("BluetoothHfpHfStub: reply writing failed.");
396 return ERR_INVALID_VALUE;
397 }
398 return NO_ERROR;
399 }
400
SendVoiceTagInner(MessageParcel & data,MessageParcel & reply)401 ErrCode BluetoothHfpHfStub::SendVoiceTagInner(MessageParcel &data, MessageParcel &reply)
402 {
403 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
404 if (!device) {
405 return TRANSACTION_ERR;
406 }
407 int index = data.ReadInt32();
408 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s. index = %{publilc}d", __func__, index);
409 int result = SendVoiceTag(*device, index);
410 if (!reply.WriteBool(result)) {
411 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
412 return ERR_INVALID_VALUE;
413 }
414 return NO_ERROR;
415 }
416
417
FinishActiveCallInner(MessageParcel & data,MessageParcel & reply)418 ErrCode BluetoothHfpHfStub::FinishActiveCallInner(MessageParcel &data, MessageParcel &reply) {
419 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
420 if (!device) {
421 return TRANSACTION_ERR;
422 }
423 std::shared_ptr<BluetoothHfpHfCall> call(data.ReadParcelable<BluetoothHfpHfCall>());
424 if (!call) {
425 return TRANSACTION_ERR;
426 }
427 int result = FinishActiveCall(*device, *call);
428 if (!reply.WriteBool(result)) {
429 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
430 return ERR_INVALID_VALUE;
431 }
432 return NO_ERROR;
433 }
434
StartDialInner(MessageParcel & data,MessageParcel & reply)435 ErrCode BluetoothHfpHfStub::StartDialInner(MessageParcel &data, MessageParcel &reply) {
436 std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
437 if (!device) {
438 return TRANSACTION_ERR;
439 }
440 std::string number = data.ReadString();
441 std::shared_ptr<BluetoothHfpHfCall> call(data.ReadParcelable<BluetoothHfpHfCall>());
442 if (!call) {
443 return TRANSACTION_ERR;
444 }
445 int result = StartDial(*device, number, *call);
446 if (!reply.WriteInt32(result)) {
447 HILOGE("BluetoothHfpHfStub: reply writing failed in: %{public}s.", __func__);
448 return ERR_INVALID_VALUE;
449 }
450 return NO_ERROR;
451 }
452
RegisterObserverInner(MessageParcel & data,MessageParcel & reply)453 ErrCode BluetoothHfpHfStub::RegisterObserverInner(MessageParcel &data, MessageParcel &reply) {
454 sptr<IRemoteObject> tempObject = data.ReadRemoteObject();
455 sptr<IBluetoothHfpHfObserver> observer = iface_cast<IBluetoothHfpHfObserver>(tempObject);
456 RegisterObserver(observer);
457 return NO_ERROR;
458 }
459
DeregisterObserverInner(MessageParcel & data,MessageParcel & reply)460 ErrCode BluetoothHfpHfStub::DeregisterObserverInner(MessageParcel &data, MessageParcel &reply) {
461 sptr<IRemoteObject> tempObject = data.ReadRemoteObject();
462 sptr<IBluetoothHfpHfObserver> observer = iface_cast<IBluetoothHfpHfObserver>(tempObject);
463 DeregisterObserver(observer);
464 return NO_ERROR;
465 }
466
467 } // namespace Bluetooth
468 } // namespace OHOS
469