Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fc38780 authored by Navin Kochar's avatar Navin Kochar Committed by Andre Eisenbach
Browse files

Add LE L2CAP Connection Oriented Channel



This implementation for LE L2CAP Connection Oriented Channel (a Bluetooth
Core Spec 4.1 feature) has been tested on the following formal and informal
IOP events conducted by BT SIG Sport and Fitness Working Group.

* Informal IOP – Tokyo 2014
* UPF 49 – Berlin 2014
* Formal IOP – Tokyo 2014
* Formal IOP – Santa Clara 2015

Change-Id: Ia6de62f9321a78b98930629f65078884157a9c0d
Signed-off-by: default avatarNavin Kochar <navin.kochar@intel.com>
parent 2a7f4b5d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -590,7 +590,7 @@ extern tBTA_JV_STATUS BTA_JvL2capConnectLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
**                  BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvL2capConnect(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
extern tBTA_JV_STATUS BTA_JvL2capConnect(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
                           const tL2CAP_ERTM_INFO *ertm_info, UINT16 remote_psm,
                           UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
                           BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
@@ -634,7 +634,7 @@ extern tBTA_JV_STATUS BTA_JvL2capCloseLE(UINT32 handle);
**                  BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvL2capStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
extern tBTA_JV_STATUS BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
                           const tL2CAP_ERTM_INFO *ertm_info,
                           UINT16 local_psm, UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
                           tBTA_JV_L2CAP_CBACK *p_cback, void *user_data);
+6 −4
Original line number Diff line number Diff line
@@ -1087,11 +1087,12 @@ void bta_jv_l2cap_connect(tBTA_JV_MSG *p_data)

    if (sec_id)
    {
        if (bta_jv_check_psm(cc->remote_psm)) /* allowed */
        /* PSM checking is not required for LE COC */
        if ((cc->type != BTA_JV_CONN_TYPE_L2CAP) || (bta_jv_check_psm(cc->remote_psm))) /* allowed */
        {
            if ((handle = GAP_ConnOpen("", sec_id, 0, cc->peer_bd_addr, cc->remote_psm,
                &cfg, ertm_info, cc->sec_mask, chan_mode_mask,
                bta_jv_l2cap_client_cback)) != GAP_INVALID_HANDLE )
                bta_jv_l2cap_client_cback, cc->type)) != GAP_INVALID_HANDLE )
            {
                evt_data.status = BTA_JV_SUCCESS;
            }
@@ -1257,9 +1258,10 @@ void bta_jv_l2cap_start_server(tBTA_JV_MSG *p_data)
    */

    sec_id = bta_jv_alloc_sec_id();
    if (0 == sec_id || (FALSE == bta_jv_check_psm(ls->local_psm)) ||
    /* PSM checking is not required for LE COC */
    if (0 == sec_id || ((ls->type == BTA_JV_CONN_TYPE_L2CAP) && (FALSE == bta_jv_check_psm(ls->local_psm))) ||
        (handle = GAP_ConnOpen("JV L2CAP", sec_id, 1, 0, ls->local_psm, &cfg, ertm_info,
            ls->sec_mask, chan_mode_mask, bta_jv_l2cap_server_cback)) == GAP_INVALID_HANDLE)
            ls->sec_mask, chan_mode_mask, bta_jv_l2cap_server_cback, ls->type)) == GAP_INVALID_HANDLE)
    {
        bta_jv_free_sec_id(&sec_id);
        evt_data.status = BTA_JV_FAILURE;
+4 −2
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ tBTA_JV_STATUS BTA_JvL2capConnectLE(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
**                  BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
tBTA_JV_STATUS BTA_JvL2capConnect(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
tBTA_JV_STATUS BTA_JvL2capConnect(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
                           const tL2CAP_ERTM_INFO *ertm_info, UINT16 remote_psm,
                           UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
                           BD_ADDR peer_bd_addr, tBTA_JV_L2CAP_CBACK *p_cback, void *user_data)
@@ -386,6 +386,7 @@ tBTA_JV_STATUS BTA_JvL2capConnect(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
    tBTA_JV_API_L2CAP_CONNECT *p_msg =
        (tBTA_JV_API_L2CAP_CONNECT *)osi_malloc(sizeof(tBTA_JV_API_L2CAP_CONNECT));
    p_msg->hdr.event    = BTA_JV_API_L2CAP_CONNECT_EVT;
    p_msg->type         = conn_type;
    p_msg->sec_mask     = sec_mask;
    p_msg->role         = role;
    p_msg->remote_psm   = remote_psm;
@@ -481,7 +482,7 @@ tBTA_JV_STATUS BTA_JvL2capCloseLE(UINT32 handle)
**                  BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
tBTA_JV_STATUS BTA_JvL2capStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
tBTA_JV_STATUS BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
        const tL2CAP_ERTM_INFO *ertm_info,UINT16 local_psm, UINT16 rx_mtu, tL2CAP_CFG_INFO *cfg,
        tBTA_JV_L2CAP_CBACK *p_cback, void *user_data)
{
@@ -493,6 +494,7 @@ tBTA_JV_STATUS BTA_JvL2capStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
    tBTA_JV_API_L2CAP_SERVER *p_msg =
        (tBTA_JV_API_L2CAP_SERVER *)osi_malloc(sizeof(tBTA_JV_API_L2CAP_SERVER));
    p_msg->hdr.event = BTA_JV_API_L2CAP_START_SERVER_EVT;
    p_msg->type = conn_type;
    p_msg->sec_mask = sec_mask;
    p_msg->role = role;
    p_msg->local_psm = local_psm;
+2 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ typedef struct
typedef struct
{
    BT_HDR              hdr;
    INT32               type;       /* One of BTA_JV_CONN_TYPE_ */
    tBTA_SEC            sec_mask;
    tBTA_JV_ROLE        role;
    union {
@@ -184,6 +185,7 @@ typedef struct
typedef struct
{
    BT_HDR              hdr;
    INT32               type;       /* One of BTA_JV_CONN_TYPE_ */
    tBTA_SEC            sec_mask;
    tBTA_JV_ROLE        role;
    union {
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <hardware/bluetooth.h>

#define L2CAP_MASK_FIXED_CHANNEL    0x10000
#define L2CAP_MASK_LE_COC_CHANNEL   0x20000

bt_status_t btsock_l2cap_init(int handle, uid_set_t* set);
bt_status_t btsock_l2cap_cleanup();
Loading