void CTxMsgWndJ1939::vSetDatabaseInfo(const SMSGENTRY* psMsgEntry) { m_CS_ConfigData.Lock(); SMSGENTRY::vClearMsgList(m_psMsgRoot); const SMSGENTRY* psTemp = psMsgEntry; while (psTemp != NULL) { SMSGENTRY::bUpdateMsgList(m_psMsgRoot, psTemp->m_psMsg); psTemp = psTemp->m_psNext; } vPopulatePGNComboBox(); // Refreshing Msg type Combo for the selected PGN INT nCurrCursel = m_omComboPGN.GetCurSel(); if(nCurrCursel != -1) { CString omPGN; m_omComboPGN.GetLBText(nCurrCursel, omPGN); UINT unPGN = unGetMsgIDFromName(omPGN); vVerifyPDUFormatInPGN(unPGN); if(m_omMsgTypeCombo.GetCount() > 0) { m_omMsgTypeCombo.SetCurSel(0); } } m_CS_ConfigData.Unlock(); }
/** * \brief Called when editing PGN combobox * \param[in] void * \return void * \authors Arunkumar Karri * \date 17.07.2012 Created */ void CTxMsgWndJ1939::OnCbnEditChangeComboPgn() { CString omPGN; m_omComboPGN.GetWindowText(omPGN); UINT unPGN = 0; sscanf((LPCTSTR)omPGN, "%04X", &unPGN); /* Verify PGN and update message type accordingly */ vVerifyPDUFormatInPGN(unPGN); }
/** * @brief Called when editing PGN combobox * * Called when editing PGN combobox */ void CTxMsgWndJ1939::OnCbnEditChangeComboPgn() { CString omPGN; m_omComboPGN.GetWindowText(omPGN); UINT unPGN = 0; sscanf((LPCTSTR)omPGN, "%04X", &unPGN); /* If its a valid PGN */ if ( omPGN.GetLength() > 2 ) { m_omTOEdit.vSetValue((BYTE)unPGN); } else { m_omTOEdit.vSetValue(0); } /* Verify PGN and update message type accordingly */ vVerifyPDUFormatInPGN(unPGN); }
void CTxMsgWndJ1939::OnCbnSelchangeComboPgn() { //PGN value CString omPGN; INT nIndex = m_omComboPGN.GetCurSel(); if (nIndex != -1) { m_omComboPGN.GetLBText(nIndex, omPGN); UINT unPGN = unGetMsgIDFromName(omPGN); vVerifyPDUFormatInPGN(unPGN); sMESSAGE* psMsg = NULL; if (SMSGENTRY::bGetMsgPtrFromMsgId(m_psMsgRoot, unPGN, psMsg) == TRUE) { if (psMsg != NULL) { m_omDLCEdit.vSetValue(psMsg->m_unMessageLength); m_omTOEdit.vSetValue((BYTE)unPGN); for (UINT i = 0; i < psMsg->m_unMessageLength; i++) { m_omMsgDataEditVal += _T("00"); } CString omText; m_omMsgDataEdit.GetWindowText(omText); if (omText.IsEmpty() == TRUE) { m_omMsgDataEdit.vSetValue(0); m_omMsgDataEdit.SetWindowText(m_omMsgDataEditVal); } } } UpdateData(TRUE); } }
void CTxMsgWndJ1939::vInitializeTpfFields(void) { //Set the properties first m_omDLCEdit.vSetBase(BASE_DECIMAL); m_omMsgDataEdit.vSetBase(BASE_HEXADECIMAL); m_omDLCEdit.vSetSigned(false); m_omMsgDataEdit.vSetSigned(false); m_omPriorityEdit.vSetBase(BASE_HEXADECIMAL); m_omPriorityEdit.vSetSigned(true); m_omPriorityEdit.LimitText(1); m_omFromEdit.vSetBase(BASE_HEXADECIMAL); m_omFromEdit.vSetSigned(true); m_omFromEdit.LimitText(2); m_omTOEdit.vSetBase(BASE_HEXADECIMAL); m_omTOEdit.vSetSigned(true); m_omTOEdit.LimitText(2); //Initialize with default values LPARAM lParam; GetICANDIL()->DILC_GetControllerParams(lParam, 0, NUMBER_HW); for (INT_PTR i = 0; i < lParam; i++) { CString omChannel; omChannel.Format("%d", i + 1); m_omComboChannel.InsertString(i, omChannel); } m_omComboChannel.SetCurSel(0); //Populate PGN combo box if ((m_psMsgRoot != NULL) && (m_psMsgRoot->m_psMsg != NULL)) { // If atleast one database message is present m_CS_ConfigData.Lock(); vPopulatePGNComboBox(); m_omMsgTypeCombo.SetCurSel(0); } else { m_omComboPGN.SetWindowText("0"); vVerifyPDUFormatInPGN(0); } //Calling this to update the message type combobox OnCbnSelchangeComboPgn(); m_omMsgTypeCombo.SetCurSel(0); // Refreshing Msg type Combo for the selected PGN INT nCurrCursel = m_omComboPGN.GetCurSel(); if(nCurrCursel != -1) { CString omPGN; m_omComboPGN.GetLBText(nCurrCursel, omPGN); UINT unPGN = unGetMsgIDFromName(omPGN); vVerifyPDUFormatInPGN(unPGN); if(m_omMsgTypeCombo.GetCount() > 0) { m_omMsgTypeCombo.SetCurSel(0); } } m_omPriorityEdit.vSetValue(DEFAULT_PRIORITY); m_omFromEdit.vSetValue(m_sClientParams.m_byAddress); m_omTOEdit.vSetValue(ADDRESS_ALL); m_omDLCEdit.vSetValue(0x3); m_omMsgDataEdit.vSetValue(0); UpdateData(TRUE); }