// 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;
}
/******************************************************************************
Function Name  :  SetConfigurationData
Input(s)       :  BYTE* pSrcBuffer, UINT unBuffSize
Output         :  HRESULT
Functionality  :  Returns the configuration data
Member of      :  CTSExecutorChildFrame
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :  CS040
******************************************************************************/
HRESULT CTSExecutorChildFrame::SetConfigurationData(BYTE* pSrcBuffer, UINT unBuffSize)
{
    if(unBuffSize != 0)
    {
        vInitialise();
        WINDOWPLACEMENT wndPlacement;
        COPY_DATA_2(&wndPlacement, pSrcBuffer,sizeof(WINDOWPLACEMENT));
        SetWindowPlacement(&wndPlacement);
        INT nCxCur, nCxMin;
        COPY_DATA_2(&nCxCur, pSrcBuffer, sizeof(INT));
        COPY_DATA_2(&nCxMin, pSrcBuffer, sizeof(INT));
        m_omSplitterWnd.SetColumnInfo(0, nCxCur, nCxMin);
        m_omSplitterWnd.RecalcLayout();
        unBuffSize = unBuffSize - sizeof(WINDOWPLACEMENT) - (2*sizeof(INT));
        m_ouTSExecutor.SetConfigurationData(pSrcBuffer, unBuffSize);
        m_odTreeView->GetTreeCtrl().SetCheck(m_hParentTreeItem, m_ouTSExecutor.m_bTestSuiteStatus);
        //Parse The Tree Control;
        INT nCount;
        m_ouTSExecutor.GetTestSetupCount(nCount);

        for(int i = 0; i < nCount; i++)
        {
            bParseTestSetup(i);
        }
    }
    //New File or when Initialising
    else
    {
        vInitialise();
        SetWindowPlacement(&m_sTSDefPlacement);
    }

    return S_OK;
}
예제 #3
0
void CReplayManager::vSetReplayConfigData(BYTE* pSrcBuffer, int /*nBuffSize*/)
{
    //Before loading another config initialize the display
    vStopReplayThread();
    vInitReplayManager();
    if (nullptr != pSrcBuffer)
    {
        //Now load new config
        BYTE byVersion = 0;
        COPY_DATA_2(&byVersion, pSrcBuffer, sizeof(BYTE));

        int nSize;
        COPY_DATA_2(&nSize, pSrcBuffer, sizeof(nSize));

        CReplayFile ouFile;
        for( int nIndex = 0; nIndex < nSize; nIndex++ )
        {
            pSrcBuffer = ouFile.pbyLoadConfig(pSrcBuffer, byVersion);
            m_omReplayFiles.Add(ouFile);
        }
        if (pSrcBuffer != nullptr)
        {
            COPY_DATA_2(&m_sWndPlacement, pSrcBuffer, sizeof(WINDOWPLACEMENT));
        }
    }
}
예제 #4
0
void tagSTJ1939_MSG::vSetDataStream(BYTE* pbyData)
{
    COPY_DATA_2(&m_sMsgProperties, pbyData,  sizeof(STJ1939_MSG_PROPERTIES));
    UINT unTempDLC = 0;
    COPY_DATA_2(&unTempDLC, pbyData, sizeof (UINT));
    if (/*unTempDLC > m_unDLC*/ m_pbyData == NULL)
    {
        //DELETE_ARRAY(m_pbyData);
        m_pbyData = new BYTE[MAX_DATA_LEN_J1939];
    }
    m_unDLC = unTempDLC;
    COPY_DATA_2(m_pbyData, pbyData, (sizeof (BYTE) * m_unDLC));
}
예제 #5
0
/*******************************************************************************
  Function Name  : SetConfigData
  Input(s)       : pvDataStream
  Output         : -
  Functionality  : Sets the Bus stats dialog Configuration from Byte Array.
  Member of      : CBusStatisticsDlg
  Author(s)      : Arunkumar K
  Date Created   : 25-08-2010
  Modifications  :
*******************************************************************************/
HRESULT CBusStatisticsDlg::SetConfigData(BYTE* pvDataStream)
{
    BYTE* pByteSrc = NULL;
    pByteSrc = pvDataStream;

    if (pByteSrc != NULL)
    {
        //Reading Version.
        BYTE byVer = 0;
        COPY_DATA_2(&byVer, pByteSrc, sizeof(BYTE));
        UINT nSize= 0;
        //Reading Buffer Size.
        COPY_DATA_2(&nSize, pByteSrc, sizeof(UINT));

        if ((byVer == BUS_STATS_DLG_VERSION) && (nSize > 0))
        {
            //Reading column Header Positions.
            CHeaderCtrl* pHeaderCtrl = m_omStatList.GetHeaderCtrl();

            if (pHeaderCtrl != NULL)
            {
                int  nColumnCount=0;
                //Reading column count.
                COPY_DATA_2(&nColumnCount, pByteSrc, sizeof(UINT));

                //Saved channel count is same as current channel count.
                if(nColumnCount==m_nChannelCount+1)
                {
                    LPINT pnOrder = (LPINT) malloc(nColumnCount*sizeof(int));

                    for (int i = 0 ; i < nColumnCount; i++)
                    {
                        COPY_DATA_2(&pnOrder[i], pByteSrc, sizeof(int));
                        bool bColumnVisible = false;
                        //Reading visibility
                        COPY_DATA_2(&bColumnVisible, pByteSrc, sizeof(bool));
                        m_omStatList.MakeColumnVisible(i, bColumnVisible);
                        INT nColWidth = 0;
                        //Reading width
                        COPY_DATA_2(&nColWidth, pByteSrc, sizeof(int));
                        m_omStatList.SetColumnWidth(i, nColWidth);
                    }

                    m_omStatList.SetColumnOrderArray(nColumnCount, pnOrder);
                    free(pnOrder);
                }
                else //Saved channel count differs from current channel count.
                {
                    vLoadDefaultValues();
                }
            }

            WINDOWPLACEMENT sMsgWndPlacement;
            COPY_DATA_2(&sMsgWndPlacement, pByteSrc, sizeof(WINDOWPLACEMENT));
            SetWindowPlacement(&sMsgWndPlacement);
        }
    }

    return S_OK;
}
예제 #6
0
void CSimSysManager :: CopySIMDataFromBuffer(BYTE* SrcBuffer)
{
    BYTE* tempBuffAddress = SrcBuffer;
    BYTE byVersion = 0;
    COPY_DATA_2(&byVersion, tempBuffAddress, sizeof(BYTE));
    COPY_DATA_2(&CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement, tempBuffAddress, sizeof(WINDOWPLACEMENT));
    UINT UnCount = 0;
    COPY_DATA_2(&UnCount, tempBuffAddress, sizeof(UINT));

    CString omTmp = "";
    for (UINT i = 0; i < UnCount; i++)
    {
        char acFilename[MAX_PATH] = "";
        COPY_DATA_2(acFilename, tempBuffAddress, sizeof (char) * MAX_PATH);
        omTmp.Format("%s", acFilename);
        //Add the simsys file details
        vLoadSimInfoFromConfiguration(omTmp);
    }
}
예제 #7
0
/******************************************************************************
  Function Name    :  pbSetConfigData
  Input(s)         :  pbSource - The source buffer to retrieve logging data.
                      It assumes that pbSource is currently pointing to locati-
                      on of a logging block data.
  Output           :  BYTE * - Location of the next byte after the block.
  Functionality    :  Retrieves logging block information and copies them into
                      the current object. Advances the reading pointer to the
                      next byte occurring after the block.
  Member of        :  tagLogInfo
  Friend of        :  -
  Author(s)        :  Ratnadip Choudhury
  Date Created     :  1.12.2009
  Modification date:
  Modification By  :
******************************************************************************/
BYTE* tagLogInfo::pbSetConfigData(BYTE* pbSource, BYTE bytLogVersion)
{
    BYTE* pbSStream = pbSource;
    COPY_DATA_2(&m_bIsUpdated,       pbSStream, sizeof(m_bIsUpdated      ));
    COPY_DATA_2(&m_bEnabled,         pbSStream, sizeof(m_bEnabled        ));
    COPY_DATA_2(&m_eLogTimerMode,    pbSStream, sizeof(m_eLogTimerMode   ));
    COPY_DATA_2(&m_eNumFormat,       pbSStream, sizeof(m_eNumFormat      ));
    COPY_DATA_2(&m_eFileMode,        pbSStream, sizeof(m_eFileMode       ));

    /* If version is 1.6.2 and above */
    if ( bytLogVersion > 0x1 )
    {
        COPY_DATA_2(&m_bResetAbsTimeStamp, pbSStream, sizeof(m_bResetAbsTimeStamp));
    }

    COPY_DATA_2(&m_ChannelSelected,  pbSStream, sizeof(m_ChannelSelected ));
    COPY_DATA_2(m_sLogFileName,      pbSStream, sizeof(m_sLogFileName    ));
    COPY_DATA_2(&m_sLogTrigger,      pbSStream, sizeof(m_sLogTrigger     ));
    return pbSStream;
}
예제 #8
0
/*******************************************************************************
  Function Name  : vSaveDataToStore
  Input(s)       : pvDataStream
  Output         : -
  Functionality  : Save the Bus stats dialog Configuration date to store.
  Member of      : CBusStatisticsDlg
  Author(s)      : Arunkumar K
  Date Created   : 25-08-2010
  Modifications  :
*******************************************************************************/
void CBusStatisticsDlg::vSaveDataToStore(BYTE* pvDataStream)
{
    BYTE* pByteSrc = NULL;
    pByteSrc = pvDataStream;

    if (pByteSrc != NULL)
    {
        //Reading Version.
        BYTE byVer = 0;
        COPY_DATA_2(&byVer, pByteSrc, sizeof(BYTE));
        UINT nSize= 0;
        //Reading Buffer Size.
        COPY_DATA_2(&nSize, pByteSrc, sizeof(UINT));

        if ((byVer == BUS_STATS_DLG_VERSION) && (nSize > 0))
        {
            int  nColumnCount=0;
            //Reading column count.
            COPY_DATA_2(&nColumnCount, pByteSrc, sizeof(UINT));
            sm_sBusSerializationData.m_nColumnCount = nColumnCount;
            LPINT pnOrder = (LPINT) sm_sBusSerializationData.m_arrnOrder;

            for (int i = 0 ; i < nColumnCount; i++)
            {
                COPY_DATA_2(&pnOrder[i], pByteSrc, sizeof(int));
                //Reading visibility
                COPY_DATA_2(&sm_sBusSerializationData.m_arrbColumnVisible[i], pByteSrc, sizeof(bool));
                //int nColWidth = 0;
                //Reading width
                COPY_DATA_2(&sm_sBusSerializationData.m_arrnColWidth[i], pByteSrc, sizeof(int));
            }

            COPY_DATA_2(&sm_sBusSerializationData.m_sBusStatsDlgCoOrd, pByteSrc, sizeof(WINDOWPLACEMENT));
        }

        //Mark as Dirty
        sm_sBusSerializationData.m_bIsDirty = true;
    }
}
예제 #9
0
BYTE* CGraphElement::pbySetConfigData(BYTE* pbyTrgData, BYTE byVersion)
{
    BYTE* pbyTemp = pbyTrgData;

    if (pbyTemp != NULL)
    {
        // Save properties one after another
        // Message ID
        COPY_DATA_2(&m_nMsgID, pbyTemp, sizeof(int));
        // Frame Format - Standard
        COPY_DATA_2(&m_nFrameFormat, pbyTemp, sizeof(short));
        // Element Name String
        char acName[MAX_PATH] = {_T('\0')};
        COPY_DATA_2(acName, pbyTemp, (sizeof(char) * MAX_PATH));
        m_omStrElementName.Format("%s", acName);
        // Type of the element val
        COPY_DATA_2(&m_nValueType, pbyTemp, sizeof(int));
        // Line type of the elemen
        COPY_DATA_2(&m_nLineType, pbyTemp, sizeof(int));
        // Line Color of the eleme
        COPY_DATA_2(&m_nLineColor, pbyTemp, sizeof(int));
        // Sample point symbol typ
        COPY_DATA_2(&m_nPointType, pbyTemp, sizeof(int));
        // Sample point symbol col
        COPY_DATA_2(&m_nPointColor, pbyTemp, sizeof(int));
        // Visible or Not
        COPY_DATA_2(&m_bVisible, pbyTemp, sizeof(BOOL));
        // Enabled or not
        COPY_DATA_2(&m_bEnabled, pbyTemp, sizeof(BOOL));

        if(byVersion == 2)
        {
            //Message Name
            char MsgName[MAX_PATH] = {_T('\0')};
            COPY_DATA_2(MsgName, pbyTemp, (sizeof(char) * MAX_PATH));
            m_strMsgName.Format("%s", MsgName);
            //Line Display type
            COPY_DATA_2(&m_eDisplayType, pbyTemp, sizeof(eDISPLAY_TYPE));
        }
        else if(byVersion == 1)
        {
            m_strMsgName = GetIMsgDB()->omStrGetMessageNameFromMsgCode(m_nMsgID);
            m_eDisplayType = eDISPLAY_NORMAL;
        }
    }

    return pbyTemp;
}
예제 #10
0
BYTE* CGraphParameters::pbySetConfigData(BYTE* pbyTrgtData, BYTE byVersion)
{
    BYTE* pbyTemp = pbyTrgtData;
    if (pbyTemp != NULL)
    {
        // Set the def
        COPY_DATA_2(&m_nBufferSize, pbyTemp, sizeof(int));
        // Display ref
        COPY_DATA_2(&m_nRefreshRate, pbyTemp, sizeof(int));
        // View Style 
        // Frame Color
        COPY_DATA_2(&m_nFrameColor, pbyTemp, sizeof(int));
        // Frame Style
        COPY_DATA_2(&m_nFrameStyle, pbyTemp, sizeof(int));
        // Plot Area C
        COPY_DATA_2(&m_nPlotAreaColor, pbyTemp, sizeof(int));
        // Grid Color
        COPY_DATA_2(&m_nGridColor, pbyTemp, sizeof(int));
        // Axis Color
        COPY_DATA_2(&m_nAxisColor, pbyTemp, sizeof(int));
        // X Grid Line
        COPY_DATA_2(&m_nXGridLines, pbyTemp, sizeof(int));
        // Y Grid Line
        COPY_DATA_2(&m_nYGridLines, pbyTemp, sizeof(int));
        // User Select
        COPY_DATA_2(&m_nActiveAxis, pbyTemp, sizeof(int));
        // User Select
        COPY_DATA_2(&m_nAction, pbyTemp, sizeof(int));
        // Grid Settin
        COPY_DATA_2(&m_bShowGrid, pbyTemp, sizeof(BOOL));
		if(byVersion == 2)
		{
			//Line Display type
			COPY_DATA_2(&m_eDisplayType, pbyTemp, sizeof(eDISPLAY_TYPE));		
		}
		else if(byVersion == 1)
		{
			m_eDisplayType = eDISPLAY_NORMAL;
		}
    }
    return pbyTemp;
}
예제 #11
0
BYTE* CGraphElement::pbySetConfigData(BYTE* pbyTrgData)
{
    BYTE* pbyTemp = pbyTrgData;
    if (pbyTemp != nullptr)
    {
        // Save properties one after another
        // Message ID
        COPY_DATA_2(&m_nMsgID, pbyTemp, sizeof(int));
        //Message Name
        char MsgName[MAX_PATH] = {'\0'};
        COPY_DATA_2(MsgName, pbyTemp, (sizeof(char) * MAX_PATH));
        m_strMsgName.Format("%s", MsgName);
        // Frame Format - Standard
        COPY_DATA_2(&m_nFrameFormat, pbyTemp, sizeof(short));
        // Element Name String
        char acName[MAX_PATH] = {'\0'};
        COPY_DATA_2(acName, pbyTemp, (sizeof(char) * MAX_PATH));
        m_omStrElementName.Format("%s", acName);
        // Type of the element val
        COPY_DATA_2(&m_nValueType, pbyTemp, sizeof(int));
        // Line type of the elemen
        COPY_DATA_2(&m_nLineType, pbyTemp, sizeof(int));
        // Line Color of the eleme
        COPY_DATA_2(&m_nLineColor, pbyTemp, sizeof(int));
        // Sample point symbol typ
        COPY_DATA_2(&m_nPointType, pbyTemp, sizeof(int));
        // Sample point symbol col
        COPY_DATA_2(&m_nPointColor, pbyTemp, sizeof(int));
        // Visible or Not
        COPY_DATA_2(&m_bVisible, pbyTemp, sizeof(BOOL));
        // Enabled or not
        COPY_DATA_2(&m_bEnabled, pbyTemp, sizeof(BOOL));
    }
    return pbyTemp;
}
예제 #12
0
HRESULT CWaveFormDataHandler::SetConfigData(BYTE* pvDataStream)
{
	m_lstSignalWaveformInfo.RemoveAll();
	m_lstTempSignalWaveformInfo.RemoveAll();

	BYTE* pByteTrgt = pvDataStream;

	if (pByteTrgt != NULL)
	{
		BYTE byVer = 0;
		COPY_DATA_2(&byVer, pByteTrgt, sizeof(BYTE));
		if (byVer == WAVEFORM_DATA_HANDLER_VERSION)
		{
			UINT nSize = 0;
			COPY_DATA_2(&nSize, pByteTrgt, sizeof(UINT));

			//Reading Messages Count.
			UINT nMsgCount = 0;
			COPY_DATA_2(&nMsgCount, pByteTrgt, sizeof(UINT));

			for(UINT i=0;i<nMsgCount;i++)
			{
				SSigGeneration objSigGeneration;
				//Reading Message ID.
				COPY_DATA_2(&objSigGeneration.m_nMsgID, pByteTrgt, sizeof(UINT));
				//Reading Default Amplitude.
				COPY_DATA_2(&objSigGeneration.m_fDefaultAmplitude, pByteTrgt, sizeof(float));

				//Reading Signal Count.
				UINT nSigCount = 0;
				COPY_DATA_2(&nSigCount, pByteTrgt, sizeof(UINT));

				for(UINT j=0;j<nSigCount;j++)
				{
					sSigWaveMap objSigWaveMap;
					objSigWaveMap.m_omSigName = _T("");

					//Reading Signal Name Size.
					BYTE bytSignalSize = 0;
					COPY_DATA_2(&bytSignalSize, pByteTrgt, sizeof(BYTE));
					
					//Reading Signal Name
					for(int k=0;k<bytSignalSize;k++)
					{
						BYTE bytTemp = 0;
						CString strTemp;
						COPY_DATA_2(&bytTemp, pByteTrgt, sizeof(BYTE));
						strTemp.Format(_T("%c"),bytTemp);
						objSigWaveMap.m_omSigName+=strTemp;
					}					
					//Reading sWaveformInfo structure.
					COPY_DATA_2(&objSigWaveMap.sWaveInfo.m_eSignalWaveType, pByteTrgt, 
								sizeof(objSigWaveMap.sWaveInfo.m_eSignalWaveType));

					COPY_DATA_2(&objSigWaveMap.sWaveInfo.m_fAmplitude, pByteTrgt, 
								sizeof(objSigWaveMap.sWaveInfo.m_fAmplitude));

					COPY_DATA_2(&objSigWaveMap.sWaveInfo.m_fFrequency, pByteTrgt, 
								sizeof(objSigWaveMap.sWaveInfo.m_fFrequency));

					COPY_DATA_2(&objSigWaveMap.sWaveInfo.m_fGranularity, pByteTrgt, 
								sizeof(objSigWaveMap.sWaveInfo.m_fGranularity));

					//Adding sSigWaveMap object to SSigGeneration
					objSigGeneration.m_omSigWaveMapList.AddTail(objSigWaveMap);
				}
				m_lstSignalWaveformInfo.AddTail(objSigGeneration);
				m_lstTempSignalWaveformInfo.AddTail(objSigGeneration);
			}
			//Storing Sampling Time period.
			COPY_DATA_2(&m_shSamplingTP, pByteTrgt, sizeof(m_shSamplingTP));			
		}
	}
	else	//Assign Default Values
	{
		m_sDefaultWaveInfo.m_eSignalWaveType = eWave_SINE;
		m_sDefaultWaveInfo.m_fAmplitude	  = 10;
		m_sDefaultWaveInfo.m_fFrequency	  = 1;
		m_shSamplingTP = 125;
	}
	return S_OK;
}
예제 #13
0
/******************************************************************************
Function Name  :  SetConfigurationData
Input(s)       :  BYTE*& pDesBuffer, UINT& unBuffSize
Output         :  HRESULT
Functionality  :
Member of      :  CTSExecutorLIB
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
HRESULT CTSExecutorLIB::SetConfigurationData(BYTE* pSrcBuffer, UINT /*unBuffSize*/)
{

    INT nFileCount = (INT)m_ouTestSetupEntityList.GetCount();

    if (pSrcBuffer != NULL)
    {
        BYTE* pbyTemp = pSrcBuffer;
        //File Path
        char acTestSuiteName[MAX_PATH] = {_T('\0')};
        COPY_DATA_2(acTestSuiteName, pbyTemp, (sizeof (char) * MAX_PATH));
        m_omstrTestSuiteName = acTestSuiteName;

        //TestSuite Status
        COPY_DATA_2(&m_bTestSuiteStatus, pbyTemp, sizeof(BOOL));

        //File Count
        COPY_DATA_2(&nFileCount, pbyTemp, sizeof(INT));
        INT nFileIndex = 0;
        for(INT i = 0; i < nFileCount; i++)
        {
            UINT unCount, unConfigCount;

            //File Path
            CString omstrFileName;
            DWORD dwID;
            char acName[MAX_PATH] = {_T('\0')};
            COPY_DATA_2(acName, pbyTemp, (sizeof (char) * MAX_PATH));
            omstrFileName = acName;
            if(AddTestSetup(omstrFileName, dwID) == S_OK)
            {
                //Selection Status
                BOOL bStatus;
                COPY_DATA_2(&bStatus, pbyTemp, sizeof(BOOL));
                POSITION pos = m_ouTestSetupEntityList.FindIndex(nFileIndex++);
                if(pos != NULL)
                {
                    CTestSetupEntity& ouTestSetupEntity = m_ouTestSetupEntityList.GetAt(pos);
                    ouTestSetupEntity.vEnableEntity(bStatus);

                    //TestCase Count
                    COPY_DATA_2(&unConfigCount, pbyTemp, sizeof(UINT));
                    ouTestSetupEntity.GetSubEntryCount(unCount);
                    if(unConfigCount != unCount)
                    {
                        //File Has Modified;
                    }

                    //TestCase Selection Status
                    for(UINT j=0; j<unCount; j++)
                    {
                        CBaseEntityTA* pTCEntity;
                        COPY_DATA_2(&bStatus, pbyTemp, sizeof(BOOL));
                        ouTestSetupEntity.GetSubEntityObj(j, &pTCEntity);
                        if(pTCEntity != NULL)
                        {
                            pTCEntity->vEnableEntity(bStatus);
                        }
                    }
                }
            }
            else
            {
                UINT unConfigCount;
                BOOL bStatus;
                COPY_DATA_2(&bStatus, pbyTemp, sizeof(BOOL));
                COPY_DATA_2(&unConfigCount, pbyTemp, sizeof(UINT));
                BOOL* bTempData = new BOOL[unConfigCount];
                COPY_DATA_2(bTempData, pbyTemp, unConfigCount*sizeof(BOOL));
                delete []bTempData;
            }
            //File Path + Selection Status + Number of TestCases + Testcases Status
        }
    }
    return S_OK;
}
예제 #14
0
BYTE* CGraphList::pbySetConfigData(BYTE* pbyTrgtData)
{
    BYTE* pbyTemp = pbyTrgtData;
    pbyTemp = m_odGraphParameters.pbySetConfigData(pbyTemp);

    // Get element count
    int nElementCount = 0;
    COPY_DATA_2(&nElementCount, pbyTemp, sizeof (int));
    
    // Load list if element count is more then 0
    if ( nElementCount > 0 )
    {
        // Temp object
        CGraphElement odTemp;
        int nExistingElements = (int)m_omElementList.GetSize();

        // Reuse existing items in the list
        
        // Add / remove extra items
        if( nElementCount > nExistingElements )
        {
            // Add Extra Elements
            for( int nIndex = nExistingElements;
                    nIndex < nElementCount; nIndex++)
            {
                // Add Dummy Element
                m_omElementList.Add( odTemp );
            }
        }
        // Delete extra elements
        else if (nElementCount <  nExistingElements )
        {
            // Get the extra elements count
            int nDifference = nExistingElements - nElementCount;
            // Remove extra elements. Removing it from the list.
            // Remove the head element instead of any other index.
            // Because list index might become invalid if the
            // size of the list after deletion comes below the
            // index value
            for( int nIndex = 0; nIndex < nDifference; nIndex++ )
            {
                // Remove the first element
                m_omElementList.RemoveAt( 0 );
            }
        }

        // Now populate list
        for( int nIndex = 0; nIndex < nElementCount;
                nIndex++ )
        {
            // Read element from the archive
            pbyTemp =
                m_omElementList[ nIndex ].pbySetConfigData( pbyTemp );
        }
    }
    else
    {
        // Clear list
        m_omElementList.RemoveAll();
    }

    return pbyTemp;
}
예제 #15
0
BYTE* CTxWndDataStore::pbySetConfigData(BYTE* pbyConfigData, INT /*nConfigSize*/)
{
    BYTE* pbyTemp = pbyConfigData;
    vReleaseMultiMsgInfo(m_psMsgBlockList);
    m_psMsgBlockList = NULL;
    PSMSGBLOCKLIST psBlockTail = NULL;
    m_unNumberOfMsgBlockCount = 0;

    if (pbyTemp != NULL)
    {
        BYTE byVersion = 0;
        COPY_DATA_2(&byVersion, pbyTemp, sizeof(BYTE));
        int nVersion = (int)byVersion;

        COPY_DATA_2(&m_unNumberOfMsgBlockCount, pbyTemp, sizeof(UINT));


        for (UINT i = 0; i < m_unNumberOfMsgBlockCount; i++)
        {
            PSMSGBLOCKLIST psTempBlock = new SMSGBLOCKLIST;
            char acName[MAX_PATH] = {_T('\0')};
            COPY_DATA_2(acName, pbyTemp, (sizeof(char) * MAX_PATH));
            strcpy_s(psTempBlock->m_acStrBlockName, defBLOCKNAME_SIZE, acName);
            COPY_DATA_2(&(psTempBlock->m_ucTrigger),pbyTemp,  sizeof(UCHAR));
            COPY_DATA_2(&(psTempBlock->m_bActive), pbyTemp, sizeof(BOOL));
            COPY_DATA_2(&(psTempBlock->m_ucKeyValue), pbyTemp, sizeof(UCHAR));
            COPY_DATA_2(&(psTempBlock->m_unTimeInterval), pbyTemp, sizeof(UINT));
            COPY_DATA_2(&(psTempBlock->m_bType), pbyTemp, sizeof(BOOL));
            COPY_DATA_2(&(psTempBlock->m_bTxAllFrame), pbyTemp, sizeof(BOOL));

            COPY_DATA_2(&(psTempBlock->m_unMsgCount), pbyTemp, sizeof(UINT));
            PSTXCANMSGLIST psTxCanMsgTail = NULL;
            for (UINT j = 0; j < psTempBlock->m_unMsgCount; j++)
            {
                PSTXCANMSGLIST psTempCanList = new STXCANMSGLIST;
                COPY_DATA_2(&(psTempCanList->m_sTxMsgDetails), pbyTemp, sizeof (STXCANMSGDETAILS));
                if (psTempBlock->m_psTxCANMsgList == NULL)//For the first time
                {
                    psTxCanMsgTail = psTempBlock->m_psTxCANMsgList = psTempCanList;
                }
                else
                {
                    psTxCanMsgTail->m_psNextMsgDetails = psTempCanList;
                    psTxCanMsgTail = psTempCanList;
                }
            }
            if (m_psMsgBlockList == NULL)//For the first time
            {
                psBlockTail = m_psMsgBlockList = psTempBlock;
            }
            else
            {
                psBlockTail->m_psNextMsgBlocksList = psTempBlock;
                psBlockTail = psTempBlock;
            }
        }
        //Get the Tx window placement
        WINDOWPLACEMENT WndPlacement;
        COPY_DATA_2(&WndPlacement, pbyTemp, sizeof (WINDOWPLACEMENT));
        bSetTxData(TX_WINDOW_PLACEMENT, &WndPlacement);
        //Get the Tx splitter position
        STXMSGSPLITTERDATA sTxSpliiterData;
        COPY_DATA_2(&sTxSpliiterData, pbyTemp,  sizeof(STXMSGSPLITTERDATA));
        bSetTxData(TX_WND_SPLITTER_DATA, &sTxSpliiterData);

        if(nVersion >= 2)
        {
            COPY_DATA_2(&m_bAutoSavedEnabled, pbyTemp,  sizeof(bool));
            bSetTxData(TX_AUTO_UPDATE_ENABLE, &m_bAutoSavedEnabled);        //save the status of auto save
        }
    }
    return pbyTemp;
}