Ejemplo n.º 1
0
void CConfigMsgLogDlg::OnBnClickedCbtnAddlog(void)
{
    USES_CONVERSION;

    // Get unique log file name with full path.
    CString omFilePathNewLog = GetUniqueLogFilePath();

    // Add the new logging object in the datastore.
    SLOGINFO sLogStruct;
    //Select All CAN channels
    sLogStruct.m_ChannelSelected = CAN_CHANNEL_ALL;
    strcpy_s(sLogStruct.m_sLogFileName, _MAX_PATH, omFilePathNewLog.GetBuffer(_MAX_PATH));
    AddLoggingBlock(sLogStruct);

    // Added in data store updated. Now do the same in the GUI
    // Insert this item into the list and select the same. Naturally item index
    // will be 1 less than the total number of logging blocks.
    m_nLogIndexSel = GetLoggingBlockCount() - 1;
    AddNewItem_GUI(sLogStruct, m_nLogIndexSel);

    // Select this item
    m_omListLogFiles.SetItemState(m_nLogIndexSel, LVIS_SELECTED | LVIS_FOCUSED,
                                  LVIS_SELECTED | LVIS_FOCUSED);

    //EnablingAdvSettings(FALSE);
}
Ejemplo n.º 2
0
void CConfigMsgLogDlg::OnBnClickedCbtnRemovelog(void)
{
    m_bUpdatingUI = TRUE;
    RemoveLoggingBlock((USHORT) m_nLogIndexSel);
    m_omListLogFiles.DeleteItem(m_nLogIndexSel);
    m_bUpdatingUI = FALSE;

    if (GetLoggingBlockCount() > 0)
    {
        m_nLogIndexSel = 0;
        m_omListLogFiles.SetItemState(m_nLogIndexSel,
                                      LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
    }
    else
    {
        m_nLogIndexSel = -1;
        vEnableDisableControls(FALSE);
    }

    ASSERT(GetLoggingBlockCount() == m_omListLogFiles.GetItemCount());
}
Ejemplo n.º 3
0
HRESULT CFrameProcessor_CAN::FPC_ApplyFilters( const SFILTERAPPLIED_CAN& sFilterObj )
{
    UINT unLogCount = GetLoggingBlockCount();

    for ( USHORT i = 0; i < unLogCount; i++ )
    {
        SFILTERAPPLIED_CAN sFilterCan;
        FPC_GetFilteringScheme( i, sFilterCan );
        Filter_ReUpdateAppliedFilter( &sFilterCan, &sFilterObj, CAN );
        FPC_ApplyFilteringScheme( i, sFilterCan );
    }
    return S_OK;
}
void CFrameProcessor_Common::vUpdateLoggingFlag(void)
{
    BYTE* pbCurrFlag = m_bEditingON ? &m_bLogFlagTmp : &m_bExprnFlag_Log;

    CLEAR_EXPR_FLAG(*pbCurrFlag);

    USHORT ushLogBlocks = GetLoggingBlockCount();

    for (USHORT i = 0; i < ushLogBlocks; i++)
    {
        SLOGINFO sLogInfo;
        GetLoggingBlock(i, sLogInfo);
        if (sLogInfo.m_bEnabled == FALSE)
        {
            continue;
        }

        BYTE* pbResFlag = sLogInfo.m_bResetAbsTimeStamp ? &m_bLogFlagTmp : &m_bExprnFlag_Log;

        switch (sLogInfo.m_eLogTimerMode)
        {
            case TIME_MODE_ABSOLUTE:
                SET_TM_ABS(*pbCurrFlag);
                SET_TM_ABS_RES(*pbResFlag);
                break;

            case TIME_MODE_RELATIVE:
                SET_TM_REL(*pbCurrFlag);
                break;

            case TIME_MODE_SYSTEM:
                SET_TM_SYS(*pbCurrFlag);
                break;
        }

        switch (sLogInfo.m_eNumFormat)
        {
            case HEXADECIMAL:
                SET_NUM_HEX(*pbCurrFlag);
                break;

            case DEC:
                SET_NUM_DEC(*pbCurrFlag);
                break;
        }
    }
}
UINT CFrameProcessor_Common::unGetBufSize(void)
{
    UINT unBufSize = sizeof(BYTE);  // Version information
    unBufSize += sizeof(USHORT);    // Logging blocks

    USHORT ushLogBlks = GetLoggingBlockCount();
    for (USHORT i = 0; i < ushLogBlks; i++)
    {
        CBaseLogObject* pouCurrLogObj = FindLoggingBlock(i);
        if (NULL != pouCurrLogObj)
        {
            unBufSize += pouCurrLogObj->unGetBufSize();
        }
    }

    return unBufSize;
}
Ejemplo n.º 6
0
void CConfigMsgLogDlg::OnBnClickedCbtnLogFilePath(void)
{
    USES_CONVERSION;

    CString omStrLogFile = "";
    (GetDlgItem(IDC_EDIT_LOGFILEPATH))->GetWindowText(omStrLogFile);

    // Show File Selection Dialog to select Log File
    CFileDialog omFileDlg(FALSE, BUSMASTER_LOG_FILE_EXTENSION, omStrLogFile,
                          OFN_HIDEREADONLY | OFN_PATHMUSTEXIST |
                          OFN_EXTENSIONDIFFERENT | OFN_OVERWRITEPROMPT,
                          BUSMASTER_LOG_FILTER, nullptr);
    // Set the caption
    omFileDlg.m_ofn.lpstrTitle = _(BUSMASTER_LOG_SELECTION_TITLE);

    const int nSize = _MAX_PATH  * _MAX_PATH;  //Total 260 Files
    char* szTempBuf = new char[nSize];
    memset(szTempBuf, 0, sizeof(char) * nSize);
    omFileDlg.m_ofn.lpstrFile = szTempBuf;
    omFileDlg.m_ofn.nMaxFile = nSize - 1;
    // Show File open dialog
    if (omFileDlg.DoModal() == IDOK)
    {
        omStrLogFile = omFileDlg.GetPathName();
        for (USHORT i = 0; i < GetLoggingBlockCount(); i++)
        {
            SLOGINFO sLogObject;
            GetLoggingBlock(i, sLogObject);
            if (_tcsicmp(sLogObject.m_sLogFileName, omStrLogFile.GetBuffer(MAX_PATH)) == 0)
            {
                CString omBuf;
                omBuf.Format(_(BUSMASTER_LOG_ALREADYEXISTS), omStrLogFile);
                MessageBox(omBuf, "BUSMASTER", MB_OK | MB_ICONINFORMATION);
                return;
            }
        }
        (GetDlgItem(IDC_EDIT_LOGFILEPATH))->SetWindowText(omStrLogFile);
        m_omListLogFiles.SetItemText(m_nLogIndexSel, 0, omStrLogFile);
        vUpdate_Datastore_From_GUI((USHORT) m_nLogIndexSel, IDC_EDIT_LOGFILEPATH);
        vResetAdvLogParameters();
        vAddSuffixToLogFileName(SUFFIX_DEFAULT);
    }

    delete[]szTempBuf;

}
Ejemplo n.º 7
0
BOOL CConfigMsgLogDlg::FoundInLogList(CString omFullPath, CString omFileName)
{
    BOOL Found = FALSE;
    USHORT TotalLogBlocks = GetLoggingBlockCount();

    for (USHORT i = 0; (i < TotalLogBlocks) && (Found == FALSE); i++)
    {
        SLOGINFO sLogObjTmp; // Iterate through the logging list in the
        GetLoggingBlock(i, sLogObjTmp); // datastore
        CString omCurrLogFile = sLogObjTmp.m_sLogFileName; // and retrieve
        // the log file name
        // Subject to its content type (whether bare log file name or the
        // full path), the comparison will be carried out.
        CString omCompareStr = (omCurrLogFile.Find(_T("\\")) != -1) ?
                               omFullPath : omFileName;
        Found = (omCurrLogFile.CompareNoCase(omCompareStr) == 0);
    }

    return Found;
}
Ejemplo n.º 8
0
void CConfigMsgLogDlg::OnBnClickedCbtnLogFilePath(void)
{
    USES_CONVERSION;
    CString omStrLogFile = "";
    (GetDlgItem(IDC_EDIT_LOGFILEPATH))->GetWindowText(omStrLogFile);
    // Show File Selection Dialog to select Log File
    CFileDialog omFileDlg(FALSE, BUSMASTER_LOG_FILE_EXTENSION, omStrLogFile,
                          OFN_HIDEREADONLY | OFN_PATHMUSTEXIST |
                          OFN_EXTENSIONDIFFERENT | OFN_OVERWRITEPROMPT,
                          BUSMASTER_LOG_FILTER, NULL);
    // Set the caption
    omFileDlg.m_ofn.lpstrTitle = BUSMASTER_LOG_SELECTION_TITLE;

    // Show File open dialog
    if (omFileDlg.DoModal() == IDOK)
    {
        omStrLogFile = omFileDlg.GetPathName();

        for (USHORT i = 0; i < GetLoggingBlockCount(); i++)
        {
            SLOGINFO sLogObject;
            GetLoggingBlock(i, sLogObject);

            if (_tcsicmp(sLogObject.m_sLogFileName, omStrLogFile.GetBuffer(MAX_PATH)) == 0)
            {
                CString omBuf;
                omBuf.Format(BUSMASTER_LOG_ALREADYEXISTS, omStrLogFile);
                AfxMessageBox(omBuf, MB_OK | MB_ICONINFORMATION);
                return;
            }
        }

        (GetDlgItem(IDC_EDIT_LOGFILEPATH))->SetWindowText(omStrLogFile);
        m_omListLogFiles.SetItemText(m_nLogIndexSel, 0, omStrLogFile);
        vUpdate_Datastore_From_GUI((USHORT) m_nLogIndexSel, IDC_EDIT_LOGFILEPATH);
    }
}
Ejemplo n.º 9
0
BOOL CConfigMsgLogDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    m_ChkbEnableLogOnConnect.SetCheck(m_bLogOnConnect == TRUE? BST_CHECKED : BST_UNCHECKED);
    m_odStartMsgID.vSetConfigData(IDC_EDIT_STARTMSGID);
    m_odStopMsgID.vSetConfigData(IDC_EDIT_STOPMSGID);
    m_odStartMsgID.vSetBase(BASE_HEXADECIMAL);
    m_odStopMsgID.vSetBase(BASE_HEXADECIMAL);
    m_odStartMsgID.vSetSigned(false);
    m_odStopMsgID.vSetSigned(false);

    vCreateFileList();
    InitialiseWindow();

    USHORT LogBlocks = GetLoggingBlockCount();
    if (LogBlocks > 0)
    {
        for (USHORT i = 0; i < LogBlocks; i++)
        {
            SLOGINFO sLogObject;
            HANDLE hFind;
            WIN32_FIND_DATA FindData;
            CStdioFile omStdiofile;

            GetLoggingBlock(i, sLogObject);

            // check for valid log file
            CString strTempLog = sLogObject.m_sLogFileName;

            hFind = FindFirstFile(strTempLog, &FindData);

            if(hFind == INVALID_HANDLE_VALUE )//file not found
            {
                DWORD dError = GetLastError();
                if(dError == ERROR_FILE_NOT_FOUND)//file not found
                {
                    BOOL bFileOpen = omStdiofile.Open(strTempLog,
                                                      CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);

                    if(bFileOpen == TRUE)///file created, add in the list
                    {
                        omStdiofile.Close();
                        AddNewItem_GUI(sLogObject, i);
                    }
                    else //not a valid file
                    {
                        RemoveLoggingBlock(i--); //remove the old log data
                        LogBlocks = GetLoggingBlockCount(); //refresh the log count
                    }
                }
                else //not a valid filepath / file folder is removed
                {
                    RemoveLoggingBlock(i--); //remove the old log data
                    LogBlocks = GetLoggingBlockCount(); //refresh the log count
                }
            }
            else ///file found add in the list
            {
                AddNewItem_GUI(sLogObject, i);
            }

        }
        m_nLogIndexSel = 0;
        if(m_omListLogFiles.GetItemCount() > 0 )//check for log files exists
        {
            m_omListLogFiles.SetItemState(m_nLogIndexSel,
                                          LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
        }
        else
        {
            vEnableDisableControls(FALSE);//disable controls if no log files exists
        }
    }
    else
    {
        vEnableDisableControls(FALSE);
    }

    SetWindowText(m_strCurrWndText);

    if (m_bLogON)
    {
        vEnableDisableControls(FALSE);

        if(m_omListLogFiles.GetItemCount()>0)
        {
            vUpdate_GUI_From_Datastore(0);
        }

        GetDlgItem(IDC_CBTN_ADDLOG)->EnableWindow(FALSE);
        GetDlgItem(IDC_CHECK_RESET_TIMESTAMP)->EnableWindow(FALSE);
        GetDlgItem(IDC_EDIT_NO_OF_FILES)->EnableWindow(FALSE);
        GetWindowText(m_strCurrWndText);
        m_strCurrWndText+=_(" - Read Only as Logging is ON");
        SetWindowText(m_strCurrWndText);

        // If Logging is on
        GetDlgItem(IDOK)->EnableWindow(FALSE);

        m_unDispUpdateTimerId = SetTimer(600, 600, nullptr);
    }
    else
    {
        // If Logging is on
        GetDlgItem(IDOK)->EnableWindow(TRUE);
    }

    // Hide or show the Filters button in the dialog based on the protocol

    GetDlgItem(IDC_LOG_FILTER)->ShowWindow(SW_SHOWNORMAL);

    /*if (J1939 == m_eCurrBus)
    {
        GetDlgItem(IDC_LOG_FILTER)->ShowWindow(0);
    }*/

    return TRUE;
}
Ejemplo n.º 10
0
BOOL CConfigMsgLogDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    m_ChkbEnableLogOnConnect.SetCheck(m_bLogOnConnect == TRUE? BST_CHECKED : BST_UNCHECKED);
    m_odStartMsgID.vSetConfigData(IDC_EDIT_STARTMSGID);
    m_odStopMsgID.vSetConfigData(IDC_EDIT_STOPMSGID);
    m_odStartMsgID.vSetBase(BASE_HEXADECIMAL);
    m_odStopMsgID.vSetBase(BASE_HEXADECIMAL);
    m_odStartMsgID.vSetSigned(false);
    m_odStopMsgID.vSetSigned(false);

    vCreateFileList();
    //Load channel combo box
    m_omComboChannel.ResetContent();
    if (NULL != GetICANDIL())
    {
        LPARAM lParam = 0;
        if (S_OK == GetICANDIL()->DILC_GetControllerParams(lParam, NULL, NUMBER_HW))
        {
            m_unChannelCount = (UINT)lParam;
        }
    }

    m_omComboChannel.InsertString(0, _("ALL"));
    for (UINT i = 1; i <= m_unChannelCount; i++)
    {
        CString omChannel;
        omChannel.Format("%d", i);
        m_omComboChannel.InsertString(i, omChannel.GetBuffer(MAX_PATH));
    }
    m_omComboChannel.SetCurSel(0);

    USHORT LogBlocks = GetLoggingBlockCount();
    if (LogBlocks > 0)
    {
        for (USHORT i = 0; i < LogBlocks; i++)
        {
            SLOGINFO sLogObject;
            HANDLE hFind;
            WIN32_FIND_DATA FindData;
            CStdioFile omStdiofile;

            GetLoggingBlock(i, sLogObject);

            // check for valid log file
            CString strTempLog = sLogObject.m_sLogFileName;

            hFind = FindFirstFile(strTempLog, &FindData);

            if(hFind == INVALID_HANDLE_VALUE )//file not found
            {
                DWORD dError = GetLastError();
                if(dError == ERROR_FILE_NOT_FOUND)//file not found
                {
                    BOOL bFileOpen = omStdiofile.Open(strTempLog,
                                                      CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);

                    if(bFileOpen == TRUE)///file created, add in the list
                    {
                        omStdiofile.Close();
                        AddNewItem_GUI(sLogObject, i);
                    }
                    else //not a valid file
                    {
                        RemoveLoggingBlock(i--); //remove the old log data
                        LogBlocks = GetLoggingBlockCount(); //refresh the log count
                    }
                }
                else //not a valid filepath / file folder is removed
                {
                    RemoveLoggingBlock(i--); //remove the old log data
                    LogBlocks = GetLoggingBlockCount(); //refresh the log count
                }
            }
            else ///file found add in the list
            {
                AddNewItem_GUI(sLogObject, i);
            }

        }
        m_nLogIndexSel = 0;
        if(m_omListLogFiles.GetItemCount() > 0 )//check for log files exists
        {
            m_omListLogFiles.SetItemState(m_nLogIndexSel,
                                          LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
        }
        else
        {
            vEnableDisableControls(FALSE);//disable controls if no log files exists
        }
    }
    else
    {
        vEnableDisableControls(FALSE);
    }

    SetWindowText(m_strCurrWndText);

    if (m_bLogON)
    {
        vEnableDisableControls(FALSE);

        if(m_omListLogFiles.GetItemCount()>0)
        {
            vUpdate_GUI_From_Datastore(0);
        }

        GetDlgItem(IDC_CBTN_ADDLOG)->EnableWindow(FALSE);
        GetDlgItem(IDC_CHECK_RESET_TIMESTAMP)->EnableWindow(FALSE);
        GetWindowText(m_strCurrWndText);
        m_strCurrWndText+=_(" - Read Only as Logging is ON");
        //SetWindowText(m_strCurrWndText);
        // PTV [1.6.4]
        // If Logging is on
        GetDlgItem(IDOK)->EnableWindow(FALSE);
        // PTV [1.6.4]
        SetWindowText("");
        m_unDispUpdateTimerId = SetTimer(600, 600, NULL);
    }
    else
    {
        // PTV [1.6.4]
        // If Logging is on
        GetDlgItem(IDOK)->EnableWindow(TRUE);

        // PTV [1.6.4]
    }

    // Hide or show the Filters button in the dialog based on the protocol
    if (CAN == m_eCurrBus)
    {
        GetDlgItem(IDC_LOG_FILTER)->ShowWindow(1);
    }
    else if (J1939 == m_eCurrBus)
    {
        GetDlgItem(IDC_LOG_FILTER)->ShowWindow(0);
    }

    return TRUE;
}
Ejemplo n.º 11
0
// Getter for total number of logging blocks
USHORT CFrameProcessor_J1939::FPJ1_GetLoggingBlockCount(void)
{
    return GetLoggingBlockCount();
}
Ejemplo n.º 12
0
// Getter for total number of logging blocks
USHORT CFrameProcessor_CAN::FPC_GetLoggingBlockCount(void)
{
    return GetLoggingBlockCount();
}