Example #1
0
/*******************************************************************************
**
** Function         RFCOMM_FlowReq
**
** Description      This function is called by the port entity when flow
**                  control state has changed.  Enable flag passed shows if
**                  port can accept more data.
**
*******************************************************************************/
void RFCOMM_FlowReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 enable)
{
    tPORT      *p_port = port_find_mcb_dlci_port (p_mcb, dlci);

    if ((p_port->state != PORT_STATE_OPENED)
     || (p_port->rfc.state  != RFC_STATE_OPENED))
        return;

    p_port->local_ctrl.fc = !enable;

    p_port->rfc.expected_rsp |= RFC_RSP_MSC;

    rfc_send_msc (p_mcb, dlci, TRUE, &p_port->local_ctrl);
    rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;

}
Example #2
0
/*******************************************************************************
**
** Function         RFCOMM_ControlReq
**
** Description      This function is called by the port entity to send control
**                  parameters to remote port emulation entity.
**
*******************************************************************************/
void RFCOMM_ControlReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars)
{
    tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);

    if ((p_port->state != PORT_STATE_OPENED)
     || (p_port->rfc.state  != RFC_STATE_OPENED))
        return;

    p_port->port_ctrl |= PORT_CTRL_REQ_SENT;

    p_port->rfc.expected_rsp |= RFC_RSP_MSC;

    rfc_send_msc (p_mcb, dlci, TRUE, p_pars);
    rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;

}
Example #3
0
/*******************************************************************************
**
** Function         RFCOMM_FlowReq
**
** Description      This function is called by the port entity when flow
**                  control state has changed.  Enable flag passed shows if
**                  port can accept more data.
**
*******************************************************************************/
void RFCOMM_FlowReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 enable)
{
    tPORT *p_port = port_find_mcb_dlci_port(p_mcb, dlci);
    if (p_port == NULL) {
        RFCOMM_TRACE_WARNING("%s Unable to find DLCI port dlci:%d", __func__,
                dlci);
        return;
    }

    if ((p_port->state != PORT_STATE_OPENED)
     || (p_port->rfc.state  != RFC_STATE_OPENED))
        return;

    p_port->local_ctrl.fc = !enable;

    p_port->rfc.expected_rsp |= RFC_RSP_MSC;

    rfc_send_msc (p_mcb, dlci, TRUE, &p_port->local_ctrl);
    rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;

}
Example #4
0
/*******************************************************************************
**
** Function         RFCOMM_ControlReq
**
** Description      This function is called by the port entity to send control
**                  parameters to remote port emulation entity.
**
*******************************************************************************/
void RFCOMM_ControlReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars)
{
    tPORT *p_port = port_find_mcb_dlci_port(p_mcb, dlci);
    if (p_port == NULL) {
        RFCOMM_TRACE_WARNING("%s Unable to find DLCI port dlci:%d", __func__,
                dlci);
        return;
    }

    if ((p_port->state != PORT_STATE_OPENED)
     || (p_port->rfc.state  != RFC_STATE_OPENED))
        return;

    p_port->port_ctrl |= PORT_CTRL_REQ_SENT;

    p_port->rfc.expected_rsp |= RFC_RSP_MSC;

    rfc_send_msc (p_mcb, dlci, TRUE, p_pars);
    rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;

}
Example #5
0
/*******************************************************************************
**
** Function         rfc_process_msc
**
** Description      This function handles Modem Status Command.
**                  Pass command to the user.
**
*******************************************************************************/
void rfc_process_msc (tRFC_MCB *p_mcb, BOOLEAN is_command, MX_FRAME *p_frame)
{
    tPORT_CTRL pars;
    tPORT      *p_port;
    UINT8      modem_signals = p_frame->u.msc.signals;
    BOOLEAN    new_peer_fc = FALSE;

    p_port = port_find_mcb_dlci_port (p_mcb, p_frame->dlci);
    if (p_port == NULL) {
        return;
    }

    pars.modem_signal = 0;

    if (modem_signals & RFCOMM_MSC_RTC) {
        pars.modem_signal |= MODEM_SIGNAL_DTRDSR;
    }

    if (modem_signals & RFCOMM_MSC_RTR) {
        pars.modem_signal |= MODEM_SIGNAL_RTSCTS;
    }

    if (modem_signals & RFCOMM_MSC_IC) {
        pars.modem_signal |= MODEM_SIGNAL_RI;
    }

    if (modem_signals & RFCOMM_MSC_DV) {
        pars.modem_signal |= MODEM_SIGNAL_DCD;
    }

    pars.fc = ((modem_signals & RFCOMM_MSC_FC) == RFCOMM_MSC_FC);

    pars.break_signal     = (p_frame->u.msc.break_present) ?
                            p_frame->u.msc.break_duration : 0;
    pars.discard_buffers  = 0;
    pars.break_signal_seq = RFCOMM_CTRL_BREAK_IN_SEQ;   /* this is default */

    /* Check if this command is passed only to indicate flow control */
    if (is_command) {
        rfc_send_msc (p_mcb, p_frame->dlci, FALSE, &pars);

        if (p_port->rfc.p_mcb->flow != PORT_FC_CREDIT) {
            /* Spec 1.1 indicates that only FC bit is used for flow control */
            p_port->peer_ctrl.fc = new_peer_fc = pars.fc;

            if (new_peer_fc != p_port->tx.peer_fc) {
                PORT_FlowInd (p_mcb, p_frame->dlci, (BOOLEAN)!new_peer_fc);
            }
        }

        PORT_ControlInd (p_mcb, p_frame->dlci, &pars);

        return;
    }

    /* If we are not awaiting response just ignore it */
    if (!(p_port->rfc.expected_rsp & RFC_RSP_MSC)) {
        return;
    }

    p_port->rfc.expected_rsp &= ~RFC_RSP_MSC;

    rfc_port_timer_stop (p_port);

    PORT_ControlCnf (p_port->rfc.p_mcb, p_port->dlci, &pars);
}