Garmin Fleet Management Controller  2.19.0
CFeatureDlg.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * MODULE NAME:
4 * CFeatureDlg.cpp
5 *
6 * Copyright 2008-2009 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 
11 #include "stdafx.h"
12 #include "CFeatureDlg.h"
13 #include "util.h"
14 
15 BEGIN_MESSAGE_MAP( CFeatureDlg, CDialog )
16  ON_BN_CLICKED( IDOK, OnBnClickedOk )
17 END_MESSAGE_MAP()
18 
19 //----------------------------------------------------------------------
23 //----------------------------------------------------------------------
25  (
26  CWnd * aParent,
27  FmiApplicationLayer & aCom
28  )
29  : CDialog( IDD_FEATURE_SELECT, aParent )
30  , mCom( aCom )
31 {
32  mFeatureCount = 0;
33 }
34 
35 //----------------------------------------------------------------------
37 //----------------------------------------------------------------------
39 {
40 }
41 
42 //----------------------------------------------------------------------
48 //----------------------------------------------------------------------
50 {
51  ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_UNICODE ) )->SetCheck( BST_CHECKED );
52  ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_A607 ) )->SetCheck( BST_CHECKED );
53 
54 #if( FMI_SUPPORT_A613 )
55  ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_CUST_AVOID ) )->SetCheck( BST_INDETERMINATE );
56 #endif
57 
58  return CDialog::OnInitDialog();
59 }
60 
61 //----------------------------------------------------------------------
67 //----------------------------------------------------------------------
69  (
70  CButton * aCheckBox,
71  fmi_feature_type aFeature
72  )
73 {
74  switch( aCheckBox->GetCheck() )
75  {
76  case BST_CHECKED:
78  ++mFeatureCount;
79  break;
80 
81  case BST_UNCHECKED:
83  ++mFeatureCount;
84  break;
85 
86  default:
87  break;
88 
89  }
90 }
91 
92 //----------------------------------------------------------------------
96 //----------------------------------------------------------------------
98 {
99  // Default values
103 
104  if( BST_CHECKED == ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_UNICODE ) )->GetCheck() )
105  {
107  }
108 
109  if( BST_CHECKED == ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_PASSWORDS ) )->GetCheck() )
110  {
112  }
113 
114  if( BST_CHECKED == ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_MULTIDRIVER ) )->GetCheck() )
115  {
117  }
118 
119 #if( FMI_SUPPORT_A610 )
120  mCom.mUseAOBRD = ( BST_CHECKED == ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_AOBRD ) )->GetCheck() );
121 #endif
122 
123  // Build and send the enable request
124  checkFeature( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_UNICODE ), FEATURE_ID_UNICODE );
125  checkFeature( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_A607 ), FEATURE_ID_A607_SUPPORT );
128 #if( FMI_SUPPORT_A610 )
129  checkFeature( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_AOBRD ), FEATURE_ID_AOBRD_SUPPORT );
130 #endif
131 
133 
134 #if( FMI_SUPPORT_A613 )
136  memset( &message, 0, sizeof( message ) );
138  switch( ( ( CButton* )GetDlgItem( IDC_FEATURE_CHK_CUST_AVOID ) )->GetCheck() )
139  {
140  case BST_CHECKED:
141  {
142  message.enable = true;
143  mCom.sendFmiPacket( FMI_CUSTOM_AVOID_ENABLE_FEATURE_REQUEST, (uint8*)&message, sizeof( message ) );
144  break;
145  }
146  case BST_UNCHECKED:
147  {
148  message.enable = false;
149  mCom.sendFmiPacket( FMI_CUSTOM_AVOID_ENABLE_FEATURE_REQUEST, (uint8*)&message, sizeof( message ) );
150  break;
151  }
152  case BST_INDETERMINATE:
153  {
154  // don't change anything
155  break;
156  }
157  }
158 #endif
159  OnOK();
160 }
bool mUsePasswords
If true, driver password support is enabled.
#define IDC_FEATURE_CHK_CUST_AVOID
Definition: resource.h:346
#define IDC_FEATURE_CHK_UNICODE
Definition: resource.h:343
virtual ~CFeatureDlg()
Destructor.
Definition: CFeatureDlg.cpp:38
void sendFmiPacket(uint16 aFmiPacketId, uint8 *aFmiPayload, uint8 aFmiPayloadSize)
Send an arbitrary FMI packet.
#define IDD_FEATURE_SELECT
Definition: resource.h:46
#define FALSE
Definition: garmin_types.h:46
void sendEnable(uint16 *aFeatureCodes=NULL, uint8 aFeatureCount=0)
Transmit an FMI Enable packet, and clear any error state.
BOOL OnInitDialog()
Initialize the dialog.
Definition: CFeatureDlg.cpp:49
#define IDC_FEATURE_CHK_MULTIDRIVER
Definition: resource.h:341
#define TRUE
Definition: garmin_types.h:45
FMI Feature (enable) modal dialog.
Definition: CFeatureDlg.h:22
#define IDC_FEATURE_CHK_AOBRD
Definition: resource.h:344
afx_msg void OnBnClickedOk()
Click handler for OK button.
Definition: CFeatureDlg.cpp:97
codepage_type mClientCodepage
Code page used for encoding of text fields when communicating with the client.
bool mUseMultipleDrivers
If true, multiple driver support is enabled.
uint16 mFeatureCodes[126]
Array of feature codes to send in the FMI Enable packet.
Definition: CFeatureDlg.h:52
Serial communication controller for Garmin and FMI packets.
void checkFeature(CButton *aCheckBox, fmi_feature_type aFeature)
Process a feature check box.
Definition: CFeatureDlg.cpp:69
unsigned short int uint16
16-bit unsigned integer
Definition: garmin_types.h:64
FmiApplicationLayer & mCom
Reference to the FMI application layer.
Definition: CFeatureDlg.h:46
bool mUseAOBRD
If true, allow AOBRD driver provisioning.
fmi_feature_type
Valid values for the features field of the fmi_features_data_type.
Definition: fmi.h:590
unsigned char uint8
8-bit unsigned integer
Definition: garmin_types.h:62
time_type UTIL_get_current_garmin_time()
Get the current server time in Garmin format.
Definition: util.cpp:603
uint8 mFeatureCount
Number of feature codes to send in the FMI Enable packet.
Definition: CFeatureDlg.h:49
Data type for Custom Avoidance Feature Enable Packet ID (0X1236, 0X1235)
Definition: fmi.h:1960
#define IDC_FEATURE_CHK_PASSWORDS
Definition: resource.h:342
#define IDC_FEATURE_CHK_A607
Definition: resource.h:340