Garmin Fleet Management Controller  2.19.0
CFileConverterDlg Class Reference

File conversion tool to support various GPS file formats. More...

#include <CFileConverterDlg.h>

+ Inheritance diagram for CFileConverterDlg:

Classes

struct  conversion_type
 Defines conversion type. More...
 

Public Types

enum  { IDD = IDD_FILECONVERTER }
 

Public Member Functions

 CFileConverterDlg (CWnd *aParent, FmiApplicationLayer &aCom)
 Constructor. More...
 
virtual ~CFileConverterDlg ()
 Destructor. More...
 

Protected Member Functions

BOOL CreateChildProcess (CString dstFilePath)
 Create a child process to execute the file conversion. More...
 
virtual void DoDataExchange (CDataExchange *aDataExchange)
 Perform dialog data exchange and validation. More...
 
CString FormatArguments (CString dstFilePath)
 Helper function to format the command line arguments. More...
 
afx_msg void OnBnClickedChoose ()
 Click handler for Choose (destination folder) button. More...
 
afx_msg void OnBnClickedFind ()
 Click handler for Find (file to convert) button. More...
 
afx_msg void OnBnClickedOk ()
 Click handler for OK button. More...
 
afx_msg void OnComboChanged ()
 Change Handler for the combo box. More...
 
afx_msg void OnEnChangeFile ()
 Edit Change handler for all text boxes. More...
 
BOOL OnInitDialog ()
 Initialize the dialog. More...
 
void ReadFromPipe (void)
 Read output from the child process's pipe for STDOUT. More...
 

Protected Attributes

HANDLE hChildStd_OUT_Rd
 Handles for the redirection of the child process stdout. More...
 
HANDLE hChildStd_OUT_Wr
 
FmiApplicationLayermCom
 Reference to the FMI communication controller. More...
 
int mConversionIndex
 Index of the chosen combo box item. More...
 
int mConversionType
 Type of file conversion to be attempted, as specified by the user. More...
 
BOOL mDstCoords
 
CString mDstFileName
 File name of the converted file specified by the user. Defaults as the same name as Src file with new extension. More...
 
CString mDstFolder
 Destination folder for the converted file. Defaults to the same folder as Src file. More...
 
CString mRouteName
 Route name (Stop Text) of the PSR (limited to 200 bytes) More...
 
BOOL mSrcCoords
 Flags identify the format of the the source and destination files coords. More...
 
CString mSrcFilePath
 Path and file name of the file to be converted, as specified by the user. More...
 
CString mStopId
 Unique Stop ID for the PSR. More...
 

Detailed Description

File conversion tool to support various GPS file formats.

Definition at line 19 of file CFileConverterDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator
IDD 

Definition at line 42 of file CFileConverterDlg.h.

Constructor & Destructor Documentation

CFileConverterDlg::CFileConverterDlg ( CWnd *  aParent,
FmiApplicationLayer aCom 
)

Constructor.

Parameters
aParentThe parent of this dialog
aComReference to the FMI communication controller

Definition at line 65 of file CFileConverterDlg.cpp.

CFileConverterDlg::~CFileConverterDlg ( )
virtual

Destructor.

Definition at line 86 of file CFileConverterDlg.cpp.

References DoDataExchange().

Member Function Documentation

BOOL CFileConverterDlg::CreateChildProcess ( CString  dstFilePath)
protected

Create a child process to execute the file conversion.

Executes the FleetFileUtility executable. Any output from the tool is collected and displayed via message box. Much of the following is based on example code provided by MSDN.

Definition at line 467 of file CFileConverterDlg.cpp.

References FALSE, and TRUE.

void CFileConverterDlg::DoDataExchange ( CDataExchange *  aDataExchange)
protectedvirtual

Perform dialog data exchange and validation.

Parameters
aDataExchangeThe DDX context

Definition at line 95 of file CFileConverterDlg.cpp.

References CONV_CSV_TO_PSR, CONV_GPX_TO_PSR, IDC_FILE_CONVERT_EDIT_DST_FILENAME, IDC_FILE_CONVERT_EDIT_DST_FOLDER, IDC_FILE_CONVERT_EDIT_ROUTE_NAME, IDC_FILE_CONVERT_EDIT_SRC_FILENAME, and IDC_FILE_CONVERT_EDIT_STOPID.

Referenced by ~CFileConverterDlg().

CString CFileConverterDlg::FormatArguments ( CString  dstFilePath)
protected

Helper function to format the command line arguments.

Definition at line 223 of file CFileConverterDlg.cpp.

References CONV_CSV_TO_PSR, CONV_GPX_TO_PSR, and CONV_PSR_TO_CSV.

void CFileConverterDlg::OnBnClickedChoose ( )
protected

Click handler for Choose (destination folder) button.

Lets the user select a folder location to save the converted file.

Definition at line 326 of file CFileConverterDlg.cpp.

References FALSE.

void CFileConverterDlg::OnBnClickedFind ( )
protected

Click handler for Find (file to convert) button.

Displays a File..Open dialog allowing the user to select the file to convert.

Definition at line 279 of file CFileConverterDlg.cpp.

References FALSE, and TRUE.

void CFileConverterDlg::OnBnClickedOk ( )
protected

Click handler for OK button.

Initiates the file conversion process. The type of file conversion is selected by the user. A post-processing popup alerts the user if the conversion was successful or unsuccessful.

Definition at line 154 of file CFileConverterDlg.cpp.

References FALSE, IDC_FILE_CONVERT_RADB_1, IDC_FILE_CONVERT_RADB_3, and TRUE.

void CFileConverterDlg::OnComboChanged ( )
protected

Change Handler for the combo box.

This is needed because all messages for combo box changing are sent before the text has acutally changed. This workaround addresses that issue.

Definition at line 371 of file CFileConverterDlg.cpp.

References CONV_CSV_TO_PSR, CONV_GPX_TO_PSR, FALSE, IDC_FILE_CONVERT_CBO_TYPE, IDC_FILE_CONVERT_EDIT_DST_FILENAME, IDC_FILE_CONVERT_EDIT_DST_FOLDER, IDC_FILE_CONVERT_EDIT_ROUTE_NAME, IDC_FILE_CONVERT_EDIT_SRC_FILENAME, IDC_FILE_CONVERT_EDIT_STOPID, IDC_FILE_CONVERT_RADB_1, IDC_FILE_CONVERT_RADB_2, IDC_FILE_CONVERT_RADB_3, IDC_FILE_CONVERT_RADB_4, CFileConverterDlg::conversion_type::index, and TRUE.

void CFileConverterDlg::OnEnChangeFile ( )
protected

Edit Change handler for all text boxes.

Enables the OK button if all three edit controls are populated.

Definition at line 432 of file CFileConverterDlg.cpp.

References CONV_CSV_TO_PSR, CONV_GPX_TO_PSR, FALSE, and TRUE.

BOOL CFileConverterDlg::OnInitDialog ( )
protected

Initialize the dialog.

This function is called when the window is created. It sets up the parent, so it can get info from and send a message to FmiApplicationLayer.

Returns
TRUE, since this function does not set focus to a control

Definition at line 123 of file CFileConverterDlg.cpp.

References cnt_of_array, FALSE, IDC_FILE_CONVERT_CBO_TYPE, IDC_FILE_CONVERT_RADB_1, IDC_FILE_CONVERT_RADB_2, IDC_FILE_CONVERT_RADB_3, IDC_FILE_CONVERT_RADB_4, CFileConverterDlg::conversion_type::index, and TRUE.

void CFileConverterDlg::ReadFromPipe ( void  )
protected

Read output from the child process's pipe for STDOUT.

Displays any of the tool's output in message box

Definition at line 547 of file CFileConverterDlg.cpp.

References FALSE.

Member Data Documentation

HANDLE CFileConverterDlg::hChildStd_OUT_Rd
protected

Handles for the redirection of the child process stdout.

Definition at line 97 of file CFileConverterDlg.h.

HANDLE CFileConverterDlg::hChildStd_OUT_Wr
protected

Definition at line 98 of file CFileConverterDlg.h.

FmiApplicationLayer& CFileConverterDlg::mCom
protected

Reference to the FMI communication controller.

Definition at line 65 of file CFileConverterDlg.h.

int CFileConverterDlg::mConversionIndex
protected

Index of the chosen combo box item.

Definition at line 75 of file CFileConverterDlg.h.

int CFileConverterDlg::mConversionType
protected

Type of file conversion to be attempted, as specified by the user.

Definition at line 72 of file CFileConverterDlg.h.

BOOL CFileConverterDlg::mDstCoords
protected

Definition at line 93 of file CFileConverterDlg.h.

CString CFileConverterDlg::mDstFileName
protected

File name of the converted file specified by the user. Defaults as the same name as Src file with new extension.

Definition at line 79 of file CFileConverterDlg.h.

CString CFileConverterDlg::mDstFolder
protected

Destination folder for the converted file. Defaults to the same folder as Src file.

Definition at line 83 of file CFileConverterDlg.h.

CString CFileConverterDlg::mRouteName
protected

Route name (Stop Text) of the PSR (limited to 200 bytes)

Definition at line 89 of file CFileConverterDlg.h.

BOOL CFileConverterDlg::mSrcCoords
protected

Flags identify the format of the the source and destination files coords.

Definition at line 92 of file CFileConverterDlg.h.

CString CFileConverterDlg::mSrcFilePath
protected

Path and file name of the file to be converted, as specified by the user.

Definition at line 69 of file CFileConverterDlg.h.

CString CFileConverterDlg::mStopId
protected

Unique Stop ID for the PSR.

Definition at line 86 of file CFileConverterDlg.h.


The documentation for this class was generated from the following files: