// Setter for the logging configuration data
HRESULT CFrameProcessor_Common::SetConfigData(BYTE* pvDataStream, const CString& omStrVersion)
{
    if (FALSE == bIsEditingON())
    {
        return S_FALSE;
    }

    ClearLoggingBlockList();

    BYTE* pbBuff = pvDataStream;
    BYTE bVersion = 0;
    USHORT ushLogBlks = 0;

    COPY_DATA_2(&bVersion, pbBuff, sizeof(bVersion));
    COPY_DATA_2(&ushLogBlks, pbBuff, sizeof(ushLogBlks));

    m_omStrVersion = omStrVersion;
    for (USHORT i = 0; i < ushLogBlks; i++)
    {
        CBaseLogObject* pouBaseLogObj = CreateNewLogObj(m_omStrVersion);
        pbBuff = pouBaseLogObj->SetConfigData(pbBuff, bVersion);
        m_omLogListTmp.Add(pouBaseLogObj);
    }

    return S_OK;
}
//MVN
HRESULT CFrameProcessor_Common::SetConfigData( xmlDocPtr pDoc, ETYPE_BUS eBus)
{
    if (FALSE == bIsEditingON())
    {
        return S_FALSE;
    }

    ClearLoggingBlockList();



    USHORT ushLogBlks = 0;
    xmlChar* pchXpath = NULL;
    xmlXPathObjectPtr pXpathPtr = NULL;

    if(eBus == CAN)
    {
        pchXpath = (xmlChar*)"//BUSMASTER_CONFIGURATION/Module_Configuration/CAN_Log/Log_Block";
    }
    else if(eBus == J1939)
    {
        pchXpath = (xmlChar*)"//BUSMASTER_CONFIGURATION/Module_Configuration/J1939_Log/Log_Block";
    }
    else if(eBus == LIN)
    {
        pchXpath = (xmlChar*)"//BUSMASTER_CONFIGURATION/Module_Configuration/LIN_Log/Log_Block";
    }
    pXpathPtr = xmlUtils::pGetNodes(pDoc, pchXpath);
    xmlNodePtr pNodePtr;

    if ( pXpathPtr != NULL)
    {
        xmlNodeSetPtr pNodeSet = pXpathPtr->nodesetval;
        if(pNodeSet != NULL)
        {
            ushLogBlks = pNodeSet->nodeNr;
            for(int i = 0; i < ushLogBlks; i++)
            {
                CBaseLogObject* pouBaseLogObj = CreateNewLogObj(m_omStrVersion);
                if ( S_OK == pouBaseLogObj->nSetConfigData(pNodeSet->nodeTab[i]))
                {
                    vAddLogFile(m_omLogListTmp, pouBaseLogObj);
                    //m_omLogListTmp.Add(pouBaseLogObj);
                }
            }
        }

    }
    return S_OK;
}
예제 #3
0
void CFrameProcessor_Common::vCopyLogObjArray(
    CLogObjArray& omLogObjArrayTarget, const CLogObjArray& omLogObjArraySrc)
{
    // First empty the target log object array
    vEmptyLogObjArray(omLogObjArrayTarget);
    USHORT ushBlocks = (USHORT) (omLogObjArraySrc.GetSize());

    if (ushBlocks > 0)
    {
        for (USHORT i = 0; i < ushBlocks; i++)
        {
            const CBaseLogObject* pouCurrLogObj = omLogObjArraySrc.GetAt(i);
            CBaseLogObject* pouNewLogObj = CreateNewLogObj();
            *pouNewLogObj = *pouCurrLogObj;
            omLogObjArrayTarget.Add(pouNewLogObj);
        }
    }
}
HRESULT CFrameProcessor_Common::AddLoggingBlock(const SLOGINFO& sLogObject)
{
    HRESULT hResult = S_FALSE;

    if (bIsEditingON())
    {
        CBaseLogObject* pouCurrLogBlk = CreateNewLogObj(m_omStrVersion);
        if (NULL != pouCurrLogBlk)
        {
            pouCurrLogBlk->SetLogInfo(sLogObject);
            m_omLogListTmp.Add(pouCurrLogBlk);
            hResult = S_OK;
        }
        else
        {
            ASSERT(FALSE);
        }
    }

    return hResult;
}