コード例 #1
0
HRESULT CMsgContainerCAN::GetInterPretedSignalList(STCAN_MSG& ouMsg, SSignalInfoArray& ouSSignalInfoArray, bool isHexMode)
{
    if (nullptr == mBmNetwork)
    {
        return S_FALSE;
    }
    IFrame* pouFrame = nullptr;
    ERRORCODE eResult = mBmNetwork->GetFrame(CAN, 0, ouMsg.m_unMsgID, nullptr, &pouFrame);
    ouSSignalInfoArray.RemoveAll();
    if (EC_SUCCESS == eResult && nullptr != pouFrame)
    {
        std::list<InterpreteSignals> ouSignal;
        std::string strName;
        pouFrame->GetName(strName);
        pouFrame->InterpretSignals(ouMsg.m_ucData, ouMsg.m_ucDataLen, ouSignal, isHexMode, true);
for (auto ouSignalInfo : ouSignal)   //Only C++11;
        {
            SSignalInfo ouSignal;
            ouSignal.m_omEnggValue = ouSignalInfo.m_omEnggValue.c_str();
            ouSignal.m_omRawValue = ouSignalInfo.m_omRawValue.c_str();
            ouSignal.m_omSigName = ouSignalInfo.m_omSigName.c_str();
            ouSignal.m_omUnit = ouSignalInfo.m_omUnit.c_str();
            ouSignal.m_msgName = strName.c_str();
            ouSSignalInfoArray.Add(ouSignal);
        }
        return S_OK;
    }
    return S_FALSE;
}
コード例 #2
0
HRESULT CMsgContainerJ1939::GetInterPretedSignalList(STJ1939_MSG& ouMsg, SSignalInfoArray& ouSSignalInfoArray, bool isHexMode)
{
    if (nullptr == mBmNetwork)
    {
        return S_FALSE;
    }
    IFrame* pouFrame = nullptr;
    ERRORCODE eResult = mBmNetwork->GetFrame(J1939, 0, ouMsg.m_sMsgProperties.m_uExtendedID.m_s29BitId.unGetPGN(), nullptr, &pouFrame);
    ouSSignalInfoArray.RemoveAll();
    if (EC_SUCCESS == eResult && nullptr != pouFrame)
    {
        std::list<InterpreteSignals> ouSignal;
        std::string strName;
        pouFrame->GetName(strName);
        pouFrame->InterpretSignals(ouMsg.m_pbyData, ouMsg.m_unDLC, ouSignal, isHexMode, true);
for (auto ouSignalInfo : ouSignal)   //Only C++11;
        {
            SSignalInfo ouSignal;
            ouSignal.m_omEnggValue = ouSignalInfo.m_omEnggValue.c_str();
            ouSignal.m_omRawValue = ouSignalInfo.m_omRawValue.c_str();
            ouSignal.m_omSigName = ouSignalInfo.m_omSigName.c_str();
            ouSignal.m_omUnit = ouSignalInfo.m_omUnit.c_str();
            ouSignal.m_msgName = strName.c_str();
            ouSSignalInfoArray.Add(ouSignal);
        }
    }
    return S_OK;
}
コード例 #3
0
HRESULT VerifyCurrentMessage(STCANDATA& sCanData, CTSExecutionCAN* pTSXCan)
{
    AfxTrace(_("In VERIFY - Before Enter\n"));
    EnterCriticalSection(&(pTSXCan->m_omCritSecTS));
    AfxTrace(_("In VERIFY - After Enter\n"));

    if(pTSXCan->m_bTimeOver == TRUE || pTSXCan->m_pCurrentVerify == nullptr)
    {
        LeaveCriticalSection(&(pTSXCan->m_omCritSecTS));
        return S_FALSE;
    }
    UINT unCount;
    pTSXCan->m_pCurrentVerify->GetSubEntryCount(unCount);
    if(pTSXCan->m_MsgVerifiedList.GetCount() < (INT)unCount)
    {
        CVerify_MessageData ouMsgData;


        if(pTSXCan->m_pCurrentVerify->GetMessageFromId(sCanData.m_uDataInfo.m_sCANMsg.m_unMsgID, &ouMsgData) == S_OK)
        {
            if (pTSXCan->m_MsgVerifiedList.Find(sCanData.m_uDataInfo.m_sCANMsg.m_unMsgID) == nullptr)
            {
                UCHAR pucData[8] = {0};
                memcpy(pucData, &sCanData.m_uDataInfo.m_sCANMsg.m_ucData, sCanData.m_uDataInfo.m_sCANMsg.m_ucDataLen);

                //Interprete The Messages
                IFrame* sMsg;
                pTSXCan->m_pCurrentVerify->m_ouDataBaseManager.nGetMessageInfo(ouMsgData.m_omMessageName, &sMsg);

                //pTSXCan->m_ouMsgInterpret.vSetMessageList(sMsgEntry);
                //pTSXCan->m_ouMsgInterpret.bInterpretMsgs(ouMsgData.m_dwMessageID, pucData, ouSignalInfo);
                if ( nullptr != sMsg )
                {
                    CMessageResult ouMsgResult;
                    if ( ouMsgData.m_byChannelNumber == sCanData.m_uDataInfo.m_sCANMsg.m_ucChannel )    // solves issue #711, 4th bullet point
                    {
                        std::list<InterpreteSignals> signlaList;
                        sMsg->InterpretSignals( pucData, sizeof( pucData ), signlaList, false );
                        if ( pTSXCan->bVerifyCanMessage( ouMsgData, signlaList, ouMsgResult ) == TRUE )
                        {
                            //pTSXCan->m_nVerifyCount++;

                            if ( pTSXCan->m_ouVerifyResult != nullptr && pTSXCan->m_bTimeOver == FALSE )
                            {
                                //pTSXCan->TSX_DisplayMessage(ouMsgData.m_omMessageName);
                                //pTSXCan->TSX_DisplayResult(CString("SUCCESS"));
                                pTSXCan->m_ouVerifyResult->m_MessageResultList.AddTail( ouMsgResult );
                            }
                            pTSXCan->m_MsgVerifiedList.AddTail( (UINT&)ouMsgData.m_dwMessageID );
                        }
                    }
                }
            }
        }
    }
    if(pTSXCan->m_MsgVerifiedList.GetCount() == (INT)unCount)
    {
        //pTSXCan->m_nVerifyCount = 0;
        pTSXCan->m_pCurrentVerify = nullptr;
        pTSXCan->m_ouVerifyEvent.SetEvent();
        //pTSXCan->m_ouReadThread.m_unActionCode = INVOKE_FUNC;
    }
    LeaveCriticalSection(&(pTSXCan->m_omCritSecTS));
    return S_OK;
}
コード例 #4
0
/******************************************************************************
Function Name  :  TSX_VerifyMessage
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CTSExecutionCAN
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  01/04/2011
Modifications  :
******************************************************************************/
HRESULT CTSExecutionCAN::TSX_VerifyMessage(CBaseEntityTA* pEntity, CResultVerify& ouVerifyResult)
{
    //TODO::Proper Handling Required
    UCHAR pucData[8];
    INT dataSize = 8;
    STCANDATA sCanData;
    UINT unVerifyCount;
    HRESULT hResult = S_OK;
    CBaseEntityTA* pVerifyEntity;
    CVerify_MessageData ouVerifyData;
    CString omResult;
    IFrame* sMsg;
    CVerifyData ouVerify;


    pEntity->GetSubEntryCount(unVerifyCount);
    ouVerifyResult.m_MessageResultList.RemoveAll();

    pEntity->GetEntityData(VERIFY, &ouVerify);
    ouVerifyResult.m_eResult = ouVerify.m_eAttributeError;
    //Loop For all Messages
    for(UINT j=0; j<unVerifyCount; j++)
    {
        pEntity->GetSubEntityObj(j, &pVerifyEntity);
        pVerifyEntity->GetEntityData(VERIFY_MESSAGE, &ouVerifyData);

        if(m_ouCanBufVFSE.ReadFromBuffer(&sCanData, (__int64)ouVerifyData.m_dwMessageID)==0)
        {
            dataSize = sCanData.m_uDataInfo.m_sCANMsg.m_ucDataLen;
            memcpy(pucData, &sCanData.m_uDataInfo.m_sCANMsg.m_ucData, sCanData.m_uDataInfo.m_sCANMsg.m_ucDataLen);
        }
        else
        {
            dataSize = 8;
            memset(pucData, 0, 8);
        }

        //Interprete The Messages
        SMSGENTRY* sMsgEntry = new SMSGENTRY;
        pEntity->m_ouDataBaseManager.nGetMessageInfo(ouVerifyData.m_omMessageName, &sMsg);
        if ( nullptr == sMsg )
        {
            return S_FALSE;
        }

        std::list<InterpreteSignals> interPretedSignalList;
        sMsg->InterpretSignals( pucData, dataSize, interPretedSignalList, false );
        CString strVerDisplay = _("Verifying Message ")+ouVerifyData.m_omMessageName;
        TSX_DisplayMessage(strVerDisplay);
        //Verify The Signals
        CMessageResult ouMsgResult;
        omResult = _("SUCCESS");
        if( ouVerifyData.m_byChannelNumber == sCanData.m_uDataInfo.m_sCANMsg.m_ucChannel )    // solves issue #711, 4th bullet point
        {
            if ( bVerifyCanMessage( ouVerifyData, interPretedSignalList, ouMsgResult ) == FALSE )
            {

                omResult = _("FAIL");
                hResult = S_FALSE;
            }
        }
        else
        {
            omResult = _("FAIL");
            hResult = S_FALSE;
        }
        ouVerifyResult.m_MessageResultList.AddTail(ouMsgResult);
        TSX_DisplayResult(omResult);
        //delete []pucData;
    }
    if( S_FALSE != hResult )
    {
        ouVerifyResult.m_eResult = SUCCESS;
    }
    return hResult;
}