예제 #1
0
/*******************************************************************************
**
** Function         port_start_par_neg
**
** Description      This function is called in the BTU_TASK context to
**                  send configuration information
**
** Returns          void
**
*******************************************************************************/
void port_start_par_neg (tPORT *p_port)
{
    tRFC_MCB *p_mcb = p_port->rfc.p_mcb;

    if (p_mcb == NULL)
        return;

    RFCOMM_PortNegReq (p_mcb, p_port->dlci, &p_port->user_port_pars);
}
예제 #2
0
/*******************************************************************************
**
** Function         PORT_DlcEstablishCnf
**
** Description      This function is called from the RFCOMM layer when peer
**                  acknowledges establish procedure (SABME/UA).  Send reply
**                  to the user and set state to OPENED if result was
**                  successfull.
**
*******************************************************************************/
void PORT_DlcEstablishCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT16 result)
{
    tPORT  *p_port = port_find_mcb_dlci_port (p_mcb, dlci);

    RFCOMM_TRACE_EVENT ("PORT_DlcEstablishCnf dlci:%d mtu:%d result:%d", dlci, mtu, result);

    if (!p_port) {
        return;
    }

    if (result != RFCOMM_SUCCESS) {
        p_port->error = PORT_START_FAILED;
        port_rfc_closed (p_port, PORT_START_FAILED);
        return;
    }

    /* If L2CAP's mtu less then RFCOMM's take it */
    if (mtu && (mtu < p_port->peer_mtu)) {
        p_port->peer_mtu = mtu;
    }

    /* If there was an inactivity timer running for MCB stop it */
    rfc_timer_stop (p_mcb);

    if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED)) {
        (p_port->p_callback)(PORT_EV_CONNECTED, p_port->inx);
    }

    if (p_port->p_mgmt_callback) {
        p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx);
    }

    p_port->state = PORT_STATE_OPENED;

    /* RPN is required only if we want to tell DTE how the port should be opened */
    if ((p_port->uuid == UUID_SERVCLASS_DIALUP_NETWORKING)
            || (p_port->uuid == UUID_SERVCLASS_FAX)) {
        RFCOMM_PortNegReq (p_port->rfc.p_mcb, p_port->dlci, NULL);
    } else {
        RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl);
    }
}