/******************************************************************************* Function Name : vPopulateElementList Input(s) : - Output : - Functionality : This function will read global element list and will update element UI list control Member of : CSigGrphConfigDlg Author(s) : ArunKumar K Date Created : 27-10-2010 Modifications : *******************************************************************************/ void CSigGrphConfigDlg::vPopulateElementList() { // Get Element List from Main Frame CGraphList* podList = NULL; // Remove All items in the list m_omSignalList.DeleteAllItems(); // Get List pointer podList = &(m_pMainFrame->m_odGraphList[m_omCmbBusType.GetCurSel()]); // Get Database Pointer CMsgSignal* pomDatabase = theApp.m_pouMsgSignal; CGraphElement odTemp; if( podList != NULL && pomDatabase != NULL ) { UINT unMsgID = 0; CString omStrName; int nItemCount = podList->m_omElementList.GetSize(); // Add items to the list for( int nIndex = 0; nIndex < nItemCount; nIndex++ ) { odTemp = podList->m_omElementList[ nIndex ]; // Statistics Parameter if( odTemp.m_nValueType == eSTAT_PARAM ) { // Insert Category m_omSignalList.InsertItem( nIndex, defSTR_STATISTICS_NAME); // Insert element name m_omSignalList.SetItemText( nIndex, 1, odTemp.m_omStrElementName ); // Insert Channel String CString omStrChannel; omStrChannel.Format( defSTR_CHANNEL_NAME_FORMAT, defSTR_CHANNEL_NAME, odTemp.m_nFrameFormat ); m_omSignalList.SetItemText( nIndex, 2, omStrChannel ); // Set Color of the entry m_omSignalList.SetItemData( nIndex, odTemp.m_nLineColor ); } else { unMsgID = odTemp.m_nMsgID; // Get Message Name omStrName = pomDatabase->omStrGetMessageNameFromMsgCode( unMsgID ); // Add Element Catogory m_omSignalList.InsertItem( nIndex, omStrName ); // Add Element Name m_omSignalList.SetItemText( nIndex, 1, odTemp.m_omStrElementName ); // Set Color of the entry m_omSignalList.SetItemData( nIndex, odTemp.m_nLineColor ); // Add Value Type if( odTemp.m_nValueType == eRAW_VALUE ) { m_omSignalList.SetItemText( nIndex, 2, defSTR_RAW_VALUE ); } else { m_omSignalList.SetItemText( nIndex, 2, defSTR_PHY_VALUE ); } } } } }
void CTxMsgListView::vUpdateMsgListDisplay(sTXCANMSGDETAILS sMsgDetail, INT nCurrentIndex) { CString omStrMsgID( "" ); CString omStrMsgData( "" ); CString omStrMsgType( "" ); CString omStrDLC( "" ); CString omStrChannel( "" ); INT nIndex = -1; UINT unImageID = 0; CString omStrFormat( "" ); CString omStrMsgName( "" ); // Set Edit flag to TRUE m_bInitDlg = TRUE; // format the message data length // Get the base and accordingly change the format for Format function of // CString class. if( TRUE == CTxMsgManager::s_TxFlags.nGetFlagStatus(TX_HEX) ) { omStrMsgID.Format(defFORMAT_MSGID_HEX,sMsgDetail.m_sTxMsg.m_unMsgID); omStrFormat = defFORMAT_DATA_HEX; } else { omStrMsgID.Format( defFORMAT_MSGID_DECIMAL, sMsgDetail.m_sTxMsg.m_unMsgID ); omStrFormat = defFORMAT_DATA_DECIMAL; } // Message Details View CTxMsgDetailsView* pomDetailsView = nullptr; CMsgSignal* pDBptr = nullptr; pomDetailsView = (CTxMsgDetailsView*)pomGetDetailsViewPointer(); if (nullptr != pomDetailsView) { pDBptr = pomDetailsView->m_pouDBPtr; } CString omStrUpdatedMsgLength = ""; // See if the msg ID is in the database // If yes load appropriate image if (nullptr != pDBptr) { omStrMsgName = pDBptr->omStrGetMessageNameFromMsgCode(sMsgDetail.m_sTxMsg.m_unMsgID); //omStrUpdatedMsgLength = pDBptr->omStrGetMessageLengthFromMsgCode(sMsgDetail.m_sTxMsg.m_unMsgID); } if ( omStrMsgName.IsEmpty() == FALSE ) { unImageID = 1;// Database Image // Add message Name with the entry omStrMsgID += " [" + pDBptr->omStrGetMessageNameFromMsgCode(sMsgDetail.m_sTxMsg.m_unMsgID ) + "]"; } else { unImageID = 2;// Non-Database image } // Format channel ID omStrChannel.Format("%d", sMsgDetail.m_sTxMsg.m_ucChannel ); // Format Message Type omStrFormat.Insert(omStrFormat.GetLength(),defEMPTY_CHAR); CString omStrTemp = ""; for(INT i=0; i<sMsgDetail.m_sTxMsg.m_ucDataLen; i++) { omStrTemp.Format(omStrFormat,sMsgDetail.m_sTxMsg.m_ucData[i]); omStrMsgData += omStrTemp; } // Format the Message type if(sMsgDetail.m_sTxMsg.m_ucEXTENDED == TRUE) { omStrMsgType = defMSGID_EXTENDED; } else { omStrMsgType = defMSGID_STD; } if(sMsgDetail.m_sTxMsg.m_ucRTR == TRUE) { omStrMsgType += defMSGID_RTR; } // Format the DLC omStrDLC.Format("%d",sMsgDetail.m_sTxMsg.m_ucDataLen); // Get the current count if this is new items and insert it // as new item. Otherwise set the current item text. if(nCurrentIndex == -1) { INT nCount = m_omLctrMsgList.GetItemCount(); if(nCount != -1 ) { nIndex = m_omLctrMsgList. InsertItem(nCount,omStrMsgID,unImageID); } } else { LVITEM sItem; sItem.mask = LVIF_IMAGE; sItem.iItem = nCurrentIndex; sItem.iSubItem = defMAIN_ITEM; sItem.iImage = unImageID; m_omLctrMsgList. SetItemText(nCurrentIndex,defMAIN_ITEM,omStrMsgID); m_omLctrMsgList.SetItem(&sItem); nIndex = nCurrentIndex; } // Set the list control item with string formatted for each column. if(nIndex != -1 ) { // Update Channel ID m_omLctrMsgList.SetItemText( nIndex, defSUBITEM_MSGDETAILS_CHANNEL_ID, omStrChannel ); // Update Message Type m_omLctrMsgList.SetItemText( nIndex, defSUBITEM_MSGDETAILS_TYPE, omStrMsgType ); // Update Message Length m_omLctrMsgList.SetItemText( nIndex, defSUBITEM_MSGDETAILS_DLC, omStrDLC ); // Update Data Bytes with Dirty Flag if( sMsgDetail.m_bIsMsgDirty == TRUE && unImageID == 1 && sMsgDetail.m_sTxMsg.m_ucDataLen > 0 ) { omStrMsgData +=defASSETRIC; } m_omLctrMsgList.SetItemText( nIndex, defSUBITEM_MSGDETAILS_DATA, omStrMsgData); // Update Check box status m_omLctrMsgList.SetCheck( nIndex, sMsgDetail.m_bEnabled ); } // Set Edit flag to FALSE m_bInitDlg = FALSE; }