Garmin Fleet Management Controller  2.19.0
CEtaModeDlg.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * MODULE NAME:
4 * CEtaModeDlg.cpp
5 *
6 * Copyright 2008-2016 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 #include "stdafx.h"
11 
12 #include "CEtaModeDlg.h"
13 
14 using namespace std;
15 
16 IMPLEMENT_DYNAMIC( CEtaModeDlg, CDialog )
17 
18 BEGIN_MESSAGE_MAP( CEtaModeDlg, CDialog )
19  ON_BN_CLICKED( IDOK, OnBnClickedSend )
20 END_MESSAGE_MAP()
21 
22 /*--------------------------------------------------------------------
23 LITERAL CONSTANTS
24 --------------------------------------------------------------------*/
25 
28 static CEtaModeDlg::mode_type mode_types[] =
29 {
30  _T("0 - None"),
31  _T("1 - Dispatch Stops"), // Default Mode
32  _T("2 - Driver Initiated Stops"),
33  _T("3 - Dispatch or Driver Initiated Stops")
34 };
35 
36 //----------------------------------------------------------------------
40 //----------------------------------------------------------------------
42  (
43  CWnd * aParent,
44  FmiApplicationLayer & aCom
45  )
46  : CDialog( IDD_ETA_MODE, aParent )
47  , mCom( aCom )
48  , mMode( ETA_SETTING_DISPATCH )
49 {
50 }
51 
52 //----------------------------------------------------------------------
54 //----------------------------------------------------------------------
56 {
57 }
58 
59 //----------------------------------------------------------------------
62 //----------------------------------------------------------------------
64  (
65  CDataExchange * aDataExchange
66  )
67 {
68  CDialog::DoDataExchange( aDataExchange );
69 
70  int mode;
71  DDX_CBIndex( aDataExchange, IDC_ETA_MODE_CBO, mode );
72  mMode = ( mode & 0xff );
73 }
74 
75 //----------------------------------------------------------------------
81 //----------------------------------------------------------------------
83 {
84  CDialog::OnInitDialog();
85 
86  // Populate mode type combobox
87  CComboBox * cbo = (CComboBox *)GetDlgItem( IDC_ETA_MODE_CBO );
88  cbo->ResetContent();
89  for( int i = 0; i < cnt_of_array( mode_types ); i++ )
90  {
91  cbo->AddString( mode_types[i] );
92  }
93  cbo->SetCurSel( ETA_SETTING_DISPATCH );
94 
95  return TRUE;
96 } /* OnInitDialog() */
97 
98 //----------------------------------------------------------------------
102 //----------------------------------------------------------------------
104 {
105  UpdateData( TRUE );
106 
107  mCom.sendEtaModeRequest( mMode );
108 
109  OnOK();
110 }
#define IDD_ETA_MODE
Definition: resource.h:67
CEtaModeDlg(CWnd *aParent, FmiApplicationLayer &aCom)
Constructor.
Definition: CEtaModeDlg.cpp:42
STL namespace.
#define cnt_of_array(_a)
The number of elements in _a.
Definition: util_macros.h:90
virtual void DoDataExchange(CDataExchange *aDataExchange)
Perform dialog data exchange and validation.
Definition: CEtaModeDlg.cpp:64
#define TRUE
Definition: garmin_types.h:45
#define IDC_ETA_MODE_CBO
Definition: resource.h:587
Serial communication controller for Garmin and FMI packets.
virtual ~CEtaModeDlg()
Destructor.
Definition: CEtaModeDlg.cpp:55
Modal dialog allowing the user to select an ETA mode for the device to operate in.
Definition: CEtaModeDlg.h:20
static CEtaModeDlg::mode_type mode_types[]
Mode types that the client accepts.
Definition: CEtaModeDlg.cpp:28
afx_msg void OnBnClickedSend()
Click handler for Send button.
BOOL OnInitDialog()
Initialize the dialog.
Definition: CEtaModeDlg.cpp:82