void CTxMsgWndJ1939::vProcessTransmission(BOOL bStart)
{
    m_CS_CyclicTrans.Lock();


    CString omWndText = bStart ? _T("Stop") : _T("Transmit");
    CButton* pButton = (CButton*)GetDlgItem(IDC_SEND);
    pButton->SetWindowText(omWndText);
    if (bStart == TRUE)
    {
        GetDlgItem(IDC_RADIO_TPF)->EnableWindow(FALSE);
        GetDlgItem(IDC_RADIO_NM)->EnableWindow(FALSE);
        vEnableTpfFields(FALSE);
        vEnableTpfFields(FALSE);
        m_omCheckCyclic.EnableWindow(FALSE);
        m_omMiliSecs.EnableWindow(FALSE);
        vSetTransState(TRANS_STARTED);
    }
    else
    {
        //First set the event sg_hMsgStopped if it is waiting
        SetEvent(sg_hMsgStopped);
        GetDlgItem(IDC_RADIO_TPF)->EnableWindow(TRUE);
        GetDlgItem(IDC_RADIO_NM)->EnableWindow(TRUE);
        pButton = (CButton*)GetDlgItem(IDC_RADIO_TPF);
        if (pButton->GetCheck() == BST_CHECKED)
        {
            vEnableTpfFields(TRUE);
            vEnableNmFields(FALSE);
            m_omCheckCyclic.EnableWindow(TRUE);
            if (m_omCheckCyclic.GetCheck() == BST_CHECKED)
            {
                m_omMiliSecs.EnableWindow(TRUE);
            }
        }
        else
        {
            vEnableTpfFields(FALSE);
            vEnableNmFields(TRUE);
            m_omCheckCyclic.EnableWindow(FALSE);
            m_omMiliSecs.EnableWindow(FALSE);
        }
        vSetTransState(TRANS_STOPPED);
    }

    m_CS_CyclicTrans.Unlock();

}
Beispiel #2
0
BOOL CTxMsgWndJ1939::OnInitDialog()
{
    CDialog::OnInitDialog();
    // TODO:  Add extra initialization here


    m_omCheckCyclic.SetCheck(BST_UNCHECKED);
    m_omMiliSecs.vSetBase(BASE_DECIMAL);
    m_omMiliSecs.vSetSigned(false);
    m_omMiliSecs.vSetValue(100);
    m_omMiliSecs.EnableWindow(FALSE);

    vInitializeTpfFields();


    vInitializeNmFields();

    vEnableTpfFields(FALSE);
    vEnableNmFields(TRUE);

    m_omCheckCyclic.EnableWindow(FALSE);
    m_omMiliSecs.EnableWindow(FALSE);

    GetDlgItem(IDC_SEND)->EnableWindow(false);
    return TRUE;
}
void CTxMsgWndJ1939::OnBnClickedRadioTpf()
{
    m_bNM = FALSE;
    ((CButton*)GetDlgItem(IDC_RADIO_NM))->SetCheck(BST_UNCHECKED);
    vEnableNmFields(FALSE);
    vEnableTpfFields(TRUE);
    m_omCheckCyclic.EnableWindow(TRUE);
    OnBnClickedCheckCyclic();
    //Update according to the Msg type.
    OnCbnSelchangeComboMsgtype();
}
void CTxMsgWndJ1939::OnBnClickedRadioNm()
{
    m_bNM = TRUE;
    ((CButton*)GetDlgItem(IDC_RADIO_TPF))->SetCheck(BST_UNCHECKED);
    ((CButton*)GetDlgItem(IDC_CLAIM_ADDRESS))->SetCheck(BST_CHECKED);
    vEnableNmFields(TRUE);
    vEnableTpfFields(FALSE);
    m_omCheckCyclic.SetCheck(BST_UNCHECKED);
    m_omCheckCyclic.EnableWindow(FALSE);
    m_omMiliSecs.EnableWindow(FALSE);
}