// rfc_slot_t* accept_rs = create_srv_accept_rfc_slot(srv_rs, p_open->rem_bda,p_opne->handle,  p_open->new_listen_handle);
static inline rfc_slot_t* create_srv_accept_rfc_slot(rfc_slot_t* srv_rs, const bt_bdaddr_t* addr,
                                        int open_handle, int new_listen_handle)
{
    rfc_slot_t *accept_rs = alloc_rfc_slot(addr, srv_rs->service_name, srv_rs->service_uuid, srv_rs->scn, 0, FALSE);
    clear_slot_flag(&accept_rs->f);
    accept_rs->f.server = FALSE;
    accept_rs->f.connected = TRUE;
    accept_rs->security = srv_rs->security;
    accept_rs->mtu = srv_rs->mtu;
    accept_rs->role = srv_rs->role;
    accept_rs->rfc_handle = open_handle;
    accept_rs->rfc_port_handle = BTA_JvRfcommGetPortHdl(open_handle);
     //now update listen rfc_handle of server slot
    srv_rs->rfc_handle = new_listen_handle;
    srv_rs->rfc_port_handle = BTA_JvRfcommGetPortHdl(new_listen_handle);
    BTIF_TRACE_DEBUG4("create_srv_accept__rfc_slot(open_handle: 0x%x, new_listen_handle:"
            "0x%x) accept_rs->rfc_handle:0x%x, srv_rs_listen->rfc_handle:0x%x"
      ,open_handle, new_listen_handle, accept_rs->rfc_port_handle, srv_rs->rfc_port_handle);
    asrt(accept_rs->rfc_port_handle != srv_rs->rfc_port_handle);
  //now swap the slot id
    uint32_t new_listen_id = accept_rs->id;
    accept_rs->id = srv_rs->id;
    srv_rs->id = new_listen_id;
    return accept_rs;
}
コード例 #2
0
// l2c_slot_t* accept_ls = create_srv_accept_l2c_slot(srv_ls, p_open->rem_bda,p_opne->handle,  p_open->new_listen_handle);
static inline l2c_slot_t* create_srv_accept_l2c_slot(l2c_slot_t* srv_ls, const bt_bdaddr_t* addr,
                                        int open_handle, int new_listen_handle)
{
    l2c_slot_t *accept_ls = alloc_l2c_slot(addr, srv_ls->service_name, srv_ls->service_uuid, srv_ls->psm, 0, FALSE);
    if( accept_ls)
    {
        clear_slot_flag(&accept_ls->f);
        accept_ls->f.server = FALSE;
        accept_ls->f.connected = TRUE;
        accept_ls->security = srv_ls->security;
        accept_ls->put_size = srv_ls->put_size;
        accept_ls->role = srv_ls->role;
        accept_ls->l2c_handle = open_handle;
        //now update listen l2c_handle of server slot
        srv_ls->l2c_handle = new_listen_handle;
        //now swap the slot id
        uint32_t new_listen_id = accept_ls->id;
        accept_ls->id = srv_ls->id;
        srv_ls->id = new_listen_id;

        return accept_ls;
    }
    else
    {
        APPL_TRACE_ERROR(" accept_ls is NULL %s", __FUNCTION__);
        return NULL;
    }
}