Garmin Fleet Management Controller
2.19.0
|
Modal dialog displaying a communication error. More...
#include <CCommErrorDlg.h>
Public Member Functions | |
CCommErrorDlg (TCHAR *aErrorMessage, BOOL aCommPortDown, CWnd *aParent, FmiApplicationLayer &aCom) | |
Constructor. More... | |
virtual | ~CCommErrorDlg () |
Destructor. More... | |
Protected Member Functions | |
virtual void | DoDataExchange (CDataExchange *aDataExchange) |
Perform dialog data exchange and validation. More... | |
afx_msg void | OnBnClickedChangeCom () |
Click handler for the Change Port button. More... | |
afx_msg void | OnBnClickedExit () |
Click handler for the Exit button. More... | |
afx_msg void | OnBnClickedRetry () |
Click handler for the Retry button. More... | |
void | OnCancel () |
Cancel action handler. More... | |
BOOL | OnInitDialog () |
Initialize the dialog. More... | |
void | PostNcDestroy () |
Called by MFC after the window has been destroyed; performs final termination activities. More... | |
Static Protected Member Functions | |
static BOOL CALLBACK | OnCloseHelper (HWND hWndParent, LPARAM lParam) |
Helper for EnumThreadWindows call. More... | |
Protected Attributes | |
FmiApplicationLayer & | mCom |
The FMI communication controller. More... | |
BOOL | mComPortDown |
If TRUE, communication is down and the serial port will need to be reinitialized to continue. More... | |
CString | mMessageText |
The message to display to the user. More... | |
Modal dialog displaying a communication error.
Gives the user the option to exit, retry the operation, or change the com port.
Definition at line 22 of file CCommErrorDlg.h.
CCommErrorDlg::CCommErrorDlg | ( | TCHAR * | aErrorMessage, |
BOOL | aIsPortDown, | ||
CWnd * | aParent, | ||
FmiApplicationLayer & | aCom | ||
) |
Constructor.
aErrorMessage | The error message to display |
aIsPortDown | If true, indicates that the com port is down, and the OK button is replaced by Exit, Retry, and Change Port buttons. |
aParent | The parent window |
aCom | The FmiApplicationLayer that should be notified when communication resumes |
Definition at line 35 of file CCommErrorDlg.cpp.
|
virtual |
|
protectedvirtual |
Perform dialog data exchange and validation.
aDataExchange | The DDX context |
Definition at line 61 of file CCommErrorDlg.cpp.
References IDC_ERROR_TXT_MESSAGE, and mMessageText.
Referenced by ~CCommErrorDlg().
|
protected |
Click handler for the Change Port button.
Display the Select Port dialog, then (if a port was selected) retry the communication.
Definition at line 158 of file CCommErrorDlg.cpp.
References OnBnClickedRetry().
|
protected |
Click handler for the Exit button.
Exit the application by sending WM_CLOSE to the main window.
Definition at line 97 of file CCommErrorDlg.cpp.
References FALSE, mComPortDown, OnCancel(), and OnCloseHelper().
|
protected |
Click handler for the Retry button.
Re-enable the communication link and make sure an enable packet is sent if appropriate.
Definition at line 142 of file CCommErrorDlg.cpp.
References FmiApplicationLayer::clearError(), mCom, and FmiApplicationLayer::sendEnable().
Referenced by OnBnClickedChangeCom().
|
protected |
Cancel action handler.
Dismiss the dialog if the com port is not down (otherwise com state would be violated).
Definition at line 129 of file CCommErrorDlg.cpp.
References mComPortDown.
Referenced by OnBnClickedExit().
|
staticprotected |
Helper for EnumThreadWindows call.
This function is called by EnumThreadWindows for each active top-level window associated with a given thread. It sends a command to each window to close itself. This allows any open modal dialogs to be closed by the comm error dialog. Unfortunately, it does not appear to affect dialogs that were not directly based on the main frame (e.g. file transfer progress dialog).
Definition at line 115 of file CCommErrorDlg.cpp.
References TRUE.
Referenced by OnBnClickedExit().
|
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. It also hides the OK button and shows the Exit, Retry, and Change Port buttons if the com port is down (as indicated in the constructor).
Definition at line 78 of file CCommErrorDlg.cpp.
References IDC_ERROR_BTN_CHANGE_PORT, IDC_ERROR_BTN_EXIT, IDC_ERROR_BTN_RETRY, mComPortDown, and TRUE.
|
protected |
Called by MFC after the window has been destroyed; performs final termination activities.
This dialog is displayed in response to particular events; to prevent its message loop from interrupting another Windows message that may be in progress, this dialog is created modeless. PostNcDestroy sends an event to notify its creator that the dialog is safe to delete.
Definition at line 176 of file CCommErrorDlg.cpp.
References EVENT_COMM_ERROR_DLG_CLOSED, and Event::post().
|
protected |
The FMI communication controller.
Definition at line 61 of file CCommErrorDlg.h.
Referenced by OnBnClickedRetry().
|
protected |
If TRUE, communication is down and the serial port will need to be reinitialized to continue.
Definition at line 58 of file CCommErrorDlg.h.
Referenced by OnBnClickedExit(), OnCancel(), and OnInitDialog().
|
protected |
The message to display to the user.
Definition at line 54 of file CCommErrorDlg.h.
Referenced by DoDataExchange().