1 /******************************************************************************
2 *
3 * Copyright 2004-2012 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19 /******************************************************************************
20 *
21 * This file contains the pan action functions for the state machine.
22 *
23 ******************************************************************************/
24
25 #define LOG_TAG "bluetooth"
26
27 #include <bluetooth/log.h>
28
29 #include <cstdint>
30
31 #include "bta/include/bta_pan_co.h"
32 #include "bta/pan/bta_pan_int.h"
33 #include "internal_include/bt_target.h" // PAN_INCLUDED
34 #include "osi/include/allocator.h"
35 #include "osi/include/fixed_queue.h"
36 #include "stack/include/bt_hdr.h"
37 #include "stack/include/bt_uuid16.h"
38 #include "stack/include/pan_api.h"
39 #include "types/raw_address.h"
40
41 using namespace bluetooth;
42
43 #if (PAN_INCLUDED == TRUE)
44 void bta_pan_sm_execute(tBTA_PAN_SCB* p_scb, uint16_t event,
45 tBTA_PAN_DATA* p_data);
46
47 /* RX and TX data flow mask */
48 #define BTA_PAN_RX_MASK 0x0F
49 #define BTA_PAN_TX_MASK 0xF0
50
51 /*******************************************************************************
52 *
53 * Function bta_pan_pm_conn_busy
54 *
55 * Description set pan pm connection busy state
56 *
57 * Params p_scb: state machine control block of pan connection
58 *
59 * Returns void
60 *
61 ******************************************************************************/
bta_pan_pm_conn_busy(tBTA_PAN_SCB * p_scb)62 static void bta_pan_pm_conn_busy(tBTA_PAN_SCB* p_scb) {
63 if ((p_scb != NULL) && (p_scb->state != BTA_PAN_IDLE_ST))
64 bta_sys_busy(BTA_ID_PAN, p_scb->app_id, p_scb->bd_addr);
65 }
66
67 /*******************************************************************************
68 *
69 * Function bta_pan_pm_conn_idle
70 *
71 * Description set pan pm connection idle state
72 *
73 * Params p_scb: state machine control block of pan connection
74 *
75 * Returns void
76 *
77 ******************************************************************************/
bta_pan_pm_conn_idle(tBTA_PAN_SCB * p_scb)78 static void bta_pan_pm_conn_idle(tBTA_PAN_SCB* p_scb) {
79 if ((p_scb != NULL) && (p_scb->state != BTA_PAN_IDLE_ST))
80 bta_sys_idle(BTA_ID_PAN, p_scb->app_id, p_scb->bd_addr);
81 }
82
83 /*******************************************************************************
84 *
85 * Function bta_pan_conn_state_cback
86 *
87 * Description Connection state callback from Pan profile
88 *
89 *
90 * Returns void
91 *
92 ******************************************************************************/
bta_pan_conn_state_cback(uint16_t handle,const RawAddress & bd_addr,tPAN_RESULT state,bool is_role_change,uint8_t src_role,uint8_t dst_role)93 static void bta_pan_conn_state_cback(uint16_t handle, const RawAddress& bd_addr,
94 tPAN_RESULT state, bool is_role_change,
95 uint8_t src_role, uint8_t dst_role) {
96 tBTA_PAN_SCB* p_scb;
97 tBTA_PAN_CONN* p_buf = (tBTA_PAN_CONN*)osi_malloc(sizeof(tBTA_PAN_CONN));
98
99 if ((state == PAN_SUCCESS) && !is_role_change) {
100 p_buf->hdr.event = BTA_PAN_CONN_OPEN_EVT;
101 p_scb = bta_pan_scb_by_handle(handle);
102 if (p_scb == NULL) {
103 /* allocate an scb */
104 p_scb = bta_pan_scb_alloc();
105 }
106 /* we have exceeded maximum number of connections */
107 if (!p_scb) {
108 PAN_Disconnect(handle);
109 return;
110 }
111
112 p_scb->handle = handle;
113 p_scb->local_role = src_role;
114 p_scb->peer_role = dst_role;
115 p_scb->pan_flow_enable = true;
116 p_scb->bd_addr = bd_addr;
117 p_scb->data_queue = fixed_queue_new(SIZE_MAX);
118
119 if (src_role == PAN_ROLE_CLIENT)
120 p_scb->app_id = bta_pan_cb.app_id[0];
121 else if (src_role == PAN_ROLE_NAP_SERVER)
122 p_scb->app_id = bta_pan_cb.app_id[2];
123 } else if ((state != PAN_SUCCESS) && !is_role_change) {
124 p_buf->hdr.event = BTA_PAN_CONN_CLOSE_EVT;
125 } else {
126 return;
127 }
128
129 p_buf->result = state;
130 p_buf->hdr.layer_specific = handle;
131
132 bta_sys_sendmsg(p_buf);
133 }
134
135 /*******************************************************************************
136 *
137 * Function bta_pan_data_flow_cb
138 *
139 * Description Data flow status callback from PAN
140 *
141 *
142 * Returns void
143 *
144 ******************************************************************************/
bta_pan_data_flow_cb(uint16_t handle,tPAN_RESULT result)145 static void bta_pan_data_flow_cb(uint16_t handle, tPAN_RESULT result) {
146 tBTA_PAN_SCB* p_scb;
147
148 p_scb = bta_pan_scb_by_handle(handle);
149 if (p_scb == NULL) return;
150
151 if (result == PAN_TX_FLOW_ON) {
152 BT_HDR_RIGID* p_buf = (BT_HDR_RIGID*)osi_malloc(sizeof(BT_HDR_RIGID));
153 p_buf->layer_specific = handle;
154 p_buf->event = BTA_PAN_BNEP_FLOW_ENABLE_EVT;
155 bta_sys_sendmsg(p_buf);
156 bta_pan_co_rx_flow(handle, p_scb->app_id, true);
157 } else if (result == PAN_TX_FLOW_OFF) {
158 p_scb->pan_flow_enable = false;
159 bta_pan_co_rx_flow(handle, p_scb->app_id, false);
160 }
161 }
162
163 /*******************************************************************************
164 *
165 * Function bta_pan_data_buf_ind_cback
166 *
167 * Description data indication callback from pan profile
168 *
169 *
170 * Returns void
171 *
172 ******************************************************************************/
bta_pan_data_buf_ind_cback(uint16_t handle,const RawAddress & src,const RawAddress & dst,uint16_t protocol,BT_HDR * p_buf,bool ext,bool forward)173 static void bta_pan_data_buf_ind_cback(uint16_t handle, const RawAddress& src,
174 const RawAddress& dst, uint16_t protocol,
175 BT_HDR* p_buf, bool ext, bool forward) {
176 tBTA_PAN_SCB* p_scb = bta_pan_scb_by_handle(handle);
177 if (p_scb == NULL) {
178 return;
179 }
180
181 if (sizeof(BT_HDR) + sizeof(tBTA_PAN_DATA_PARAMS) + p_buf->len >
182 PAN_BUF_SIZE) {
183 log::error("received buffer length too large: {}", p_buf->len);
184 return;
185 }
186
187 BT_HDR* p_new_buf = (BT_HDR*)osi_malloc(PAN_BUF_SIZE);
188 memcpy((uint8_t*)(p_new_buf + 1) + sizeof(tBTA_PAN_DATA_PARAMS),
189 (uint8_t*)(p_buf + 1) + p_buf->offset, p_buf->len);
190 p_new_buf->len = p_buf->len;
191 p_new_buf->offset = sizeof(tBTA_PAN_DATA_PARAMS);
192
193 /* copy params into the space before the data */
194 ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->src = src;
195 ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->dst = dst;
196 ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->protocol = protocol;
197 ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->ext = ext;
198 ((tBTA_PAN_DATA_PARAMS*)p_new_buf)->forward = forward;
199
200 fixed_queue_enqueue(p_scb->data_queue, p_new_buf);
201 BT_HDR_RIGID* p_event = (BT_HDR_RIGID*)osi_malloc(sizeof(BT_HDR_RIGID));
202 p_event->layer_specific = handle;
203 p_event->event = BTA_PAN_RX_FROM_BNEP_READY_EVT;
204 bta_sys_sendmsg(p_event);
205 }
206
207 /*******************************************************************************
208 *
209 * Function bta_pan_pfilt_ind_cback
210 *
211 * Description
212 *
213 *
214 * Returns void
215 *
216 ******************************************************************************/
bta_pan_pfilt_ind_cback(uint16_t handle,bool indication,tPAN_RESULT result,uint16_t num_filters,uint8_t * p_filters)217 static void bta_pan_pfilt_ind_cback(uint16_t handle, bool indication,
218 tPAN_RESULT result, uint16_t num_filters,
219 uint8_t* p_filters) {
220 bta_pan_co_pfilt_ind(handle, indication,
221 (result == PAN_SUCCESS) ? BTA_PAN_SUCCESS : BTA_PAN_FAIL,
222 num_filters, p_filters);
223 }
224
225 /*******************************************************************************
226 *
227 * Function bta_pan_mfilt_ind_cback
228 *
229 * Description
230 *
231 *
232 * Returns void
233 *
234 ******************************************************************************/
bta_pan_mfilt_ind_cback(uint16_t handle,bool indication,tPAN_RESULT result,uint16_t num_mfilters,uint8_t * p_mfilters)235 static void bta_pan_mfilt_ind_cback(uint16_t handle, bool indication,
236 tPAN_RESULT result, uint16_t num_mfilters,
237 uint8_t* p_mfilters) {
238 bta_pan_co_mfilt_ind(handle, indication,
239 (result == PAN_SUCCESS) ? BTA_PAN_SUCCESS : BTA_PAN_FAIL,
240 num_mfilters, p_mfilters);
241 }
242
243 /*******************************************************************************
244 *
245 * Function bta_pan_has_multiple_connections
246 *
247 * Description Check whether there are multiple GN/NAP connections to
248 * different devices
249 *
250 *
251 * Returns bool
252 *
253 ******************************************************************************/
bta_pan_has_multiple_connections(uint8_t app_id)254 static bool bta_pan_has_multiple_connections(uint8_t app_id) {
255 tBTA_PAN_SCB* p_scb = NULL;
256 bool found = false;
257 RawAddress bd_addr;
258
259 for (uint8_t index = 0; index < BTA_PAN_NUM_CONN; index++) {
260 p_scb = &bta_pan_cb.scb[index];
261 if (p_scb->in_use && app_id == p_scb->app_id) {
262 /* save temp bd_addr */
263 bd_addr = p_scb->bd_addr;
264 found = true;
265 break;
266 }
267 }
268
269 /* If cannot find a match then there is no connection at all */
270 if (!found) return false;
271
272 /* Find whether there is another connection with different device other than
273 PANU.
274 Could be same service or different service */
275 for (uint8_t index = 0; index < BTA_PAN_NUM_CONN; index++) {
276 p_scb = &bta_pan_cb.scb[index];
277 if (p_scb->in_use && p_scb->app_id != bta_pan_cb.app_id[0] &&
278 bd_addr != p_scb->bd_addr) {
279 return true;
280 }
281 }
282 return false;
283 }
284
285 /*******************************************************************************
286 *
287 * Function bta_pan_enable
288 *
289 * Description
290 *
291 *
292 *
293 * Returns void
294 *
295 ******************************************************************************/
bta_pan_enable(tBTA_PAN_DATA * p_data)296 void bta_pan_enable(tBTA_PAN_DATA* p_data) {
297 tPAN_REGISTER reg_data;
298
299 bta_pan_cb.p_cback = p_data->api_enable.p_cback;
300
301 reg_data.pan_conn_state_cb = bta_pan_conn_state_cback;
302 reg_data.pan_bridge_req_cb = NULL;
303 reg_data.pan_data_buf_ind_cb = bta_pan_data_buf_ind_cback;
304 reg_data.pan_data_ind_cb = NULL;
305 reg_data.pan_pfilt_ind_cb = bta_pan_pfilt_ind_cback;
306 reg_data.pan_mfilt_ind_cb = bta_pan_mfilt_ind_cback;
307 reg_data.pan_tx_data_flow_cb = bta_pan_data_flow_cb;
308
309 PAN_Register(®_data);
310
311 bta_pan_cb.flow_mask = bta_pan_co_init(&bta_pan_cb.q_level);
312 bta_pan_cb.p_cback(BTA_PAN_ENABLE_EVT, NULL);
313 }
314
315 /*******************************************************************************
316 *
317 * Function bta_pan_set_role
318 *
319 * Description
320 *
321 * Returns void
322 *
323 ******************************************************************************/
bta_pan_set_role(tBTA_PAN_DATA * p_data)324 void bta_pan_set_role(tBTA_PAN_DATA* p_data) {
325 bta_pan_cb.app_id[0] = p_data->api_set_role.user_app_id;
326 bta_pan_cb.app_id[2] = p_data->api_set_role.nap_app_id;
327
328 /* set security correctly in api and here */
329 tPAN_RESULT status = PAN_SetRole(p_data->api_set_role.role,
330 std::string(p_data->api_set_role.user_name),
331 std::string(p_data->api_set_role.nap_name));
332
333 tBTA_PAN bta_pan = {
334 .set_role =
335 {
336 .status =
337 (status == PAN_SUCCESS) ? BTA_PAN_SUCCESS : BTA_PAN_FAIL,
338 .role = p_data->api_set_role.role,
339 },
340 };
341
342 if (status == PAN_SUCCESS) {
343 if (p_data->api_set_role.role & PAN_ROLE_NAP_SERVER)
344 bta_sys_add_uuid(UUID_SERVCLASS_NAP);
345 else
346 bta_sys_remove_uuid(UUID_SERVCLASS_NAP);
347
348 if (p_data->api_set_role.role & PAN_ROLE_CLIENT)
349 bta_sys_add_uuid(UUID_SERVCLASS_PANU);
350 else
351 bta_sys_remove_uuid(UUID_SERVCLASS_PANU);
352 }
353 /* if status is not success clear everything */
354 else {
355 PAN_SetRole(0, std::string(), std::string());
356 bta_sys_remove_uuid(UUID_SERVCLASS_NAP);
357 bta_sys_remove_uuid(UUID_SERVCLASS_GN);
358 bta_sys_remove_uuid(UUID_SERVCLASS_PANU);
359 }
360 bta_pan_cb.p_cback(BTA_PAN_SET_ROLE_EVT, &bta_pan);
361 }
362
363 /*******************************************************************************
364 *
365 * Function bta_pan_disable
366 *
367 * Description
368 *
369 *
370 *
371 * Returns void
372 *
373 ******************************************************************************/
bta_pan_disable(void)374 void bta_pan_disable(void) {
375 BT_HDR* p_buf;
376 tBTA_PAN_SCB* p_scb = &bta_pan_cb.scb[0];
377 uint8_t i;
378
379 /* close all connections */
380 PAN_SetRole(0, std::string(), std::string());
381
382 bta_sys_remove_uuid(UUID_SERVCLASS_NAP);
383 bta_sys_remove_uuid(UUID_SERVCLASS_GN);
384 bta_sys_remove_uuid(UUID_SERVCLASS_PANU);
385 /* free all queued up data buffers */
386 for (i = 0; i < BTA_PAN_NUM_CONN; i++, p_scb++) {
387 if (p_scb->in_use) {
388 while ((p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_scb->data_queue)) !=
389 NULL)
390 osi_free(p_buf);
391
392 bta_pan_co_close(p_scb->handle, p_scb->app_id);
393 }
394 }
395
396 PAN_Deregister();
397 }
398
399 /*******************************************************************************
400 *
401 * Function bta_pan_open
402 *
403 * Description
404 *
405 * Returns void
406 *
407 ******************************************************************************/
bta_pan_open(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA * p_data)408 void bta_pan_open(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* p_data) {
409 tPAN_RESULT status;
410 tBTA_PAN bta_pan;
411
412 status = PAN_Connect(p_data->api_open.bd_addr, p_data->api_open.local_role,
413 p_data->api_open.peer_role, &p_scb->handle);
414 log::verbose("pan connect status: {}", status);
415
416 if (status == PAN_SUCCESS) {
417 p_scb->bd_addr = p_data->api_open.bd_addr;
418 p_scb->local_role = p_data->api_open.local_role;
419 p_scb->peer_role = p_data->api_open.peer_role;
420 bta_pan.opening.bd_addr = p_data->api_open.bd_addr;
421 bta_pan.opening.handle = p_scb->handle;
422 bta_pan_cb.p_cback(BTA_PAN_OPENING_EVT, &bta_pan);
423
424 } else {
425 bta_pan_scb_dealloc(p_scb);
426 bta_pan.open.bd_addr = p_data->api_open.bd_addr;
427 bta_pan.open.status = BTA_PAN_FAIL;
428 bta_pan.open.local_role = p_data->api_open.local_role;
429 bta_pan.open.peer_role = p_data->api_open.peer_role;
430 bta_pan_cb.p_cback(BTA_PAN_OPEN_EVT, &bta_pan);
431 }
432 }
433
434 /*******************************************************************************
435 *
436 * Function bta_pan_close
437 *
438 * Description
439 *
440 *
441 *
442 * Returns void
443 *
444 ******************************************************************************/
bta_pan_api_close(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA *)445 void bta_pan_api_close(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* /* p_data */) {
446 tBTA_PAN_CONN* p_buf = (tBTA_PAN_CONN*)osi_malloc(sizeof(tBTA_PAN_CONN));
447
448 PAN_Disconnect(p_scb->handle);
449
450 /*
451 * Send an event to BTA so that application will get the connection
452 * close event.
453 */
454 p_buf->hdr.event = BTA_PAN_CONN_CLOSE_EVT;
455 p_buf->hdr.layer_specific = p_scb->handle;
456
457 bta_sys_sendmsg(p_buf);
458 }
459
460 /*******************************************************************************
461 *
462 * Function bta_pan_conn_open
463 *
464 * Description process connection open event
465 *
466 * Returns void
467 *
468 ******************************************************************************/
bta_pan_conn_open(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA * p_data)469 void bta_pan_conn_open(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* p_data) {
470 tBTA_PAN bta_pan;
471
472 log::verbose("pan connection result: {}", p_data->conn.result);
473
474 bta_pan.open.bd_addr = p_scb->bd_addr;
475 bta_pan.open.handle = p_scb->handle;
476 bta_pan.open.local_role = p_scb->local_role;
477 bta_pan.open.peer_role = p_scb->peer_role;
478
479 if (p_data->conn.result == PAN_SUCCESS) {
480 bta_pan.open.status = BTA_PAN_SUCCESS;
481 p_scb->pan_flow_enable = true;
482 p_scb->app_flow_enable = true;
483 bta_sys_conn_open(BTA_ID_PAN, p_scb->app_id, p_scb->bd_addr);
484 } else {
485 bta_pan_scb_dealloc(p_scb);
486 bta_pan.open.status = BTA_PAN_FAIL;
487 }
488
489 p_scb->pan_flow_enable = true;
490 p_scb->app_flow_enable = true;
491
492 /* If app_id is NAP/GN, check whether there are multiple connections.
493 If there are, provide a special app_id to dm to enforce central role only.
494 */
495 if (p_scb->app_id == bta_pan_cb.app_id[2] &&
496 bta_pan_has_multiple_connections(p_scb->app_id)) {
497 p_scb->app_id = BTA_APP_ID_PAN_MULTI;
498 }
499
500 bta_sys_conn_open(BTA_ID_PAN, p_scb->app_id, p_scb->bd_addr);
501 bta_pan_cb.p_cback(BTA_PAN_OPEN_EVT, &bta_pan);
502 }
503
504 /*******************************************************************************
505 *
506 * Function bta_pan_conn_close
507 *
508 * Description process connection close event
509 *
510 *
511 *
512 * Returns void
513 *
514 ******************************************************************************/
bta_pan_conn_close(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA * p_data)515 void bta_pan_conn_close(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* p_data) {
516 tBTA_PAN bta_pan;
517 BT_HDR* p_buf;
518
519 bta_pan.close.handle = p_data->hdr.layer_specific;
520
521 bta_sys_conn_close(BTA_ID_PAN, p_scb->app_id, p_scb->bd_addr);
522
523 /* free all queued up data buffers */
524 while ((p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_scb->data_queue)) != NULL)
525 osi_free(p_buf);
526
527 bta_pan_scb_dealloc(p_scb);
528
529 bta_pan_cb.p_cback(BTA_PAN_CLOSE_EVT, &bta_pan);
530 }
531
532 /*******************************************************************************
533 *
534 * Function bta_pan_rx_path
535 *
536 * Description Handle data on the RX path (data sent from the phone to
537 * BTA).
538 *
539 *
540 * Returns void
541 *
542 ******************************************************************************/
bta_pan_rx_path(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA *)543 void bta_pan_rx_path(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* /* p_data */) {
544 /* if data path configured for rx pull */
545 if ((bta_pan_cb.flow_mask & BTA_PAN_RX_MASK) == BTA_PAN_RX_PULL) {
546 /* if we can accept data */
547 if (p_scb->pan_flow_enable) {
548 /* call application callout function for rx path */
549 bta_pan_co_rx_path(p_scb->handle, p_scb->app_id);
550 }
551 }
552 /* else data path configured for rx push */
553 else {
554 }
555 }
556
557 /*******************************************************************************
558 *
559 * Function bta_pan_tx_path
560 *
561 * Description Handle the TX data path (data sent from BTA to the phone).
562 *
563 *
564 * Returns void
565 *
566 ******************************************************************************/
bta_pan_tx_path(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA *)567 void bta_pan_tx_path(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* /* p_data */) {
568 bta_pan_pm_conn_busy(p_scb);
569 /* call application callout function for tx path */
570 bta_pan_co_tx_path(p_scb->handle, p_scb->app_id);
571
572 /* free data that exceeds queue level */
573 while (fixed_queue_length(p_scb->data_queue) > bta_pan_cb.q_level) {
574 BT_HDR* p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_scb->data_queue);
575 if (p_buf != nullptr) {
576 osi_free(p_buf);
577 }
578 }
579
580 bta_pan_pm_conn_idle(p_scb);
581 }
582
583 /*******************************************************************************
584 *
585 * Function bta_pan_tx_flow
586 *
587 * Description Set the application flow control state.
588 *
589 *
590 * Returns void
591 *
592 ******************************************************************************/
bta_pan_tx_flow(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA * p_data)593 void bta_pan_tx_flow(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* p_data) {
594 p_scb->app_flow_enable = p_data->ci_tx_flow.enable;
595 }
596
597 /*******************************************************************************
598 *
599 * Function bta_pan_write_buf
600 *
601 * Description Handle a bta_pan_ci_rx_writebuf() and send data to PAN.
602 *
603 *
604 * Returns void
605 *
606 ******************************************************************************/
bta_pan_write_buf(tBTA_PAN_SCB * p_scb,tBTA_PAN_DATA * p_data)607 void bta_pan_write_buf(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* p_data) {
608 if ((bta_pan_cb.flow_mask & BTA_PAN_RX_MASK) == BTA_PAN_RX_PUSH_BUF) {
609 bta_pan_pm_conn_busy(p_scb);
610
611 PAN_WriteBuf(p_scb->handle, ((tBTA_PAN_DATA_PARAMS*)p_data)->dst,
612 ((tBTA_PAN_DATA_PARAMS*)p_data)->src,
613 ((tBTA_PAN_DATA_PARAMS*)p_data)->protocol, (BT_HDR*)p_data,
614 ((tBTA_PAN_DATA_PARAMS*)p_data)->ext);
615 bta_pan_pm_conn_idle(p_scb);
616 }
617 }
618
619 /*******************************************************************************
620 *
621 * Function bta_pan_free_buf
622 *
623 * Description Frees the data buffer during closing state
624 *
625 *
626 * Returns void
627 *
628 ******************************************************************************/
bta_pan_free_buf(tBTA_PAN_SCB *,tBTA_PAN_DATA * p_data)629 void bta_pan_free_buf(tBTA_PAN_SCB* /* p_scb */, tBTA_PAN_DATA* p_data) {
630 osi_free(p_data);
631 }
632
633 #endif /* PAN_INCLUDED */
634