15738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/****************************************************************************** 25738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 35738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * Copyright (C) 2004-2012 Broadcom Corporation 45738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 55738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 65738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * you may not use this file except in compliance with the License. 75738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * You may obtain a copy of the License at: 85738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 95738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * Unless required by applicable law or agreed to in writing, software 125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * See the License for the specific language governing permissions and 155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * limitations under the License. 165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/ 185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/****************************************************************************** 205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * This file contains the pan action functions for the state machine. 225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project * 235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/ 245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bt_target.h" 265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#if defined(PAN_INCLUDED) && (PAN_INCLUDED == TRUE) 285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bta_api.h" 305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bta_sys.h" 315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bd.h" 325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "gki.h" 335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "pan_api.h" 345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bta_pan_api.h" 355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bta_pan_int.h" 365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bta_pan_co.h" 375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include <string.h> 385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* RX and TX data flow mask */ 415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define BTA_PAN_RX_MASK 0x0F 425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define BTA_PAN_TX_MASK 0xF0 435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_conn_state_cback 475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description Connection state callback from Pan profile 495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectstatic void bta_pan_conn_state_cback(UINT16 handle, BD_ADDR bd_addr, tPAN_RESULT state, 555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BOOLEAN is_role_change, UINT8 src_role, UINT8 dst_role) 565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_CONN * p_buf; 595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_SCB *p_scb; 605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((p_buf = (tBTA_PAN_CONN *) GKI_getbuf(sizeof(tBTA_PAN_CONN))) != NULL) 635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if((state == PAN_SUCCESS) && !is_role_change) 655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->hdr.event = BTA_PAN_CONN_OPEN_EVT; 675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if((p_scb = bta_pan_scb_by_handle(handle)) == NULL) 685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* allocate an scb */ 705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb = bta_pan_scb_alloc(); 715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* we have exceeded maximum number of connections */ 745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(!p_scb) 755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project PAN_Disconnect (handle); 775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project return; 785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->handle = handle; 815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->local_role = src_role; 825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->peer_role = dst_role; 835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->pan_flow_enable = TRUE; 845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bdcpy(p_scb->bd_addr, bd_addr); 855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_init_q(&p_scb->data_queue); 865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(src_role == PAN_ROLE_CLIENT) 885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->app_id = bta_pan_cb.app_id[0]; 895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else if (src_role == PAN_ROLE_GN_SERVER) 905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->app_id = bta_pan_cb.app_id[1]; 915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else if (src_role == PAN_ROLE_NAP_SERVER) 925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->app_id = bta_pan_cb.app_id[2]; 935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else if((state != PAN_SUCCESS) && !is_role_change) 965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->hdr.event = BTA_PAN_CONN_CLOSE_EVT; 985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 1015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project return; 1035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->result = state; 1065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->hdr.layer_specific = handle; 1075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_sendmsg(p_buf); 1085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 1145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 1165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_data_flow_cb 1185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description Data flow status callback from PAN 1205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 1235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 1255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectstatic void bta_pan_data_flow_cb(UINT16 handle, tPAN_RESULT result) 1265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 1275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BT_HDR *p_buf; 1285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_SCB *p_scb; 1295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if((p_scb = bta_pan_scb_by_handle(handle)) == NULL) 1315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project return; 1325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(result == PAN_TX_FLOW_ON) 1345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) 1365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->layer_specific = handle; 1385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->event = BTA_PAN_BNEP_FLOW_ENABLE_EVT; 1395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_sendmsg(p_buf); 1405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_rx_flow(handle, p_scb->app_id, TRUE); 1425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else if(result == PAN_TX_FLOW_OFF) 1455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->pan_flow_enable = FALSE; 1485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_rx_flow(handle, p_scb->app_id, FALSE); 1495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 1545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 1575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_data_buf_ind_cback 1595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description data indication callback from pan profile 1615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 1645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 1655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 1665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectstatic void bta_pan_data_buf_ind_cback(UINT16 handle, BD_ADDR src, BD_ADDR dst, UINT16 protocol, BT_HDR *p_buf, 1675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BOOLEAN ext, BOOLEAN forward) 1685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 1695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_SCB *p_scb; 1705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BT_HDR * p_event; 1715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BT_HDR *p_new_buf; 1725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 1735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ( sizeof(tBTA_PAN_DATA_PARAMS) > p_buf->offset ) 1745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* offset smaller than data structure in front of actual data */ 1765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_new_buf = (BT_HDR *)GKI_getpoolbuf( PAN_POOL_ID ); 1775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(!p_new_buf) 1785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project APPL_TRACE_WARNING0("Cannot get a PAN GKI buffer"); 1805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf( p_buf ); 1815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project return; 1825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 1845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project memcpy( (UINT8 *)(p_new_buf+1)+sizeof(tBTA_PAN_DATA_PARAMS), (UINT8 *)(p_buf+1)+p_buf->offset, p_buf->len ); 1865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_new_buf->len = p_buf->len; 1875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_new_buf->offset = sizeof(tBTA_PAN_DATA_PARAMS); 1885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf( p_buf ); 1895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 1925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 1935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_new_buf = p_buf; 1945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 1955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* copy params into the space before the data */ 1965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bdcpy(((tBTA_PAN_DATA_PARAMS *)p_new_buf)->src, src); 1975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bdcpy(((tBTA_PAN_DATA_PARAMS *)p_new_buf)->dst, dst); 1985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_new_buf)->protocol = protocol; 1995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_new_buf)->ext = ext; 2005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_new_buf)->forward = forward; 2015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if((p_scb = bta_pan_scb_by_handle(handle)) == NULL) 2045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 2055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf( p_new_buf ); 2075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project return; 2085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 2095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_enqueue(&p_scb->data_queue, p_new_buf); 2115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((p_event = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) 2125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 2135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_event->layer_specific = handle; 2145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_event->event = BTA_PAN_RX_FROM_BNEP_READY_EVT; 2155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_sendmsg(p_event); 2165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 2175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 2195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 2225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_pfilt_ind_cback 2245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description 2265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 2295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 2315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectstatic void bta_pan_pfilt_ind_cback(UINT16 handle, BOOLEAN indication,tBNEP_RESULT result, 2325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 num_filters, UINT8 *p_filters) 2335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 2345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_pfilt_ind(handle, indication, (tBTA_PAN_STATUS)((result == BNEP_SUCCESS) ? BTA_PAN_SUCCESS : BTA_PAN_FAIL), 2365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project num_filters, p_filters); 2375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 2405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 2435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_mfilt_ind_cback 2455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description 2475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 2505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 2525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectstatic void bta_pan_mfilt_ind_cback(UINT16 handle, BOOLEAN indication,tBNEP_RESULT result, 2535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 num_mfilters, UINT8 *p_mfilters) 2545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 2555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_mfilt_ind(handle, indication, (tBTA_PAN_STATUS)((result == BNEP_SUCCESS) ? BTA_PAN_SUCCESS : BTA_PAN_FAIL), 2575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project num_mfilters, p_mfilters); 2585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 2595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 2635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_enable 2655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description 2675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 2715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 2725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 2735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_enable(tBTA_PAN_DATA *p_data) 2745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 2755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tPAN_REGISTER reg_data; 2765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 initial_discoverability; 2775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 initial_connectability; 2785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 d_window; 2795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 d_interval; 2805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 c_window; 2815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT16 c_interval; 2825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.p_cback = p_data->api_enable.p_cback; 2845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project reg_data.pan_conn_state_cb = bta_pan_conn_state_cback; 2865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project reg_data.pan_bridge_req_cb = NULL; 2875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project reg_data.pan_data_buf_ind_cb = bta_pan_data_buf_ind_cback; 2885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project reg_data.pan_data_ind_cb = NULL; 2895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project reg_data.pan_pfilt_ind_cb = bta_pan_pfilt_ind_cback; 2905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project reg_data.pan_mfilt_ind_cb = bta_pan_mfilt_ind_cback; 2915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project reg_data.pan_tx_data_flow_cb = bta_pan_data_flow_cb; 2925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* read connectability and discoverability settings. 2945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project Pan profile changes the settings. We have to change it back to 2955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project be consistent with other bta subsystems */ 2965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project initial_connectability = BTM_ReadConnectability(&c_window, &c_interval); 2975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project initial_discoverability = BTM_ReadDiscoverability(&d_window, &d_interval); 2985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 2995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project PAN_Register (®_data); 3015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* set it back to original value */ 3045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BTM_SetDiscoverability(initial_discoverability, d_window, d_interval); 3055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BTM_SetConnectability(initial_connectability, c_window, c_interval); 3065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.flow_mask = bta_pan_co_init(&bta_pan_cb.q_level); 3085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.p_cback(BTA_PAN_ENABLE_EVT, NULL); 3095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 3115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 3135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_set_role 3155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description 3175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 3195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 3215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_set_role(tBTA_PAN_DATA *p_data) 3225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 3235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tPAN_RESULT status; 3245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_SET_ROLE set_role; 3255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT8 sec[3]; 3265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.app_id[0] = p_data->api_set_role.user_app_id; 3295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.app_id[1] = p_data->api_set_role.gn_app_id; 3305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.app_id[2] = p_data->api_set_role.nap_app_id; 3315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project sec[0] = p_data->api_set_role.user_sec_mask; 3335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project sec[1] = p_data->api_set_role.gn_sec_mask; 3345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project sec[2] = p_data->api_set_role.nap_sec_mask; 3355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* set security correctly in api and here */ 3375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project status = PAN_SetRole(p_data->api_set_role.role, sec, 3385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_data->api_set_role.user_name, 3395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_data->api_set_role.gn_name, 3405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_data->api_set_role.nap_name); 3415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project set_role.role = p_data->api_set_role.role; 3435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(status == PAN_SUCCESS) 3445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 3455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(p_data->api_set_role.role & PAN_ROLE_NAP_SERVER ) 3465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_add_uuid(UUID_SERVCLASS_NAP); 3475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 3485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_NAP); 3495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(p_data->api_set_role.role & PAN_ROLE_GN_SERVER ) 3515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_add_uuid(UUID_SERVCLASS_GN); 3525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 3535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_GN); 3545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(p_data->api_set_role.role & PAN_ROLE_CLIENT ) 3565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_add_uuid(UUID_SERVCLASS_PANU); 3575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 3585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_PANU); 3595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project set_role.status = BTA_PAN_SUCCESS; 3615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 3625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* if status is not success clear everything */ 3635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 3645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 3655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project PAN_SetRole(0, 0, NULL, NULL, NULL); 3665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_NAP); 3675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_GN); 3685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_PANU); 3695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project set_role.status = BTA_PAN_FAIL; 3705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 3715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.p_cback(BTA_PAN_SET_ROLE_EVT, (tBTA_PAN *)&set_role); 3725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 3735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 3775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_disable 3795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description 3815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 3855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 3865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 3875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_disable(void) 3885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 3895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BT_HDR *p_buf; 3915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_SCB *p_scb = &bta_pan_cb.scb[0]; 3925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project UINT8 i; 3935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* close all connections */ 3965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project PAN_SetRole (0, NULL, NULL, NULL, NULL); 3975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 3985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE) 3995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_NAP); 4005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_GN); 4015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_remove_uuid(UUID_SERVCLASS_PANU); 4025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#endif 4035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* free all queued up data buffers */ 4045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project for (i = 0; i < BTA_PAN_NUM_CONN; i++, p_scb++) 4055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 4065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if (p_scb->in_use) 4075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 4085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project while((p_buf = (BT_HDR *)GKI_dequeue(&p_scb->data_queue)) != NULL) 4095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf(p_buf); 4105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_close(p_scb->handle, p_scb->app_id); 4125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 4145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 4155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project PAN_Deregister(); 4195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 4215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 4235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_open 4255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description 4275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 4295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 4315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_open(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 4325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 4335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tPAN_RESULT status; 4345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_OPEN data; 4355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_OPENING opening; 4365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project status = PAN_Connect (p_data->api_open.bd_addr, p_data->api_open.local_role, p_data->api_open.peer_role, 4395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project &p_scb->handle); 4405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(status == PAN_SUCCESS) 4435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 4445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bdcpy(p_scb->bd_addr, p_data->api_open.bd_addr); 4465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->local_role = p_data->api_open.local_role; 4475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->peer_role = p_data->api_open.peer_role; 4485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bdcpy(opening.bd_addr, p_data->api_open.bd_addr); 4495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project opening.handle = p_scb->handle; 4505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.p_cback(BTA_PAN_OPENING_EVT, (tBTA_PAN *)&opening); 4515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 4545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 4555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 4565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_scb_dealloc(p_scb); 4575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bdcpy(data.bd_addr, p_data->api_open.bd_addr); 4585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project data.status = BTA_PAN_FAIL; 4595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.p_cback(BTA_PAN_OPEN_EVT, (tBTA_PAN *)&data); 4605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 4615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 4635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 4665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_close 4685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description 4705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 4745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 4765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_api_close (tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 4775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 4785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_CONN * p_buf; 4795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project PAN_Disconnect (p_scb->handle); 4815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* send an event to BTA so that application will get the connection 4845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project close event */ 4855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((p_buf = (tBTA_PAN_CONN *) GKI_getbuf(sizeof(tBTA_PAN_CONN))) != NULL) 4865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 4875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->hdr.event = BTA_PAN_CONN_CLOSE_EVT; 4885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->hdr.layer_specific = p_scb->handle; 4905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_sendmsg(p_buf); 4915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 4935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 4945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 4965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 4975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 4985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_conn_open 4995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description process connection open event 5015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 5035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 5055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_conn_open(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 5065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 5075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_OPEN data; 5095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bdcpy(data.bd_addr, p_scb->bd_addr); 5115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project data.handle = p_scb->handle; 5125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project data.local_role = p_scb->local_role; 5135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project data.peer_role = p_scb->peer_role; 5145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(p_data->conn.result == PAN_SUCCESS) 5165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 5175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project data.status = BTA_PAN_SUCCESS; 5185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_open(p_scb->handle, p_scb->app_id, p_scb->local_role, p_scb->peer_role, p_scb->bd_addr); 5195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 5215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 5225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 5235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_scb_dealloc(p_scb); 5245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project data.status = BTA_PAN_FAIL; 5255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 5265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->pan_flow_enable = TRUE; 5285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->app_flow_enable = TRUE; 5295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_conn_open( BTA_ID_PAN ,p_scb->app_id, p_scb->bd_addr); 5315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.p_cback(BTA_PAN_OPEN_EVT, (tBTA_PAN *)&data); 5335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 5365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 5385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_conn_close 5405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description process connection close event 5425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 5465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 5485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_conn_close(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 5495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 5505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project tBTA_PAN_CLOSE data; 5525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BT_HDR *p_buf; 5535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project data.handle = p_data->hdr.layer_specific; 5555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_conn_close( BTA_ID_PAN ,p_scb->app_id, p_scb->bd_addr); 5585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* free all queued up data buffers */ 5605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project while((p_buf = (BT_HDR *)GKI_dequeue(&p_scb->data_queue)) != NULL) 5615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf(p_buf); 5625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_init_q(&p_scb->data_queue); 5645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_close(p_scb->handle, p_scb->app_id); 5665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_scb_dealloc(p_scb); 5685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_cb.p_cback(BTA_PAN_CLOSE_EVT, (tBTA_PAN *)&data); 5705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 5725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 5765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 5775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_rx_path 5795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description Handle data on the RX path (data sent from the phone to 5815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** BTA). 5825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 5855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 5865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 5875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_rx_path(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 5885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 5895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* if data path configured for rx pull */ 5905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((bta_pan_cb.flow_mask & BTA_PAN_RX_MASK) == BTA_PAN_RX_PULL) 5915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 5925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* if we can accept data */ 5935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if (p_scb->pan_flow_enable == TRUE) 5945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 5955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* call application callout function for rx path */ 5965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_rx_path(p_scb->handle, p_scb->app_id); 5975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 5985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 5995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* else data path configured for rx push */ 6005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else 6015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 6025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 6045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 6055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 6075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_tx_path 6095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description Handle the TX data path (data sent from BTA to the phone). 6115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 6145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 6165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_tx_path(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 6175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 6185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project BT_HDR * p_buf; 6205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* if data path configured for tx pull */ 6215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((bta_pan_cb.flow_mask & BTA_PAN_TX_MASK) == BTA_PAN_TX_PULL) 6225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 6235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* call application callout function for tx path */ 6245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_tx_path(p_scb->handle, p_scb->app_id); 6255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* free data that exceeds queue level */ 6275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project while(p_scb->data_queue.count > bta_pan_cb.q_level) 6285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf(GKI_dequeue(&p_scb->data_queue)); 6295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 6305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* if configured for zero copy push */ 6315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project else if ((bta_pan_cb.flow_mask & BTA_PAN_TX_MASK) == BTA_PAN_TX_PUSH_BUF) 6325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 6335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* if app can accept data */ 6345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if (p_scb->app_flow_enable == TRUE) 6355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 6365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* read data from the queue */ 6375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((p_buf = (BT_HDR *)GKI_dequeue(&p_scb->data_queue)) != NULL) 6385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 6395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* send data to application */ 6405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_pan_co_tx_writebuf(p_scb->handle, 6415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->app_id, 6425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_buf)->src, 6435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_buf)->dst, 6445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_buf)->protocol, 6455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf, 6465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_buf)->ext, 6475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_buf)->forward); 6485738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 6505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* free data that exceeds queue level */ 6515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project while(p_scb->data_queue.count > bta_pan_cb.q_level) 6525738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf(GKI_dequeue(&p_scb->data_queue)); 6535738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project /* if there is more data to be passed to 6555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project upper layer */ 6565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if(p_scb->data_queue.count) 6575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 6585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) 6595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 6605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->layer_specific = p_scb->handle; 6615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_buf->event = BTA_PAN_RX_FROM_BNEP_READY_EVT; 6625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project bta_sys_sendmsg(p_buf); 6635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 6645738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6655738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 6665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 6685738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 6695738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 6705738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 6725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_tx_flow 6745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description Set the application flow control state. 6765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 6795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 6815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_tx_flow(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 6825738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 6835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project p_scb->app_flow_enable = p_data->ci_tx_flow.enable; 6845738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 6855738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 6865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 6875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_write_buf 6895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description Handle a bta_pan_ci_rx_writebuf() and send data to PAN. 6915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6935738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 6945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 6955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 6965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_write_buf(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 6975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 6985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project if ((bta_pan_cb.flow_mask & BTA_PAN_RX_MASK) == BTA_PAN_RX_PUSH_BUF) 6995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project { 7005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 7015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project PAN_WriteBuf (p_scb->handle, 7025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_data)->dst, 7035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_data)->src, 7045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_data)->protocol, 7055738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project (BT_HDR *)p_data, 7065738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ((tBTA_PAN_DATA_PARAMS *)p_data)->ext); 7075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 7085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project } 7095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 7105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 7115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************* 7125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 7135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Function bta_pan_free_buf 7145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 7155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Description Frees the data buffer during closing state 7165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 7175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 7185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** Returns void 7195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project** 7205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*******************************************************************************/ 7215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Projectvoid bta_pan_free_buf(tBTA_PAN_SCB *p_scb, tBTA_PAN_DATA *p_data) 7225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project{ 7235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 7245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project GKI_freebuf(p_data); 7255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 7265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} 7275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project 7285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#endif /* PAN_INCLUDED */ 729