Garmin Fleet Management Controller  2.19.0
CAobrdOdometerDlg.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * MODULE NAME:
4 * CAobrdOdometerDlg.cpp
5 *
6 * Copyright 2012 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 
11 #include "stdafx.h"
12 #include <stdlib.h>
13 #include "CFmiApplication.h"
14 #include "CAobrdOdometerDlg.h"
15 
16 #if( FMI_SUPPORT_A610 )
17 
18 IMPLEMENT_DYNAMIC( CAobrdOdometerDlg, CDialog )
19 
20 BEGIN_MESSAGE_MAP( CAobrdOdometerDlg, CDialog )
21  ON_EN_CHANGE( IDC_AOBRD_ODOMETER_VALUE, OnEnChangeAobrdOdometer )
22  ON_BN_CLICKED( IDOK, OnBnClickedOk )
23 END_MESSAGE_MAP()
24 
25 //--------------------------------------------------------------------
29 //--------------------------------------------------------------------
30 CAobrdOdometerDlg::CAobrdOdometerDlg
31  (
32  CWnd * aParent,
33  FmiApplicationLayer & aCom
34  )
35  : CDialog( IDD_AOBRD_ODOMETER, aParent )
36  , mCom( aCom )
37  , odometer_value( _T("") )
38 {
39 }
40 
41 //--------------------------------------------------------------------
43 //--------------------------------------------------------------------
45 {
46 }
47 
48 //---------------------------------------------------------------------
51 //---------------------------------------------------------------------
53  (
54  CDataExchange * aDataExchange
55  )
56 {
57  CDialog::DoDataExchange( aDataExchange );
58  DDX_Text( aDataExchange, IDC_AOBRD_ODOMETER_VALUE, odometer_value );
59 }
60 
61 //---------------------------------------------------------------------
67 //---------------------------------------------------------------------
69 {
70  CDialog::OnInitDialog();
71 
72  return TRUE;
73 } /* OnInitDialog() */
74 
75 //---------------------------------------------------------------------
79 //---------------------------------------------------------------------
81 {
82  UpdateData( TRUE );
83  if( odometer_value != "" )
84  GetDlgItem( IDOK )->EnableWindow( TRUE );
85  else
86  GetDlgItem( IDOK )->EnableWindow( FALSE );
87 } /* OnEnChangeSafeModeSpeed() */
88 
89 //---------------------------------------------------------------------
93 //---------------------------------------------------------------------
95 {
96  UpdateData( TRUE );
97  char str[35];
98 
99  WideCharToMultiByte( mCom.mClientCodepage, 0, odometer_value, -1, str, 34, NULL, NULL );
100  str[34] = '\0';
101  mCom.sendAOBRDOdometerValue( (uint32)atoi( str ) );
102  OnOK();
103 } /* OnBnClickedOk() */
104 
105 #endif
virtual void DoDataExchange(CDataExchange *aDataExchange)
Perform dialog data exchange and validation.
#define FALSE
Definition: garmin_types.h:46
void sendAOBRDOdometerValue(uint32 aOdometer)
Send AOBRD Odometer value to device.
#define TRUE
Definition: garmin_types.h:45
CString odometer_value
Odometer reading entered by the user.
codepage_type mClientCodepage
Code page used for encoding of text fields when communicating with the client.
Modal dialog allowing the user to set AOBRD Odometer value.
FmiApplicationLayer & mCom
Reference to the FMI communication controller that this dialog uses.
Serial communication controller for Garmin and FMI packets.
BOOL OnInitDialog()
Initialize the dialog.
afx_msg void OnBnClickedOk()
Click handler for the OK button.
afx_msg void OnEnChangeAobrdOdometer()
Edit Change handler for AOBRD odometer value text box.
virtual ~CAobrdOdometerDlg()
Destructor.
unsigned long int uint32
32-bit unsigned integer
Definition: garmin_types.h:66
#define IDC_AOBRD_ODOMETER_VALUE
Definition: resource.h:430
#define IDD_AOBRD_ODOMETER
Definition: resource.h:52