void CFrameProcessor_Common::vAddLogFile( CLogObjArray& omLogListTmp, CBaseLogObject*& pouBaseLogObj)
{
    int nCount = omLogListTmp.GetSize();
    BOOL bDuplicate = FALSE;
    if(nCount == 0)
    {
        omLogListTmp.Add(pouBaseLogObj);
    }
    else
    {
        for(int i = 0; i < nCount; i++)
        {
            CBaseLogObject* pBaseObjectSrc = omLogListTmp.GetAt(i);
            SLOGINFO sLogInfo1, sLogInfo2;
            pouBaseLogObj->GetLogInfo(sLogInfo1);
            pBaseObjectSrc->GetLogInfo(sLogInfo2);
            //TODO::CString Has to be Remodved
            CString omStr1 = sLogInfo1.m_sLogFileName;
            CString omStr2 = sLogInfo2.m_sLogFileName;
            omStr1.TrimLeft(" \n\t");
            omStr1.TrimRight(" \n\t");
            omStr2.TrimLeft(" \n\t");
            omStr2.TrimRight(" \n\t");
            if(omStr1 == omStr2)
            {
                bDuplicate = TRUE;
            }
        }
        if(bDuplicate == FALSE)
        {
            omLogListTmp.Add(pouBaseLogObj);
        }
    }
}
HRESULT CFrameProcessor_Common::GetConfigData(xmlNodePtr pxmlNodePtr)
{
    /*BYTE* pbBuff = new BYTE[unGetBufSize()];
    *ppvConfigData = pbBuff;*/

    CLogObjArray* pomCurrArray = GetActiveLogObjArray();

    BYTE bVersion = VERSION_CURR;
    //COPY_DATA(pbBuff, &bVersion, sizeof(bVersion));

    USHORT ushLogBlks = (USHORT) (pomCurrArray->GetSize());

    //COPY_DATA(pbBuff, &ushLogBlks, sizeof(ushLogBlks));

    for (USHORT i = 0; i < ushLogBlks; i++)
    {
        xmlNodePtr pNodeLogBlckPtr = xmlNewNode(NULL, BAD_CAST DEF_LOG_BLOCK);
        xmlAddChild(pxmlNodePtr, pNodeLogBlckPtr);

        CBaseLogObject* pouLogObj = pomCurrArray->GetAt(i);

        if (NULL != pouLogObj)
        {
            pouLogObj->GetConfigData(pNodeLogBlckPtr);
        }
        else
        {
            ASSERT(FALSE);
        }
    }

    // unLength = unGetBufSize();

    return S_OK;
}
// Getter for the logging configuration data
HRESULT CFrameProcessor_Common::GetConfigData(BYTE** ppvConfigData, UINT& unLength)
{
    BYTE* pbBuff = new BYTE[unGetBufSize()];
    *ppvConfigData = pbBuff;

    CLogObjArray* pomCurrArray = GetActiveLogObjArray();

    BYTE bVersion = VERSION_CURR;
    COPY_DATA(pbBuff, &bVersion, sizeof(bVersion));

    USHORT ushLogBlks = (USHORT) (pomCurrArray->GetSize());

    COPY_DATA(pbBuff, &ushLogBlks, sizeof(ushLogBlks));

    for (USHORT i = 0; i < ushLogBlks; i++)
    {
        CBaseLogObject* pouLogObj = pomCurrArray->GetAt(i);
        if (NULL != pouLogObj)
        {
            pbBuff = pouLogObj->GetConfigData(pbBuff);
        }
        else
        {
            ASSERT(FALSE);
        }
    }

    unLength = unGetBufSize();

    return S_OK;
}
CBaseLogObject* CFrameProcessor_Common::FindLoggingBlock(USHORT ushID)
{
    CLogObjArray* pomCurrArray = GetActiveLogObjArray();

    CBaseLogObject* Result = NULL;
    USHORT Blocks = (USHORT) (pomCurrArray->GetSize());
    if (Blocks > ushID)
    {
        CBaseLogObject* pouCurrLogObj = pomCurrArray->GetAt(ushID);
        Result = pouCurrLogObj;
    }

    return Result;
}
Пример #5
0
// Empty log object
void CFrameProcessor_CAN::vEmptyLogObjArray(CLogObjArray& omLogObjArray)
{
    USHORT ushBlocks = (USHORT) (omLogObjArray.GetSize());

    if (ushBlocks > 0)
    {
        for (USHORT i = 0; i < ushBlocks; i++)
        {
            CBaseLogObject* pouCurrLogObj = omLogObjArray.GetAt(i);
            DeleteLogObj(pouCurrLogObj);
        }
    }
    omLogObjArray.RemoveAll();
}
Пример #6
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);
        }
    }
}
void CFrameProcessor_Common::SetChannelBaudRateDetails
(void* controllerDetails,
 int nNumChannels,ETYPE_BUS eBus)
{
    CLogObjArray* pomCurrArray = GetActiveLogObjArray();
    if (NULL != pomCurrArray)
    {
        for (int nIdx = 0; nIdx < pomCurrArray->GetSize(); nIdx++)
        {
            CBaseLogObject* pouCurrLogObj = pomCurrArray->GetAt(nIdx);

            if (NULL != pouCurrLogObj)
            {
                pouCurrLogObj->Der_SetChannelBaudRateDetails(controllerDetails,
                        nNumChannels);
            }
        }
    }
}
HRESULT CFrameProcessor_Common::SetDatabaseFiles(const CStringArray& omList)
{
    HRESULT hResult = S_OK; // Success is default assumption

    CLogObjArray* pomCurrArray = GetActiveLogObjArray();
    if (NULL != pomCurrArray)
    {
        for (int nIdx = 0; nIdx < pomCurrArray->GetSize(); nIdx++)
        {
            CBaseLogObject* pouCurrLogObj = pomCurrArray->GetAt(nIdx);

            if (NULL != pouCurrLogObj)
            {
                pouCurrLogObj->Der_SetDatabaseFiles(omList);
            }
        }
    }

    return hResult;
}