Ejemplo n.º 1
0
HRESULT CDIL_LIN_VectorXL::LIN_DisableSlave(STLIN_MSG& sMessage)
{
    HRESULT hResult = S_FALSE;
    UINT unClientIndex = 0;
    XLaccess xlChanMaskTx = sg_aodChannels[sMessage.m_ucChannel - 1].m_pXLChannelInfo->channelMask;
    xlLinSwitchSlave(g_xlPortHandle[unClientIndex], xlChanMaskTx, sMessage.m_ucMsgID, XL_LIN_SLAVE_OFF);
    return 0;
}
Ejemplo n.º 2
0
/**
* \brief         This will send a LIN message to the driver. In case of USB
*                this will write the message in to the driver buffer and will
*                return. In case if parallel port mode this will write the
*                message and will wait for the ACK event from the driver. If
*                the event fired this will return 0. Otherwise this will return
*                wait time out error. In parallel port it is a blocking call
*                and in case of failure condition this will take 2 seconds.
* \param[in]     sMessage Message to Transmit
* \return        Operation Result. 0 incase of no errors. Failure Error codes otherwise.
* \authors       Arunkumar Karri
* \date          07.26.2013 Created
*/
static int nWriteMessage(STLIN_MSG sMessage, DWORD dwClientID)
{
    //int nReturn = -1;
    XLaccess xlChanMaskTx = 0;
    UINT unClientIndex = (UINT)-1;
    //XLstatus xlStatus;

    if ((sMessage.m_ucChannel > 0) &&
            (sMessage.m_ucChannel <= sg_nNoOfChannels) &&
            sMessage.m_ucChannel <= defNO_OF_CHANNELS)
    {
        //Get channel mask
        xlChanMaskTx = sg_aodChannels[sMessage.m_ucChannel - 1].m_pXLChannelInfo->channelMask;

        if ( sMessage.m_ucMsgTyp == LIN_SLAVE_RESPONSE )
        {

            //Transmit message

            xlLinSwitchSlave(g_xlPortHandle[0], xlChanMaskTx, sMessage.m_ucMsgID, XL_LIN_SLAVE_ON);
            //xlLinSwitchSlave(g_xlPortHandle[unClientIndex], xlChanMaskTx, 0X12, XL_LIN_SLAVE_ON);

            xlLinSetSlave(g_xlPortHandle[0], xlChanMaskTx, sMessage.m_ucMsgID, sMessage.m_ucData, sMessage.m_ucDataLen, nGetCalcChecksum(sMessage.m_ucChannel - 1, sMessage.m_ucMsgID));
            //xlLinSendRequest(g_xlPortHandle[unClientIndex], xlChanMaskTx, sMessage.m_ucMsgID, 0);

            //set result
            //nReturn = xlStatus;
        }
        else
        {

            if (sg_bCurrState == STATE_CONNECTED)
            {
                xlLinSendRequest(g_xlPortHandle[0], xlChanMaskTx, sMessage.m_ucMsgID, 0);
            }
        }

    }

    return S_OK;
}