Garmin Fleet Management Controller  2.19.0
CFmiPcAppDlg.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * MODULE NAME:
4 * CFmiPcAppDlg.cpp
5 *
6 * Copyright 2008-2018 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 #include "stdafx.h"
11 #include "CAboutDlg.h"
12 #include "CFmiApplication.h"
13 #include "CFmiPcAppDlg.h"
14 #include "CCommErrorDlg.h"
15 #include "CSelectCommPortDlg.h"
16 #include "CStopListDlg.h"
17 #include "CTxtMsgNewDlg.h"
18 #include "CLogViewerDlg.h"
19 #include "FmiLogParser.h"
20 
21 #if( FMI_SUPPORT_A602 )
22 #include "CTxtMsgAckDlg.h"
23 #endif
24 
25 #if( FMI_SUPPORT_A603 )
26 #include "CAutoArrivalDlg.h"
27 #include "CDeleteDataDlg.h"
28 #include "CTxtMsgFromClient.h"
29 #endif
30 
31 #if( FMI_SUPPORT_A604 )
33 #include "CCannedTxtMsgDlg.h"
34 #include "CDriverIdAndStatusDlg.h"
35 #include "CGpiQueryDlg.h"
36 #include "CFileTransferDlg.h"
37 #include "CMsgThrottlingDlg.h"
38 #include "CPingStatusDlg.h"
39 #include "CTxtMsgStatusDlg.h"
41 #include "CUITextChangeDlg.h"
42 #endif
43 
44 #if( FMI_SUPPORT_A606 )
45 #include "CSafeModeDlg.h"
46 #endif
47 
48 #if( FMI_SUPPORT_A607 )
49 #include "CFeatureDlg.h"
51 #endif
52 
53 #if( FMI_SUPPORT_A608 )
54 #include "CSpeedLimitAlertsDlg.h"
55 #endif
56 
57 #if( FMI_SUPPORT_A610 )
58 #include "CAobrdDriversDlg.h"
59 #include "CAobrdOdometerDlg.h"
60 #include "AobrdEventLogConverter.h"
61 #endif
62 
63 #if( FMI_SUPPORT_A615 )
64 #include "CHosSettingDlg.h"
65 #include "CTimeOfDayPickerDlg.h"
66 #endif
67 
68 #if( FMI_SUPPORT_A616 )
69 #include "CChangeBaudRateDlg.h"
70 #include "SerialPort.h"
71 #endif
72 
73 #if( FMI_SUPPORT_A617 )
74 #include "CSendAlertDlg.h"
75 #endif
76 
77 #if( FMI_SUPPORT_A623 )
78 #include "CEtaModeDlg.h"
79 #endif
80 
81 #include "Event.h"
82 #include "Logger.h"
83 #include "TimerManager.h"
84 
86 #define MAIN_RX_TIMER_INTERVAL ( 150 )
87 
89 #define MAIN_ETA_TIMER_INTERVAL ( 60 * 1000 )
90 
91 #if FMI_SUPPORT_A616
92 #define BAUD_RATE_SYNC_TIMER_INTERVAL ( 300 )
94 
96 #define BAUD_RATE_SYNC_RETRY_COUNT ( 5 )
97 #endif
98 
104 {
106 #if FMI_SUPPORT_A603
108 #endif
109 #if FMI_SUPPORT_A616
111 #endif
112 
114 };
115 
116 using namespace std;
117 
118 BEGIN_MESSAGE_MAP( CFmiPcAppDlg, CDialog )
119  ON_WM_SYSCOMMAND()
120  ON_WM_PAINT()
121  ON_WM_QUERYDRAGICON()
122  ON_WM_TIMER()
123  ON_BN_CLICKED( IDC_MAIN_BTN_CHG_COM_PORT, OnBnClickedChgComPort )
124  ON_BN_CLICKED( IDC_MAIN_BTN_SEND_ENABLE, OnBnClickedEnable )
125  ON_BN_CLICKED( IDC_MAIN_BTN_SEND_TXT_MSG, OnBnClickedTxt )
126  ON_BN_CLICKED( IDC_MAIN_BTN_VIEW_LOG, OnBnClickedViewlog )
127  ON_BN_CLICKED( IDC_MAIN_BTN_VIEW_STOPS, OnBnClickedManageStops )
128  ON_BN_CLICKED( IDC_MAIN_CHK_PVT_ENABLE, OnBnClickedCheckPVT )
129  ON_COMMAND( ID_FILE_CLEARPACKETLOG, OnFileClearPacketLog )
130  ON_COMMAND( ID_FILE_CLOSE, OnFileClose )
131  ON_COMMAND( ID_FILE_VIEWLOG, OnBnClickedViewlog )
132  ON_COMMAND( ID_HELP_ABOUT, OnHelpAbout )
133  ON_UPDATE_COMMAND_UI( ID_FILE_VIEWLOG, OnUpdateFileViewlog )
134  ON_MESSAGE( WM_EVENT( EVENT_MAIN_DLG_INIT ), OnEventMainDlgInit )
135  ON_MESSAGE( WM_EVENT( EVENT_COMM_TIMEOUT ), OnEventCommTimeout )
136  ON_MESSAGE( WM_EVENT( EVENT_COMM_ERROR_DLG_CLOSED ), OnEventCommErrorDlgClosed )
137  ON_MESSAGE( WM_EVENT( EVENT_ESN_RECEIVED ), OnEventEsnReceived )
138  ON_MESSAGE( WM_EVENT( EVENT_PRODUCT_ID_RECEIVED ), OnEventProductIdReceived )
139  ON_MESSAGE( WM_EVENT( EVENT_PROTOCOLS_RECEIVED ), OnEventProtocolsReceived )
140  ON_MESSAGE( WM_EVENT( EVENT_PVT_RECEIVED ), OnEventPvtReceived )
141  ON_MESSAGE( WM_EVENT( EVENT_LOG_VIEWER_CLOSED ), OnEventLogViewerClosed )
142  ON_MESSAGE( WM_EVENT( EVENT_STOP_LIST_DLG_CLOSED ), OnEventStopListDlgClosed )
143 #if( FMI_SUPPORT_A602 )
144  ON_MESSAGE( WM_EVENT( EVENT_FMI_TXT_MSG_ACK ), OnEventTextMsgAck )
145  ON_BN_CLICKED( IDC_MAIN_BTN_FMI_SEND, OnBnClickedSend )
146 #endif
147 #if( FMI_SUPPORT_A603 )
148  ON_MESSAGE( WM_EVENT( EVENT_FMI_TXT_MSG_FROM_CLIENT ), OnEventTxtMsgFromClient )
149  ON_MESSAGE( WM_EVENT( EVENT_FMI_ETA_RECEIVED ), OnEventEtaReceived )
150  ON_MESSAGE( WM_EVENT( EVENT_FMI_STOP_STATUS_CHANGED ), OnEventStopDone )
151  ON_BN_CLICKED( IDC_MAIN_BTN_CHG_AUTO_ARVL, OnBnClickedChgAutoArvl )
152  ON_BN_CLICKED( IDC_MAIN_BTN_DEL_DATA, OnBnClickedDelData )
153  ON_BN_CLICKED( IDC_MAIN_BTN_REQ_ETA, OnBnClickedReqETA )
154  ON_BN_CLICKED( IDC_MAIN_CHK_ETA_AUTO_UPDATE, OnBnClickedAutoETA )
155 #endif
156 #if( FMI_SUPPORT_A604 )
157  ON_MESSAGE( WM_EVENT( EVENT_FMI_UI_UPDATE_ERROR ), OnEventUserInterfaceTextChangeFailed )
158  ON_MESSAGE( WM_EVENT( EVENT_FMI_CANNED_RESP_LIST_RCPT_ERROR ), OnEventCannedRespListReceiptError )
159  ON_MESSAGE( WM_EVENT( EVENT_FMI_A604_TXT_MSG_ERROR ), OnEventOpenTextMsgError )
160  ON_MESSAGE( WM_EVENT( EVENT_FMI_TXT_MSG_STATUS_RECEIVED ), OnEventTxtMsgStatus )
161  ON_MESSAGE( WM_EVENT( EVENT_FMI_CANNED_MESSAGE_DLG_CLOSED ), OnEventCannedMessageDlgClosed )
162  ON_MESSAGE( WM_EVENT( EVENT_FMI_DRIVER_ID_AND_STATUS_DLG_CLOSED ), OnEventDriverIdAndStatusDlgClosed )
163  ON_MESSAGE( WM_EVENT( EVENT_FMI_DRIVER_STATUS_LIST_DELETE_FAILED ), OnEventDriverStatusListDeleteFailed )
164  ON_MESSAGE( WM_EVENT( EVENT_FMI_CANNED_RESPONSE_DLG_CLOSED ), OnEventCannedResponseDlgClosed )
165  ON_MESSAGE( WM_EVENT( EVENT_FMI_DISABLE_COMPLETE ), OnEventFmiDisabled )
166  ON_BN_CLICKED( IDC_MAIN_BTN_FILE_TRANS, OnBnClickedFileTrans )
167  ON_BN_CLICKED( IDC_MAIN_BTN_CANNED_RESPONSES, OnBnClickedCannedResponses )
168  ON_BN_CLICKED( IDC_MAIN_BTN_PING, OnBnClickedPing )
169  ON_BN_CLICKED( IDC_MAIN_BTN_GPI_QUERY, OnBnClickedGpiQuery )
170  ON_BN_CLICKED( IDC_MAIN_BTN_DRIVER_INFO, OnBnClickedIdStatus )
171  ON_BN_CLICKED( IDC_MAIN_BTN_CANNED_MESSAGES, OnBnClickedManageCannedMsg )
172  ON_BN_CLICKED( IDC_MAIN_BTN_MSG_STATUS, OnBnClickedMsgStatus )
173  ON_BN_CLICKED( IDC_MAIN_BTN_UI_TXT_CHG, OnBnClickedUiTxtChg )
174  ON_BN_CLICKED( IDC_MAIN_BTN_MSG_THROTTLING, OnBnClickedMsgThrottling )
175 #endif
176 #if( FMI_SUPPORT_A606 )
177  ON_MESSAGE( WM_EVENT( EVENT_FMI_SAFE_MODE_ERROR ), OnEventFmiSafeModeError )
178  ON_BN_CLICKED(IDC_MAIN_BTN_SET_SAFE_MODE, OnBnClickedSafeMode)
179 #endif
180 #if( FMI_SUPPORT_A607 )
181  ON_BN_CLICKED( IDC_MAIN_BTN_MSG_DELETE, OnBnClickedMsgDelete )
182  ON_BN_CLICKED( IDC_MAIN_BTN_WAYPOINTS, OnBnClickedWaypoints )
183  ON_MESSAGE( WM_EVENT( EVENT_FMI_WAYPOINT_DLG_CLOSED ), OnEventWaypointDlgClosed )
184  ON_MESSAGE( WM_EVENT( EVENT_FMI_DELETE_TEXT_MESSAGE_STATUS ), OnEventDeleteTextMessageStatus )
185 #endif
186 #if( FMI_SUPPORT_A608 )
187  ON_BN_CLICKED( IDC_MAIN_BTN_SPEED_LIMIT_ALERTS, OnBnClickedSpeedLimit )
188 #endif
189 #if( FMI_SUPPORT_A609 )
190  ON_UPDATE_COMMAND_UI( ID_FILE_REBOOTDEVICE, OnUpdateFileRebootDevice )
191  ON_COMMAND( ID_FILE_REBOOTDEVICE, OnFileRebootDevice )
192 #endif
193 #if( FMI_SUPPORT_A610 )
194  ON_UPDATE_COMMAND_UI( ID_FILE_AOBRDDRIVERS, OnUpdateFileAOBRDDrivers )
195  ON_COMMAND( ID_FILE_AOBRDDRIVERS, OnFileAOBRDDrivers )
196  ON_MESSAGE( WM_EVENT( EVENT_FMI_AOBRD_FILE_TRANSFER_RECEIVED ), OnEventAobrdFileTransferReceived )
197  ON_BN_CLICKED(IDC_MAIN_BTN_SET_AOBRD_ODOMETER, OnBnClickedAobrdOdometer)
198 #endif
199 #if( FMI_SUPPORT_A611 )
200  ON_MESSAGE( WM_EVENT( EVENT_FMI_LONG_TEXT_MSG_ERROR ), OnEventLongTextMsgError )
201 #endif
202 #if( FMI_SUPPORT_A612 )
203  ON_COMMAND( ID_TOOLS_CUSTOMFORMS, OnToolsCustomForms )
204 #endif
205 #if( FMI_SUPPORT_A613 )
206  ON_COMMAND( ID_TOOLS_MAP_VIEWER, OnToolsMapViewer )
207 #endif
208 #if( FMI_SUPPORT_A615 )
209  ON_COMMAND( ID_TOOLS_IFTA, OnToolsIfta )
210  ON_BN_CLICKED( IDC_MAIN_BTN_AUTO_STATUS_UPDATES, OnBnClickedAutoStatusUpdates )
211  ON_COMMAND( ID_8HOURRULE_ENABLE, OnToolsHOS8HourRuleEnable )
212  ON_COMMAND( ID_8HOURRULE_DISABLE, OnToolsHOS8HourRuleDisable )
213 #endif
214 #if( FMI_SUPPORT_A616 )
215  ON_BN_CLICKED( IDC_MAIN_BTN_CHANGE_BAUD_RATE, OnBnClickedChangeBaudRate )
216  ON_MESSAGE( WM_EVENT( EVENT_FMI_BAUD_RATE_SYNCHRONIZING ), OnEventBaudRateSynchronizing )
217  ON_MESSAGE( WM_EVENT( EVENT_FMI_BAUD_RATE_SYNCHRONIZED ), OnEventBaudRateSynchronized )
218 #endif
219 #if( FMI_SUPPORT_A617 )
220  ON_BN_CLICKED( IDC_MAIN_BTN_SEND_ALERT, OnBnClickedSendAlert )
221  ON_BN_CLICKED( IDC_MAIN_BTN_SEND_SENSOR, OnBnClickedSendSensor )
222 #endif
223 #if( FMI_SUPPORT_A619 )
224  ON_COMMAND( ID_CONFIGURE_HOS_PERIODIC_UPDATES, OnToolsConfigureHosPeriodicUpdates )
225 #endif
226 #if( CDT_SUPPORT )
227  ON_MESSAGE( WM_EVENT( EVENT_CDT_PING_RECEIVED ), OnCDTPingReceived )
228  ON_MESSAGE( WM_EVENT( EVENT_CDT_PACKET_RECEIVED ), OnCDTPacketReceived )
229  ON_COMMAND( ID_CDT_CHAT, OnToolsCDTChat )
230  ON_COMMAND( ID_CDT_PING_ONCE, OnToolsCDTPingOnce )
231  ON_COMMAND( ID_CDT_PING_TOOL, OnToolsCDTPingTool )
232 #endif
233 #if( FMI_SUPPORT_A620 )
234  ON_COMMAND( ID_HOS_SETSTARTTIMEOFDAY, OnToolsHOSSetStartTimeOfDay )
235 #endif
236 #if( FMI_SUPPORT_A622 )
237  ON_COMMAND( ID_TOOLS_CAMERA_SETTINGS, OnToolsCameraSettings )
238  ON_COMMAND( ID_TOOLS_CAMERA_NOTIFICATIONS, OnToolsCameraNtfctn )
239  ON_COMMAND( ID_TOOLS_FILECONVERTER, OnToolsFileConverter )
240  ON_MESSAGE( WM_EVENT( EVENT_FMI_DASHCAM_NTFCTN ), OnEventDashcamNtfctnFromClient )
241  ON_MESSAGE( WM_EVENT( EVENT_FMI_DASHCAM_INCIDENT_FILE_NTFCTN ), OnEventDashcamIncidentFileNtfctnFromClient )
242 #endif
243 #if( FMI_SUPPORT_A623 )
244  ON_BN_CLICKED( IDC_MAIN_BTN_ETA_MODE, OnBnClickedETAMode )
245  ON_MESSAGE( WM_EVENT( EVENT_FMI_ETA_MODE_RECEIVED ), OnEventEtaModeReceived )
246 #endif
247 
248 END_MESSAGE_MAP()
249 
250 //----------------------------------------------------------------------
253 //----------------------------------------------------------------------
255  (
256 #if FMI_SUPPORT_A602
257  id_type freeformFmiPacketId,
258 #endif
259  CWnd * aParent
260  )
261  : CDialog( IDD_FMI_PC_APP_DIALOG, aParent )
262  , mPvtChecked( FALSE )
263  , mUnitId( _T("") )
264  , mGpsFix( _T("") )
265  , mPvtDate( _T("") )
266  , mPvtTime( _T("") )
267  , mPvtLatitude( _T("") )
268  , mPvtLongitude( _T("") )
269  , mAltitude( _T("") )
270  , mEastWestVelocity( _T("") )
271  , mNorthSouthVelocity( _T("") )
272  , mUpDownVelocity( _T("") )
273  , m2DVelocity( _T("") )
274  , mCommErrorDlg( NULL )
275  , mLogViewerDlg( NULL )
276  , mSupportedProtocols( _T("") )
277  , mProductId( _T("") )
278  , mSoftwareVersion( _T("") )
279  , mStopListDlg( NULL )
280 #if FMI_SUPPORT_A602
281  , mPacketId( _T("") )
282  , mPacketData( _T("") )
283  , mCom( freeformFmiPacketId )
284 #endif
285 #if FMI_SUPPORT_A603
286  , mAutoEtaChecked( FALSE )
287  , mEtaTimerEnabled( FALSE )
288  , mEtaTime( _T("") )
289  , mEtaDistance( _T("") )
290  , mEtaLatitude( _T("") )
291  , mEtaLongitude( _T("") )
292 #endif
293 #if FMI_SUPPORT_A604
294  , mCannedResponseDlg( NULL )
295  , mCannedTxtMsgDlg( NULL )
296  , mDriverIdAndStatusDlg( NULL )
297  , mTxtMsgStatusDlg( NULL )
298 #endif
299 #if FMI_SUPPORT_A607
300  , mWaypointDlg( NULL )
301 #endif
302 #if FMI_SUPPORT_A612
303  , mCustomFormsDlg( NULL )
304 #endif
305 #if FMI_SUPPORT_A613
306  , mMapViewerDlg( NULL )
307 #endif
308 #if FMI_SUPPORT_A615
309  , mIftaDlg( NULL )
310 #endif
311 #if FMI_SUPPORT_A616
312  , mResolvingCommRate( FALSE )
313  , mBaudRateSyncRetries( 0 )
314 #endif
315 #if FMI_SUPPORT_A617
316  , mSendAlertDlg( NULL )
317  , mSendSensorDlg( NULL)
318 #endif
319 #if CDT_SUPPORT
320  , mCdtChatDlg( NULL )
321  , mCdtPingDlg( NULL )
322 #endif
323 #if FMI_SUPPORT_A622
324  , mDashcamDlg( NULL )
325  , mDashcamNtfctnDlg( NULL )
326  , mFileConverterDlg( NULL )
327 #endif
328 #if FMI_SUPPORT_A623
329  , mEtaMode( _T("") )
330 #endif
331 {
332  mIconHandle = AfxGetApp()->LoadIcon( IDR_MAINFRAME );
333  mLogParser = new FmiLogParser;
334 }
335 
336 //----------------------------------------------------------------------
338 //----------------------------------------------------------------------
340 {
341  delete mLogParser;
342  delete mCommErrorDlg;
343  delete mLogViewerDlg;
344  delete mStopListDlg;
345 
346 #if FMI_SUPPORT_A604
347  delete mCannedResponseDlg;
348  delete mDriverIdAndStatusDlg;
349  delete mCannedTxtMsgDlg;
350 #endif
351 
352 #if FMI_SUPPORT_A607
353  delete mWaypointDlg;
354 #endif
355 #if FMI_SUPPORT_A612
356  delete mCustomFormsDlg;
357 #endif
358 #if FMI_SUPPORT_A613
359  delete mMapViewerDlg;
360 #endif
361 #if FMI_SUPPORT_A615
362  delete mIftaDlg;
363 #endif
364 #if FMI_SUPPORT_A617
365  delete mSendAlertDlg;
366  delete mSendSensorDlg;
367 #endif
368 #if CDT_SUPPORT
369  delete mCdtChatDlg;
370  delete mCdtPingDlg;
371 #endif
372 #if FMI_SUPPORT_A622
373  delete mDashcamDlg;
374  delete mDashcamNtfctnDlg;
375  delete mFileConverterDlg;
376 #endif
377 }
378 
379 //----------------------------------------------------------------------
382 //----------------------------------------------------------------------
384  (
385  CDataExchange * aDataExchange
386  )
387 {
388  CDialog::DoDataExchange( aDataExchange );
389  DDX_Check( aDataExchange, IDC_MAIN_CHK_PVT_ENABLE, mPvtChecked );
390  DDX_Text( aDataExchange, IDC_MAIN_TXT_ESN, mUnitId );
391  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_GPS_FIX, mGpsFix );
392  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_DATE, mPvtDate );
393  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_TIME, mPvtTime );
394  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_LAT, mPvtLatitude );
395  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_LON, mPvtLongitude );
396  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_ALTITUDE, mAltitude );
397  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_EW_VEL, mEastWestVelocity );
398  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_NS_VEL, mNorthSouthVelocity );
399  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_UD_VEL, mUpDownVelocity );
400  DDX_Text( aDataExchange, IDC_MAIN_TXT_PVT_2D_VEL, m2DVelocity );
401  DDX_Text( aDataExchange, IDC_MAIN_TXT_PRODUCT_ID, mProductId );
402  DDX_Text( aDataExchange, IDC_MAIN_TXT_SW_VERSION, mSoftwareVersion );
403 #if( FMI_SUPPORT_A602 )
404  DDX_Text( aDataExchange, IDC_MAIN_EDIT_FMI_ID, mPacketId );
405  DDX_Text( aDataExchange, IDC_MAIN_EDIT_FMI_DATA, mPacketData );
406 #endif
407 #if( FMI_SUPPORT_A603 )
408  DDX_Check( aDataExchange, IDC_MAIN_CHK_ETA_AUTO_UPDATE, mAutoEtaChecked );
409  DDX_Text( aDataExchange, IDC_MAIN_TXT_ETA_TIME, mEtaTime );
410  DDX_Text( aDataExchange, IDC_MAIN_TXT_ETA_DISTANCE, mEtaDistance );
411  DDX_Text( aDataExchange, IDC_MAIN_TXT_ETA_LAT, mEtaLatitude );
412  DDX_Text( aDataExchange, IDC_MAIN_TXT_ETA_LON, mEtaLongitude );
413 #endif
414 #if( FMI_SUPPORT_A623 )
415  DDX_Text( aDataExchange, IDC_MAIN_TXT_ETA_MODE, mEtaMode );
416 #endif
417 }
418 
419 //----------------------------------------------------------------------
433 //----------------------------------------------------------------------
435 {
436  CDialog::OnInitDialog();
437 
438  // Add "About..." menu item to system menu.
439  // IDM_ABOUTBOX must be in the system command range.
440  ASSERT( ( IDM_ABOUTBOX & 0xFFF0 ) == IDM_ABOUTBOX );
441  ASSERT( IDM_ABOUTBOX < 0xF000 );
442 
443  CMenu * pSysMenu = GetSystemMenu( FALSE );
444  if( pSysMenu != NULL )
445  {
446  CString strAboutMenu;
447  strAboutMenu.LoadString( IDS_ABOUTBOX );
448  if( !strAboutMenu.IsEmpty() )
449  {
450  pSysMenu->AppendMenu( MF_SEPARATOR );
451  pSysMenu->AppendMenu( MF_STRING, IDM_ABOUTBOX, strAboutMenu );
452  }
453  }
454 
455  // Set the icon for this dialog. The framework does this automatically
456  // when the application's main window is not a dialog
457  SetIcon( mIconHandle, TRUE ); // Set big icon
458  SetIcon( mIconHandle, FALSE ); // Set small icon
459 
460  //used on the first timer cycle to send an enable to device
461  //this is done so the app pops up before stalling if there
462  //is no device to enable
463  mComPortSelected = FALSE;
464 
465  mIgnoreTimer = FALSE;
466 
467  initProductNames();
468 
469  SetTimer( MAIN_TIMER_ID, MAIN_RX_TIMER_INTERVAL, NULL );
470 
471  SetWindowPos( NULL, 120, 175, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
472 
473 #if( !FMI_SUPPORT_A602 )
474  CButton * enableButton = (CButton *)GetDlgItem( IDC_MAIN_BTN_SEND_ENABLE );
475  enableButton->SetWindowText( _T("Request PID/ESN") );
476  GetDlgItem( IDC_MAIN_GRP_FMI_PACKET )->EnableWindow( FALSE );
477  GetDlgItem( IDC_MAIN_LBL_FMI_ID )->EnableWindow( FALSE );
478  GetDlgItem( IDC_MAIN_LBL_FMI_DATA )->EnableWindow( FALSE );
479  GetDlgItem( IDC_MAIN_EDIT_FMI_ID )->EnableWindow( FALSE );
480  GetDlgItem( IDC_MAIN_EDIT_FMI_DATA )->EnableWindow( FALSE );
481  GetDlgItem( IDC_MAIN_BTN_FMI_SEND )->EnableWindow( FALSE );
482 #endif
483 
484 #if( !FMI_SUPPORT_A603 )
485  GetDlgItem( IDC_MAIN_BTN_DEL_DATA )->EnableWindow( FALSE );
486  GetDlgItem( IDC_MAIN_BTN_REQ_ETA )->EnableWindow( FALSE );
487  GetDlgItem( IDC_MAIN_BTN_CHG_AUTO_ARVL )->EnableWindow( FALSE );
488  GetDlgItem( IDC_MAIN_CHK_ETA_AUTO_UPDATE )->EnableWindow( FALSE );
489  GetDlgItem( IDC_MAIN_GRP_ETA_DATA )->EnableWindow( FALSE );
490  GetDlgItem( IDC_MAIN_LBL_ETA_TIME )->EnableWindow( FALSE );
491  GetDlgItem( IDC_MAIN_LBL_ETA_DISTANCE )->EnableWindow( FALSE );
492  GetDlgItem( IDC_MAIN_LBL_ETA_LAT )->EnableWindow( FALSE );
493  GetDlgItem( IDC_MAIN_LBL_ETA_LON )->EnableWindow( FALSE );
494 #endif
495 
496 #if( !FMI_SUPPORT_A604 )
497  // Disable the controls specific to A604 support
498  GetDlgItem( IDC_MAIN_BTN_FILE_TRANS )->EnableWindow( FALSE );
499  GetDlgItem( IDC_MAIN_BTN_CANNED_RESPONSES )->EnableWindow( FALSE );
500  GetDlgItem( IDC_MAIN_BTN_PING )->EnableWindow( FALSE );
501  GetDlgItem( IDC_MAIN_BTN_GPI_QUERY )->EnableWindow( FALSE );
502  GetDlgItem( IDC_MAIN_BTN_DRIVER_INFO )->EnableWindow( FALSE );
503  GetDlgItem( IDC_MAIN_BTN_CANNED_MESSAGES )->EnableWindow( FALSE );
504  GetDlgItem( IDC_MAIN_BTN_MSG_STATUS )->EnableWindow( FALSE );
505  GetDlgItem( IDC_MAIN_BTN_UI_TXT_CHG )->EnableWindow( FALSE );
506  GetDlgItem( IDC_MAIN_BTN_MSG_THROTTLING )->EnableWindow( FALSE );
507 #endif
508 
509 #if( !FMI_SUPPORT_A606 )
510  // Disable the controls specific to A606 support
511  GetDlgItem( IDC_MAIN_BTN_SET_SAFE_MODE )->EnableWindow( FALSE );
512 #endif
513 
514 #if( !FMI_SUPPORT_A607 )
515  GetDlgItem( IDC_MAIN_BTN_MSG_DELETE )->EnableWindow( FALSE );
516  GetDlgItem( IDC_MAIN_BTN_WAYPOINTS )->EnableWindow( FALSE );
517 #endif
518 
519 #if( !FMI_SUPPORT_A608 )
520  GetDlgItem( IDC_MAIN_BTN_SPEED_LIMIT_ALERTS )->EnableWindow( FALSE );
521 #endif
522 
523 #if( !FMI_SUPPORT_A610 )
524  GetDlgItem( IDC_MAIN_BTN_SET_AOBRD_ODOMETER )->EnableWindow( FALSE );
525  GetMenu()->GetSubMenu(0)->EnableMenuItem( ID_FILE_AOBRDDRIVERS, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
526  GetMenu()->GetSubMenu(0)->EnableMenuItem( ID_FILE_REBOOTDEVICE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
527 #endif
528 
529 #if( !FMI_SUPPORT_A615 )
530  GetDlgItem( IDC_MAIN_BTN_AUTO_STATUS_UPDATES )->EnableWindow( FALSE );
531  GetMenu()->GetSubMenu( 1 )->GetSubMenu( 5 )->EnableMenuItem( 0 , MF_BYPOSITION | MF_DISABLED | MF_GRAYED );
532 #endif
533 
534 #if( !FMI_SUPPORT_A616 )
535  GetDlgItem( IDC_MAIN_BTN_CHANGE_BAUD_RATE )->EnableWindow( FALSE );
536 #endif
537 
538 #if( !FMI_SUPPORT_A617 )
539  GetDlgItem( IDC_MAIN_BTN_SEND_ALERT )->EnableWindow( FALSE );
540  GetDlgItem( IDC_MAIN_BTN_SEND_SENSOR )->EnableWindow( FALSE );
541 #endif
542 
543 #if( !FMI_SUPPORT_A619 )
544  GetMenu()->GetSubMenu( 1 )->GetSubMenu( 5 )->EnableMenuItem( 1 , MF_BYPOSITION | MF_DISABLED | MF_GRAYED );
545 #endif
546 
547 #if( CDT_SUPPORT )
548  //disable CDT Chat menu item until we get a CDT ping response
549  GetMenu()->GetSubMenu( 1 )->GetSubMenu( 7 )->EnableMenuItem( 0, MF_BYPOSITION | MF_DISABLED | MF_GRAYED );
550 #else
551  GetMenu()->GetSubMenu( 1 )->EnableMenuItem( 7 , MF_BYPOSITION | MF_DISABLED | MF_GRAYED );
552 #endif
553 
554 #if( !FMI_SUPPORT_A620 )
555  // disable HOS Set Start Time of Day
556  GetMenu()->GetSubMenu( 1 )->GetSubMenu( 5 )->EnableMenuItem( 2 , MF_BYPOSITION | MF_DISABLED | MF_GRAYED );
557 #endif
558 
559 #if( !FMI_SUPPORT_A622 )
560  GetMenu()->GetSubMenu( 1 )->EnableMenuItem( 9 , MF_BYPOSITION | MF_DISABLED | MF_GRAYED );
561 #endif
562 
563 #if( !FMI_SUPPORT_A623 )
564  GetDlgItem( IDC_MAIN_BTN_ETA_MODE )->EnableWindow( FALSE );
565 #endif
566 
567  switch( FMI_PROTOCOL_LEVEL )
568  {
569  case 0:
570  this->SetWindowText( _T("Fleet Management Controller - Legacy Support Mode") );
571  break;
572  case 602:
573  this->SetWindowText( _T("Fleet Management Controller - A602 Support Mode") );
574  break;
575  case 603:
576  this->SetWindowText( _T("Fleet Management Controller - A603 Support Mode") );
577  break;
578  case 604:
579  this->SetWindowText( _T("Fleet Management Controller - A604 Support Mode") );
580  break;
581  case 605:
582  this->SetWindowText( _T("Fleet Management Controller - A605 Support Mode") );
583  break;
584  case 607:
585  this->SetWindowText( _T("Fleet Management Controller - A607 Support Mode") );
586  break;
587  case 608:
588  this->SetWindowText( _T("Fleet Management Controller - A608 Support Mode") );
589  break;
590  case 610:
591  this->SetWindowText( _T("Fleet Management Controller - A610 Support Mode") );
592  break;
593  case 611:
594  this->SetWindowText( _T("Fleet Management Controller - A611 Support Mode") );
595  break;
596  case 612:
597  this->SetWindowText( _T("Fleet Management Controller - A612 Support Mode") );
598  break;
599  case 613:
600  this->SetWindowText( _T("Fleet Management Controller - A613 Support Mode") );
601  break;
602  case 614:
603  this->SetWindowText( _T("Fleet Management Controller - A614 Support Mode") );
604  break;
605  case 615:
606  this->SetWindowText( _T("Fleet Management Controller - A615 Support Mode") );
607  break;
608  case 616:
609  this->SetWindowText( _T("Fleet Management Controller - A616 Support Mode") );
610  break;
611  case 617:
612  this->SetWindowText( _T("Fleet Management Controller - A617 Support Mode") );
613  break;
614  case 618:
615  this->SetWindowText( _T("Fleet Management Controller - A618 Support Mode") );
616  break;
617  case 619:
618  this->SetWindowText( _T("Fleet Management Controller - A619 Support Mode") );
619  break;
620  case 620:
621  this->SetWindowText( _T("Fleet Management Controller - A620 Support Mode") );
622  break;
623  case 621:
624  this->SetWindowText( _T("Fleet Management Controller - A621 Support Mode") );
625  break;
626  case 622:
627  this->SetWindowText( _T("Fleet Management Controller - A622 Support Mode") );
628  break;
629  case 623:
630  this->SetWindowText( _T("Fleet Management Controller - A623 Support Mode") );
631  break;
632  default:
633  this->SetWindowText( _T("Fleet Management Controller - Unknown Protocol Support Level") );
634  break;
635  }
636 
637  Event::post( EVENT_MAIN_DLG_INIT );
638  return TRUE; // return TRUE unless you set the focus to a control
639 }
640 
641 //----------------------------------------------------------------------
646 //----------------------------------------------------------------------
648 {
649  UpdateData( TRUE );
650  if( mPvtChecked )
651  {
652  mCom.sendEnablePvtCommand( TRUE );
653  }
654  else
655  {
656  mCom.sendEnablePvtCommand( FALSE );
657 
658  mGpsFix.Format( _T("") );
659  mPvtDate.Format( _T("") );
660  mPvtTime.Format( _T("") );
661  mPvtLatitude.Format( _T("") );
662  mPvtLongitude.Format( _T("") );
663  mAltitude.Format( _T("") );
664  mNorthSouthVelocity.Format( _T("") );
665  mEastWestVelocity.Format( _T("") );
666  mUpDownVelocity.Format( _T("") );
667  m2DVelocity.Format( _T("") );
668  UpdateData( FALSE );
669  }
670 }
671 
672 //----------------------------------------------------------------------
676 //----------------------------------------------------------------------
678 {
679  selectComPort();
680 }
681 
682 //----------------------------------------------------------------------
694 //----------------------------------------------------------------------
696 {
697 #if( FMI_SUPPORT_A607 )
698  CFeatureDlg featureDlg( this, mCom );
699  if( IDOK != featureDlg.DoModal() )
700  {
701  return;
702  }
703 #elif( FMI_SUPPORT_A602 )
704  mCom.sendEnable();
705 #endif
706 
707 #if( !( MINIMAL_ENABLE ) )
708  Sleep( 100 ); //Android devices need some extra time to initialize FMI
709 #if( FMI_SUPPORT_A602 )
710  mCom.sendProductRequest();
711 #else
712  mCom.sendLegacyProductRequest();
713 #endif
714 
715  mCom.sendUnitIdRequest();
716 
717 #if( FMI_SUPPORT_A603 )
718  //every time we enable the client, we must refresh all stops
719  //since the client can delete stops and change status without
720  //the servers knowledge
721  FileBackedMap<StopListItem>::const_iterator iter = mCom.mA603Stops.begin();
722  for( ; iter != mCom.mA603Stops.end(); iter++ )
723  {
724  mCom.sendStopStatusRequest( iter->first, REQUEST_STOP_STATUS );
725  }
726  mAutoEtaChecked = TRUE;
727  OnBnClickedAutoETA();
728 #endif // FMI_SUPPORT_A603
729 
730  mPvtChecked = FALSE;
731  UpdateData( FALSE );
732 
733 #if( FMI_SUPPORT_A612 )
734  if ( NULL == mCustomFormsDlg )
735  {
736  mCustomFormsDlg = new CCustomFormsDlg( this, mCom );
737  mCustomFormsDlg->Create( CCustomFormsDlg::IDD );
738  }
739 #endif
740 
741 #if( FMI_SUPPORT_A615 )
742  if ( NULL == mIftaDlg )
743  {
744  mIftaDlg = new CIftaDlg( this, mCom );
745  mIftaDlg->Create( CIftaDlg::IDD );
746  }
747 #endif
748 
749 #if( FMI_SUPPORT_A617 )
750  if ( NULL == mSendAlertDlg )
751  {
752  mSendAlertDlg = new CSendAlertDlg( this, mCom );
753  mSendAlertDlg->Create( CSendAlertDlg::IDD );
754  }
755  if ( NULL == mSendSensorDlg )
756  {
757  mSendSensorDlg = new CSendSensorDlg( this, mCom );
758  mSendSensorDlg->Create( CSendSensorDlg::IDD );
759  }
760 #endif
761 
762 #if( CDT_SUPPORT )
763  //send a CDT ping
764  mCom.txCdt( CDT_PING_REQUEST, NULL, 0 );
765 #endif
766 
767 #endif // !( MINIMAL_ENABLE )
768 }
769 
770 //----------------------------------------------------------------------
774 //----------------------------------------------------------------------
776 {
777  //we use a save file to keep track of stops when the client gets disconnected
778  //from the server--everything works fine if no stops are deleted; however, we
779  //have to assume some are. This requires 2 waves of updates. The first wave
780  //is sent when FMI is enabled. All updates are ignored except deleted stop updates.
781  //Once all delete stops are removed, we can continue as normal and send a second
782  //wave of updates when the user wants to view stops (now)
783  if( !mCom.mStopListInitialized )
784  initStopList();
785 
786  delete mStopListDlg;
787  mStopListDlg = new CStopListDlg( this, mCom );
788  mStopListDlg->Create( IDD_STOP_LIST );
789  mStopListDlg->ShowWindow( SW_SHOW );
790  GetDlgItem( IDC_MAIN_BTN_VIEW_STOPS )->EnableWindow( FALSE );
791 }
792 
793 #if FMI_SUPPORT_A607
794 //----------------------------------------------------------------------
800 //----------------------------------------------------------------------
802 {
803  delete mWaypointDlg;
804  mWaypointDlg = new CWaypointDlg( this, mCom );
805  mWaypointDlg->Create( IDD_WAYPOINT );
806  mWaypointDlg->ShowWindow( SW_SHOW );
807  GetDlgItem( IDC_MAIN_BTN_WAYPOINTS )->EnableWindow( FALSE );
808 }
809 #endif
810 
811 //----------------------------------------------------------------------
813 //----------------------------------------------------------------------
815 {
816  OnOK();
817 }
818 
819 //----------------------------------------------------------------------
823 //----------------------------------------------------------------------
825 {
826  CTxtMsgNewDlg dlg( this, mCom );
827  dlg.DoModal();
828 }
829 
830 //----------------------------------------------------------------------
835 //----------------------------------------------------------------------
837 {
838  OnViewlog();
839 }
840 
841 //----------------------------------------------------------------------
848 //----------------------------------------------------------------------
849 afx_msg LRESULT CFmiPcAppDlg::OnEventCommTimeout( WPARAM, LPARAM )
850 {
851 #if( FMI_SUPPORT_A616 )
852  if( mResolvingCommRate &&
853  tryNextCommRate() )
854  {
855  return 0;
856  }
857 #endif
858 
859  delete mCommErrorDlg;
860  mCommErrorDlg = new CCommErrorDlg( _T("Communication Time Out! Please check all connections."), TRUE, this, mCom );
861  mCommErrorDlg->Create( IDD_ERROR );
862  mCommErrorDlg->ShowWindow( SW_SHOW );
863 
864  return 0;
865 }
866 
867 //----------------------------------------------------------------------
870 //----------------------------------------------------------------------
871 afx_msg LRESULT CFmiPcAppDlg::OnEventCommErrorDlgClosed( WPARAM, LPARAM )
872 {
873  delete mCommErrorDlg;
874  mCommErrorDlg = NULL;
875 
876  return 0;
877 }
878 
879 //----------------------------------------------------------------------
883 //----------------------------------------------------------------------
884 afx_msg LRESULT CFmiPcAppDlg::OnEventEsnReceived( WPARAM, LPARAM )
885 {
886  TCHAR unitId[11];
887 
888  UpdateData( TRUE );
889  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mClientUnitId, -1, unitId, 11 );
890  unitId[10] = '\0';
891  mUnitId.Format( _T(" %s"), unitId );
892  UpdateData( FALSE );
893 
894  return 0;
895 }
896 
897 //----------------------------------------------------------------------
902 //----------------------------------------------------------------------
903 afx_msg LRESULT CFmiPcAppDlg::OnEventLogViewerClosed( WPARAM, LPARAM )
904 {
905  GetDlgItem( IDC_MAIN_BTN_VIEW_LOG )->EnableWindow( TRUE );
906  delete mLogViewerDlg;
907  mLogViewerDlg = NULL;
908 
909  // If a mCom port has not been selected, we are not initialized yet.
910  if( !mComPortSelected )
911  {
912  doComPortQuestion();
913  }
914  return 0;
915 }
916 
917 //----------------------------------------------------------------------
922 //----------------------------------------------------------------------
923 afx_msg LRESULT CFmiPcAppDlg::OnEventMainDlgInit( WPARAM, LPARAM )
924 {
925  doOpenLogFileQuestion();
926 
927  return 0;
928 }
929 
930 //----------------------------------------------------------------------
934 //----------------------------------------------------------------------
935 afx_msg LRESULT CFmiPcAppDlg::OnEventProductIdReceived( WPARAM, LPARAM )
936 {
937  UpdateData( TRUE );
938  mProductId = getProductName( mCom.mClientProductId );
939  mSoftwareVersion.Format( _T("%1.2f"), (float)mCom.mClientSoftwareVersion / 100 );
940  UpdateData( FALSE );
941  return 0;
942 }
943 
944 //----------------------------------------------------------------------
948 //----------------------------------------------------------------------
949 afx_msg LRESULT CFmiPcAppDlg::OnEventProtocolsReceived( WPARAM, LPARAM )
950 {
951  TCHAR protocols[PROTOCOL_SIZE];
952  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mProtocols, -1, protocols, PROTOCOL_SIZE );
953  protocols[PROTOCOL_SIZE - 1] = '\0';
954  mSupportedProtocols.Format( _T("%s"), protocols );
955  GetDlgItem( IDC_MAIN_TXT_PROTOCOLS )->SetWindowText( mSupportedProtocols );
956 
957 #if( FMI_SUPPORT_A616 )
958  // by this point there should be no problem with comm rate resolution
959  mResolvingCommRate = FALSE;
960 #endif
961 
962  return 0;
963 }
964 
965 //----------------------------------------------------------------------
969 //----------------------------------------------------------------------
970 afx_msg LRESULT CFmiPcAppDlg::OnEventPvtReceived( WPARAM, LPARAM )
971 {
972  TCHAR str[15];
973 
974  UpdateData( TRUE );
975  memset( str, 0, sizeof( str ) );
976  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPVTFixType, -1, str, 9 );
977  mGpsFix.Format( _T(" %s"), str );
978  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtDate, -1, str, 11 );
979  mPvtDate.Format( _T(" %s"), str );
980  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtTime, -1, str, 13 );
981  mPvtTime.Format( _T(" %s"), str );
982  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtLatitude, -1, str, 14 );
983  mPvtLatitude.Format( _T(" %s"), str );
984  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtLongitude, -1, str, 14 );
985  mPvtLongitude.Format( _T(" %s"), str );
986  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtAltitude, -1, str, 13 );
987  mAltitude.Format( _T(" %s"), str );
988  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtNorthSouthVelocity, -1, str, 15 );
989  mNorthSouthVelocity.Format( _T(" %s"), str );
990  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtEastWestVelocity, -1, str, 15 );
991  mEastWestVelocity.Format( _T(" %s"), str );
992  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mPvtUpDownVelocity, -1, str, 15 );
993  mUpDownVelocity.Format( _T(" %s"), str );
994  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mHorizontalVelocity, -1, str, 15 );
995  m2DVelocity.Format( _T(" %s"), str );
996  UpdateData( FALSE );
997 
998  return 0;
999 }
1000 
1001 //----------------------------------------------------------------------
1006 //----------------------------------------------------------------------
1007 afx_msg LRESULT CFmiPcAppDlg::OnEventStopListDlgClosed( WPARAM, LPARAM )
1008 {
1009  GetDlgItem( IDC_MAIN_BTN_VIEW_STOPS )->EnableWindow( TRUE );
1010  delete mStopListDlg;
1011  mStopListDlg = NULL;
1012 
1013  return 0;
1014 }
1015 
1016 #if FMI_SUPPORT_A607
1017 //----------------------------------------------------------------------
1022 //----------------------------------------------------------------------
1023 afx_msg LRESULT CFmiPcAppDlg::OnEventWaypointDlgClosed( WPARAM, LPARAM )
1024 {
1025  GetDlgItem( IDC_MAIN_BTN_WAYPOINTS )->EnableWindow( TRUE );
1026  delete mWaypointDlg;
1027  mWaypointDlg = NULL;
1028 
1029  return 0;
1030 }
1031 #endif
1032 
1033 //----------------------------------------------------------------------
1035 //----------------------------------------------------------------------
1037 {
1038  OnOK();
1039 }
1040 
1041 //----------------------------------------------------------------------
1045 //----------------------------------------------------------------------
1047 {
1048  bool logWasOpen = false;
1049 
1050  if( mLogViewerDlg != NULL )
1051  {
1052  logWasOpen = true;
1053  mLogViewerDlg->DestroyWindow();
1054  }
1055 
1056  Logger::clearLog();
1057 
1058  if( logWasOpen )
1059  {
1060  OnViewlog();
1061  }
1062 }
1063 
1064 #if( FMI_SUPPORT_A609 )
1065 //----------------------------------------------------------------------
1071 //----------------------------------------------------------------------
1073  (
1074  CCmdUI * aCmdUI
1075  )
1076 {
1077  aCmdUI->Enable( TRUE );
1078 }
1079 
1080 //----------------------------------------------------------------------
1083 //----------------------------------------------------------------------
1085 {
1086  mCom.rebootDevice();
1087 }
1088 #endif
1089 #if( FMI_SUPPORT_A610 )
1090 //----------------------------------------------------------------------
1096 //----------------------------------------------------------------------
1098  (
1099  CCmdUI * aCmdUI
1100  )
1101 {
1102  aCmdUI->Enable( mCom.mUseAOBRD );
1103 }
1104 
1105 //----------------------------------------------------------------------
1108 //----------------------------------------------------------------------
1110 {
1111  CAobrdDriversDlg dlg( this, mCom );
1112  dlg.DoModal();
1113 }
1114 
1115 //----------------------------------------------------------------------
1118 //----------------------------------------------------------------------
1119 afx_msg LRESULT CFmiPcAppDlg::OnEventAobrdFileTransferReceived( WPARAM, LPARAM )
1120 {
1121  //convert the file to CSV
1122  AobrdEventLogConverter converter;
1124 
1125  return 0;
1126 }
1127 #endif
1128 #if( FMI_SUPPORT_A615 )
1129 //----------------------------------------------------------------------
1132 //----------------------------------------------------------------------
1134 {
1135  mIftaDlg->ShowWindow( SW_SHOW );
1136 }
1137 #endif
1138 
1139 //----------------------------------------------------------------------
1141 //----------------------------------------------------------------------
1143 {
1144  CAboutDlg dlg( this );
1145  dlg.DoModal();
1146 }
1147 
1148 //----------------------------------------------------------------------
1152 //----------------------------------------------------------------------
1154 {
1155  if( IsIconic() )
1156  {
1157  CPaintDC dc( this ); // device context for painting
1158 
1159  SendMessage( WM_ICONERASEBKGND, reinterpret_cast<WPARAM>( dc.GetSafeHdc() ), 0 );
1160 
1161  // Center icon in client rectangle
1162  int cxIcon = GetSystemMetrics( SM_CXICON );
1163  int cyIcon = GetSystemMetrics( SM_CYICON );
1164  CRect rect;
1165  GetClientRect( &rect );
1166  int x = ( rect.Width() - cxIcon + 1 ) / 2;
1167  int y = ( rect.Height() - cyIcon + 1 ) / 2;
1168 
1169  // Draw the icon
1170  dc.DrawIcon( x, y, mIconHandle );
1171  }
1172  else
1173  {
1174  CDialog::OnPaint();
1175  }
1176 }
1177 
1178 //----------------------------------------------------------------------
1182 //----------------------------------------------------------------------
1184 {
1185  return static_cast<HCURSOR>( mIconHandle );
1186 }
1187 
1188 //----------------------------------------------------------------------
1196 //----------------------------------------------------------------------
1198  (
1199  UINT aSystemCommandId,
1200  LPARAM aParam
1201  )
1202 {
1203  if( ( aSystemCommandId & 0xFFF0 ) == IDM_ABOUTBOX )
1204  {
1205  CAboutDlg dlgAbout( this );
1206  dlgAbout.DoModal();
1207  }
1208  else
1209  {
1210  CDialog::OnSysCommand( aSystemCommandId, aParam );
1211  }
1212 }
1213 
1214 //----------------------------------------------------------------------
1223 //----------------------------------------------------------------------
1225  (
1226  UINT aTimerId
1227  )
1228 {
1229  if( !mIgnoreTimer )
1230  {
1231  switch( aTimerId )
1232  {
1233  case MAIN_TIMER_ID:
1234  {
1236  } // end of case MAIN_COMM_TIMER
1237  break;
1238 #if FMI_SUPPORT_A603
1239  case MAIN_ETA_TIMER_ID:
1240  {
1241  mCom.sendEtaRequest();
1242  }
1243  break;
1244 #endif
1245 #if FMI_SUPPORT_A616
1247  {
1248  if( 0 < mBaudRateSyncRetries-- )
1249  {
1250  mCom.retryBaudRateSync();
1251  }
1252  else
1253  {
1254  KillTimer( BAUD_RATE_SYNC_TIMER_ID );
1255  }
1256  }
1257  break;
1258 #endif
1259  } //end of switch( nIdEvent )
1260  } // end of if(!mIgnoreTimer...)
1261 
1262 } // end of CFmiPcAppDlg::OnTimer()
1263 
1264 //----------------------------------------------------------------------
1273 //----------------------------------------------------------------------
1275  (
1276  CCmdUI * aCmdUI
1277  )
1278 {
1279  if( mLogViewerDlg != NULL )
1280  {
1281  aCmdUI->Enable( FALSE );
1282  }
1283  else
1284  {
1285  aCmdUI->Enable( TRUE );
1286  }
1287 }
1288 
1289 //----------------------------------------------------------------------
1295 //----------------------------------------------------------------------
1297  (
1298  BOOL aOpenOther
1299  )
1300 {
1301  delete mLogViewerDlg;
1302 
1303  mLogViewerDlg = new CLogViewerDlg( mLogParser, this, aOpenOther );
1304  mLogViewerDlg->Create( IDD_LOG );
1305  mLogViewerDlg->ShowWindow( SW_SHOW );
1306 
1307  //disable button so multiple dialogs cannot be opened
1308  GetDlgItem( IDC_MAIN_BTN_VIEW_LOG )->EnableWindow( FALSE );
1309 }
1310 
1311 //----------------------------------------------------------------------
1323 //----------------------------------------------------------------------
1325  (
1326  uint16 aProductId
1327  )
1328 {
1329  CString result;
1330  map<uint16, CString>::iterator iter = mProductNames.find( aProductId );
1331  if( iter == mProductNames.end() )
1332  {
1333  result.Format( _T("Unknown (%u)"), aProductId );
1334  }
1335  else
1336  {
1337  result = iter->second;
1338  }
1339 
1340  return result;
1341 }
1342 
1343 //----------------------------------------------------------------------
1345 //----------------------------------------------------------------------
1347 {
1348  mProductNames.clear();
1349  mProductNames[ 404 ] = CString("StreetPilot 2720");
1350  mProductNames[ 412 ] = CString("StreetPilot 7000 Series");
1351  mProductNames[ 481 ] = CString("StreetPilot c340");
1352  mProductNames[ 520 ] = CString("StreetPilot 2820");
1353  mProductNames[ 539 ] = CString("StreetPilot c500 Series");
1354  mProductNames[ 566 ] = CString("nuvi 310/360/370");
1355  mProductNames[ 580 ] = CString("zumo 500 Series");
1356  mProductNames[ 596 ] = CString("nuvi 600 Series");
1357  mProductNames[ 640 ] = CString("nuvi 300/350 Chinese");
1358  mProductNames[ 641 ] = CString("nuvi 300/350 Japanese");
1359  mProductNames[ 642 ] = CString("nuvi 300/350 Thai");
1360  mProductNames[ 643 ] = CString("nuvi 310/360 Chinese");
1361  mProductNames[ 644 ] = CString("nuvi 310/360 Japanese");
1362  mProductNames[ 645 ] = CString("nuvi 310/360 Thai");
1363  mProductNames[ 655 ] = CString("nuvi 310/360 Taiwanese");
1364  mProductNames[ 656 ] = CString("nuvi 310/360 Russian");
1365  mProductNames[ 657 ] = CString("nuvi 310/360 Arabic");
1366  mProductNames[ 706 ] = CString("zumo 500 Series Taiwanese");
1367  mProductNames[ 722 ] = CString("zumo 500 Series Japanese");
1368  mProductNames[ 723 ] = CString("nuvi 500 Series");
1369  mProductNames[ 726 ] = CString("nuvi 800 Series");
1370  mProductNames[ 743 ] = CString("nuvi 5000 Series");
1371  mProductNames[ 754 ] = CString("nuvi 700 Series");
1372  mProductNames[ 827 ] = CString("nuvi 205W Series");
1373  mProductNames[ 836 ] = CString("nuvi 700 Series Taiwanese");
1374  mProductNames[ 844 ] = CString("nuvi 700 Series Chinese");
1375  mProductNames[ 851 ] = CString("nuvi 205 Series");
1376  mProductNames[ 855 ] = CString("nuvi 300/350");
1377  mProductNames[ 856 ] = CString("nuvi 310/360/370");
1378  mProductNames[ 870 ] = CString("nuvi 705 Series");
1379  mProductNames[ 905 ] = CString("nuvi 700 Series Sing/Malay");
1380  mProductNames[ 906 ] = CString("nuvi 700 Series Thai");
1381  mProductNames[ 925 ] = CString("nuvi 700 Series Indonesian");
1382  mProductNames[ 926 ] = CString("nuvi 205 Series Indonesian");
1383  mProductNames[ 927 ] = CString("nuvi 205 Series Sing/Malay");
1384  mProductNames[ 928 ] = CString("nuvi 205 Series Chinese");
1385  mProductNames[ 929 ] = CString("nuvi 205W Series Indonesian");
1386  mProductNames[ 930 ] = CString("nuvi 205W Series Sing/Malay");
1387  mProductNames[ 931 ] = CString("nuvi 205W Series Chinese");
1388  mProductNames[ 932 ] = CString("nuvi 205W Series Taiwanese");
1389  mProductNames[ 933 ] = CString("nuvi 205W Series Japanese");
1390  mProductNames[ 943 ] = CString("nuvi 465T");
1391  mProductNames[ 958 ] = CString("nuvi 5000 Taiwanese");
1392  mProductNames[ 959 ] = CString("nuvi 5000 Chinese");
1393  mProductNames[ 971 ] = CString("nuvi 1200 Series");
1394  mProductNames[ 972 ] = CString("nuvi 1300/1400 Series");
1395  mProductNames[ 1001 ] = CString("nuvi 205W Series Thai");
1396  mProductNames[ 1002 ] = CString("nuvi 205 Series India");
1397  mProductNames[ 1007 ] = CString("nuvi 705 Series Taiwanese");
1398  mProductNames[ 1074 ] = CString("nuvi 205 Series MT");
1399  mProductNames[ 1077 ] = CString("nuvi 1480 Series Japanese");
1400  mProductNames[ 1091 ] = CString("nuvi 205W Series MT");
1401  mProductNames[ 1104 ] = CString("nuvi 1300 Series MT");
1402  mProductNames[ 1106 ] = CString("nuvi 1100/1200 Series MT");
1403  mProductNames[ 1186 ] = CString("nuvi 2200 Series");
1404  mProductNames[ 1187 ] = CString("nuvi 2300 Series");
1405  mProductNames[ 1269 ] = CString("dezl 560 Series");
1406  mProductNames[ 1273 ] = CString("nuvi 2400 Series");
1407  mProductNames[ 1371 ] = CString("nuvi 2555");
1408  mProductNames[ 1389 ] = CString("nuvi 2585TV");
1409  mProductNames[ 1516 ] = CString("dezl 760 Series");
1410  mProductNames[ 1517 ] = CString("nuvi 27x7 Series");
1411  mProductNames[ 1582 ] = CString("nuvi 2xx7 Series"); //Subarctic
1412  mProductNames[ 1758 ] = CString("nuvi 2xx9 Series"); //Subarctic
1413  mProductNames[ 1932 ] = CString("nuvi 27x9 Series"); //Subarctic
1414  mProductNames[ 1947 ] = CString("nuvi 2xx9 Series"); //MStar
1415  mProductNames[ 1948 ] = CString("nuvi 2xx9 Series"); //MStar
1416  mProductNames[ 2002 ] = CString("dezl 770 Series");
1417  mProductNames[ 2003 ] = CString("dezl 570 Series");
1418  mProductNames[ 2043 ] = CString("nuviCam");
1419  mProductNames[ 2062 ] = CString("fleet 660");
1420  mProductNames[ 2063 ] = CString("fleet 670");
1421  mProductNames[ 2077 ] = CString("nuvi 2xx7 Series"); //MStar
1422  mProductNames[ 2141 ] = CString("dezlCam");
1423  mProductNames[ 2267 ] = CString("driveSmart 50");
1424  mProductNames[ 2268 ] = CString("driveSmart 60/70");
1425  mProductNames[ 2270 ] = CString("driveAssist");
1426  mProductNames[ 2569 ] = CString("fleet 660 8GB");
1427  mProductNames[ 2570 ] = CString("fleet 670 8GB");
1428  mProductNames[ 2586 ] = CString("driveSmart 51");
1429  mProductNames[ 2588 ] = CString("driveSmart 61");
1430  mProductNames[ 2590 ] = CString("driveAssist 51");
1431  mProductNames[ 2735 ] = CString("fleet 770");
1432  mProductNames[ 2736 ] = CString("fleet 780");
1433  mProductNames[ 2738 ] = CString("fleet 790, NA");
1434  mProductNames[ 2739 ] = CString("fleet 790, EU");
1435  mProductNames[ 2826 ] = CString("dezl 580 Series");
1436  mProductNames[ 2910 ] = CString("dezl 780 Series");
1437  mProductNames[ 2911 ] = CString("dezlCam 785 Series");
1438  mProductNames[ 2952 ] = CString("fleet 790, AU-NZ");
1439  mProductNames[ 2996 ] = CString("driveSmart 61 APAC");
1440  mProductNames[ 3062 ] = CString("driveSmart 55");
1441  mProductNames[ 3064 ] = CString("driveSmart 65");
1442  mProductNames[ 3109 ] = CString("driveAssist 51 APAC");
1443 }
1444 
1445 //----------------------------------------------------------------------
1450 //----------------------------------------------------------------------
1452 {
1453  mCom.mStopListInitialized = TRUE;
1454 
1455 #if( FMI_SUPPORT_A603 )
1457  for( iter = mCom.mA603Stops.begin(); iter != mCom.mA603Stops.end(); iter++ )
1458  {
1459  mCom.sendStopStatusRequest( iter->first, REQUEST_STOP_STATUS );
1460  }
1461 #endif
1462 }
1463 
1464 //----------------------------------------------------------------------
1467 //----------------------------------------------------------------------
1469 {
1470  CSelectCommPortDlg dlg( this );
1471  if( dlg.DoModal() == IDOK )
1472  {
1473  mComPortSelected = TRUE;
1474 
1475 #if( FMI_SUPPORT_A616 )
1476  //in case the first packet fails, synchronize baud rate with device
1477  mRemainingRates.RemoveAll();
1478  //9600 is the default, so if that doesn't work initially, retry with the alternatives first
1479  mRemainingRates.Add( FMI_BAUD_RATE_38400 );
1480  mRemainingRates.Add( FMI_BAUD_RATE_57600 );
1481  mRemainingRates.Add( FMI_BAUD_RATE_9600 );
1482 
1483  mResolvingCommRate = TRUE;
1484 #endif
1485  OnBnClickedEnable();
1486  mIgnoreTimer = FALSE;
1487 
1488  return TRUE;
1489  }
1490  else
1491  {
1492  return FALSE;
1493  }
1494 }
1495 
1496 //----------------------------------------------------------------------
1501 //----------------------------------------------------------------------
1503 {
1504  if( MessageBox( _T("Would you like to open a log file without connecting to a unit first?"), _T("Question?"), MB_YESNO ) == IDYES )
1505  {
1506  OnViewlog( TRUE );
1507  mIgnoreTimer = FALSE;
1508  }
1509  else
1510  {
1511  doComPortQuestion();
1512  }
1513 }
1514 
1515 //----------------------------------------------------------------------
1520 //----------------------------------------------------------------------
1522 {
1523  mIgnoreTimer = TRUE;
1524  if( !selectComPort() )
1525  {
1526  AfxGetMainWnd()->SendMessage( WM_CLOSE );
1527  }
1528 }
1529 
1530 #if( FMI_SUPPORT_A602 )
1531 //----------------------------------------------------------------------
1539 //----------------------------------------------------------------------
1541 {
1542  char fmiPayloadHex[MAX_PAYLOAD_SIZE * 2];
1543  uint8 fmiPayload[MAX_PAYLOAD_SIZE];
1544  uint8 fmiPayloadSize = 0;
1545  char fmiPacketIdHex[6];
1546  uint16 fmiPacketId = 0;
1547 
1548  //get data
1549  UpdateData( TRUE );
1550  WideCharToMultiByte( mCom.mClientCodepage, 0, mPacketData, -1, fmiPayloadHex, sizeof( fmiPayloadHex ), NULL, NULL );
1551  WideCharToMultiByte( mCom.mClientCodepage, 0, mPacketId, -1, fmiPacketIdHex, sizeof( fmiPacketIdHex ), NULL, NULL );
1552  fmiPayloadHex[MAX_PAYLOAD_SIZE * 2 - 1] = '\0';
1553  fmiPayload[0] = '\0';
1554 
1555  if( !strncmp( fmiPacketIdHex, "0x", 2 ) )
1556  fmiPayloadSize = UTIL_hex_to_uint16( fmiPacketIdHex + 2, &fmiPacketId, 1 );
1557  else
1558  fmiPayloadSize = UTIL_hex_to_uint16( fmiPacketIdHex, &fmiPacketId, 1 );
1559  if( fmiPayloadSize == 0 )
1560  {
1561  MessageBox( _T(" Invalid Hex String in ID field!"), _T("Error!") );
1562  return;
1563  }
1564 
1565  fmiPayloadSize = 0;
1566  if( mPacketData != "" )
1567  {
1568  if( !strncmp( fmiPayloadHex, "0x", 2 ) )
1569  {
1570  fmiPayloadSize = (uint8)UTIL_hex_to_uint8( fmiPayloadHex + 2, (uint8*)fmiPayload, MAX_PAYLOAD_SIZE );
1571  }
1572  else
1573  {
1574  fmiPayloadSize = (uint8)UTIL_hex_to_uint8( fmiPayloadHex, (uint8*)fmiPayload, MAX_PAYLOAD_SIZE );
1575  }
1576  if( fmiPayloadSize == 0 )
1577  {
1578  MessageBox( _T(" Invalid Hex String in Data Field!"), _T("Error!") );
1579  return;
1580  }
1581  }
1582 
1583  mCom.sendFreeformFmiPacket( fmiPacketId, fmiPayload, fmiPayloadSize );
1584 }
1585 
1586 //----------------------------------------------------------------------
1592 //----------------------------------------------------------------------
1593 afx_msg LRESULT CFmiPcAppDlg::OnEventTextMsgAck
1594  (
1595  WPARAM,
1596  LPARAM aEventDataPtr
1597  )
1598 {
1599  const text_msg_ack_event_type * ackEvent = (const text_msg_ack_event_type *)aEventDataPtr;
1600  CTxtMsgAckDlg dlg( this, mCom, ackEvent );
1601  dlg.DoModal();
1602 
1603  delete ackEvent;
1604  return 0;
1605 }
1606 #endif
1607 
1608 #if( FMI_SUPPORT_A603 )
1609 //----------------------------------------------------------------------
1612 //----------------------------------------------------------------------
1614 {
1615  UpdateData( TRUE );
1616  if( mAutoEtaChecked )
1617  {
1618  if( !mEtaTimerEnabled )
1619  {
1620  mEtaTimer = SetTimer( MAIN_ETA_TIMER_ID, MAIN_ETA_TIMER_INTERVAL, NULL );
1621  if( mEtaTimer )
1622  {
1623  mEtaTimerEnabled = true;
1624  }
1625  else
1626  {
1627  ::MessageBox( m_hWnd, _T("Failed to set periodic ETA timer!"), _T("Error"), MB_OK );
1628  mAutoEtaChecked = FALSE;
1629  UpdateData( FALSE );
1630  }
1631  }
1632  }
1633  else
1634  {
1635  if( mEtaTimerEnabled )
1636  {
1637  KillTimer( mEtaTimer );
1638  mEtaTimerEnabled = false;
1639  }
1640  }
1641 }
1642 
1643 //----------------------------------------------------------------------
1648 //----------------------------------------------------------------------
1650 {
1651  CAutoArrivalDlg dlg( this, mCom );
1652  dlg.DoModal();
1653 } /* OnBnClickedChgAutoArvl() */
1654 
1655 //----------------------------------------------------------------------
1660 //----------------------------------------------------------------------
1662 {
1663  CDeleteDataDlg dlg( this, mCom );
1664  dlg.DoModal();
1665 }
1666 
1667 //----------------------------------------------------------------------
1673 //----------------------------------------------------------------------
1675 {
1676  mCom.sendEtaRequest();
1677 } /* OnBnClickedReqETA() */
1678 
1679 //----------------------------------------------------------------------
1684 //----------------------------------------------------------------------
1685 afx_msg LRESULT CFmiPcAppDlg::OnEventEtaReceived( WPARAM, LPARAM )
1686 {
1687  //eta data will be transmitted when an active route starts
1688  //On start up, the server requests the eta to make sure there
1689  //wasn't one active already
1690  TCHAR str[14];
1691  UpdateData( TRUE );
1692  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mEtaTime, -1, str, 13 );
1693  str[12] = '\0';
1694  mEtaTime.Format( _T(" %s"), str );
1695  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mEtaLatitude, -1, str, 14 );
1696  str[13] = '\0';
1697  mEtaLatitude.Format( _T(" %s"), str );
1698  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mEtaLongitude, -1, str, 14 );
1699  str[13] = '\0';
1700  mEtaLongitude.Format( _T(" %s"), str );
1701  MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mEtaDistance, -1, str, 14 );
1702  str[13] = '\0';
1703  mEtaDistance.Format( _T(" %s"), str );
1704  UpdateData( FALSE );
1705  return 0;
1706 }
1707 
1708 //----------------------------------------------------------------------
1712 //----------------------------------------------------------------------
1713 afx_msg LRESULT CFmiPcAppDlg::OnEventStopDone( WPARAM, LPARAM )
1714 {
1715  if( !mCom.mActiveRoute )
1716  {
1717  UpdateData( TRUE );
1718  mEtaTime.Format( _T("") );
1719  mEtaLatitude.Format( _T("") );
1720  mEtaLongitude.Format( _T("") );
1721  mEtaDistance.Format( _T("") );
1722  UpdateData( FALSE );
1723  }
1724  return 0;
1725 }
1726 
1727 //----------------------------------------------------------------------
1733 //----------------------------------------------------------------------
1735  (
1736  WPARAM,
1737  LPARAM aEventDataPtr
1738  )
1739 {
1740  text_msg_from_client_event_type * messageEvent = (text_msg_from_client_event_type *)aEventDataPtr;
1741 
1742  CTxtMsgFromClient dlg( this, mCom, messageEvent );
1743 
1744  dlg.DoModal();
1745  delete messageEvent;
1746 
1747  return 0;
1748 }
1749 #endif
1750 
1751 #if( FMI_SUPPORT_A604 )
1752 //----------------------------------------------------------------------
1758 //----------------------------------------------------------------------
1760 {
1761  delete mCannedResponseDlg;
1762  mCannedResponseDlg = new CManageCannedResponseDlg( this, mCom );
1763  mCannedResponseDlg->Create( IDD_CANNED_RESPONSE );
1764  mCannedResponseDlg->ShowWindow( SW_SHOW );
1765 
1766  GetDlgItem( IDC_MAIN_BTN_CANNED_RESPONSES )->EnableWindow( FALSE );
1767 }
1768 
1769 //----------------------------------------------------------------------
1774 //----------------------------------------------------------------------
1776 {
1777  CFileTransferDlg dlg( this, mCom );
1778  dlg.DoModal();
1779 }
1780 
1781 //----------------------------------------------------------------------
1786 //----------------------------------------------------------------------
1788 {
1789  CGpiQueryDlg dlg( this, mCom );
1790  dlg.DoModal();
1791 }
1792 
1793 //----------------------------------------------------------------------
1799 //----------------------------------------------------------------------
1801 {
1802  delete mDriverIdAndStatusDlg;
1803 
1804  mDriverIdAndStatusDlg = new CDriverIdAndStatusDlg( this, mCom );
1805  mDriverIdAndStatusDlg->Create( IDD_DRIVER_ID_STATUS );
1806  mDriverIdAndStatusDlg->ShowWindow( SW_SHOW );
1807 
1808  GetDlgItem( IDC_MAIN_BTN_DRIVER_INFO )->EnableWindow( FALSE );
1809 }
1810 
1811 //----------------------------------------------------------------------
1817 //----------------------------------------------------------------------
1819 {
1820  delete mCannedTxtMsgDlg;
1821 
1822  mCannedTxtMsgDlg = new CCannedTxtMsgDlg( this, mCom );
1823  mCannedTxtMsgDlg->Create( IDD_CANNED_TXT_MSG );
1824  mCannedTxtMsgDlg->ShowWindow( SW_SHOW );
1825 
1826  GetDlgItem( IDC_MAIN_BTN_CANNED_MESSAGES )->EnableWindow( FALSE );
1827 }
1828 
1829 //----------------------------------------------------------------------
1834 //----------------------------------------------------------------------
1836 {
1837  CTxtMsgStatusRequestDlg dlg( this, mCom );
1838  dlg.DoModal();
1839 }
1840 
1841 //----------------------------------------------------------------------
1847 //----------------------------------------------------------------------
1849 {
1850  CMsgThrottlingDlg dlg( this, mCom );
1851  dlg.DoModal();
1852 }
1853 
1854 //----------------------------------------------------------------------
1859 //----------------------------------------------------------------------
1861 {
1862  CPingStatusDlg dlg( this, mCom );
1863  dlg.DoModal();
1864 }
1865 
1866 //----------------------------------------------------------------------
1871 //----------------------------------------------------------------------
1873 {
1874  CUITextChangeDlg dlg( this, mCom );
1875  dlg.DoModal();
1876 }
1877 
1878 //----------------------------------------------------------------------
1883 //----------------------------------------------------------------------
1884 afx_msg LRESULT CFmiPcAppDlg::OnEventCannedMessageDlgClosed( WPARAM, LPARAM )
1885 {
1886  GetDlgItem( IDC_MAIN_BTN_CANNED_MESSAGES )->EnableWindow( TRUE );
1887  delete mCannedTxtMsgDlg;
1888  mCannedTxtMsgDlg = NULL;
1889 
1890  return 0;
1891 }
1892 
1893 //----------------------------------------------------------------------
1899 //----------------------------------------------------------------------
1901  (
1902  WPARAM aResultCode,
1903  LPARAM
1904  )
1905 {
1906  if( aResultCode == CANNED_RESP_LIST_INVALID_COUNT )
1907  {
1908  AfxGetMainWnd()->MessageBox
1909  (
1910  _T("Invalid Response Count! Retry with a Canned Response List packet with 1-50 Response IDs."),
1911  _T("Canned Response Text Message Failure")
1912  );
1913  }
1914  else if( aResultCode == CANNED_RESP_LIST_INVALID_MSG_ID )
1915  {
1916  AfxGetMainWnd()->MessageBox
1917  (
1918  _T("Invalid Response ID! Retry after ensuring all canned responses are on the client."),
1919  _T("Canned Response Text Message Failure")
1920  );
1921  }
1922  else if( aResultCode == CANNED_RESP_LIST_DUPLICATE_MSG_ID )
1923  {
1924  AfxGetMainWnd()->MessageBox
1925  (
1926  _T("Duplicate Message ID! Retry using a message ID that is not on the client."),
1927  _T("Canned Response Text Message Failure")
1928  );
1929  }
1930  else if( aResultCode == CANNED_RESP_LIST_FULL )
1931  {
1932  AfxGetMainWnd()->MessageBox
1933  (
1934  _T("Canned Response List Database Full! Retry after receiving an acknowledgment for a previous message."),
1935  _T("Canned Response Text Message Failure")
1936  );
1937  }
1938  else
1939  {
1940  AfxGetMainWnd()->MessageBox
1941  (
1942  _T("Unknown error. Please retry."),
1943  _T("Canned Response Text Message Failure")
1944  );
1945  }
1946 
1947  return 0;
1948 }
1949 
1950 //----------------------------------------------------------------------
1955 //----------------------------------------------------------------------
1956 afx_msg LRESULT CFmiPcAppDlg::OnEventCannedResponseDlgClosed( WPARAM, LPARAM )
1957 {
1958  GetDlgItem( IDC_MAIN_BTN_CANNED_RESPONSES )->EnableWindow( TRUE );
1959  delete mCannedResponseDlg;
1960  mCannedResponseDlg = NULL;
1961 
1962  return 0;
1963 }
1964 
1965 //----------------------------------------------------------------------
1970 //----------------------------------------------------------------------
1971 afx_msg LRESULT CFmiPcAppDlg::OnEventDriverIdAndStatusDlgClosed( WPARAM, LPARAM )
1972 {
1973  GetDlgItem( IDC_MAIN_BTN_DRIVER_INFO )->EnableWindow( TRUE );
1974  delete mDriverIdAndStatusDlg;
1975  mDriverIdAndStatusDlg = NULL;
1976 
1977  return 0;
1978 }
1979 
1980 //----------------------------------------------------------------------
1985 //----------------------------------------------------------------------
1986 afx_msg LRESULT CFmiPcAppDlg::OnEventDriverStatusListDeleteFailed( WPARAM, LPARAM )
1987 {
1988  AfxGetMainWnd()->MessageBox
1989  (
1990  _T("Unable to delete driver status item."),
1991  _T("Delete Driver Status Error")
1992  );
1993  return 0;
1994 }
1995 
1996 //----------------------------------------------------------------------
2003 //----------------------------------------------------------------------
2004 afx_msg LRESULT CFmiPcAppDlg::OnEventFmiDisabled( WPARAM, LPARAM )
2005 {
2006  OnOK();
2007 
2008  return 0;
2009 }
2010 
2011 //----------------------------------------------------------------------
2016 //----------------------------------------------------------------------
2017 afx_msg LRESULT CFmiPcAppDlg::OnEventMsgThrottleFailed( WPARAM, LPARAM )
2018 {
2019  AfxGetMainWnd()->MessageBox
2020  (
2021  _T("Invalid protocol ID or state."),
2022  _T("Message Throttling Error")
2023  );
2024  return 0;
2025 }
2026 
2027 //----------------------------------------------------------------------
2034 //----------------------------------------------------------------------
2036  (
2037  WPARAM,
2038  LPARAM aEventDataPtr
2039  )
2040 {
2041  CString errorString;
2042 
2043  MessageId * messageId = (MessageId*)aEventDataPtr;
2044 
2045  errorString.Format( _T("Text Message with id %s already exists!"), messageId->toCString( mCom.mClientCodepage ) );
2046  AfxGetMainWnd()->MessageBox( errorString, _T("Open Text Message Failure" ) );
2047  delete messageId;
2048 
2049  return 0;
2050 }
2051 //----------------------------------------------------------------------
2057 //----------------------------------------------------------------------
2058 afx_msg LRESULT CFmiPcAppDlg::OnEventTxtMsgStatus
2059  (
2060  WPARAM,
2061  LPARAM aEventDataPtr
2062  )
2063 {
2064  text_msg_status_event_type* statusEvent = (text_msg_status_event_type*)aEventDataPtr;
2065  if( mTxtMsgStatusDlg != NULL )
2066  {
2067  mTxtMsgStatusDlg->EndDialog( IDCANCEL );
2068  mTxtMsgStatusDlg = NULL;
2069  }
2070  CTxtMsgStatusDlg dlg( this, mCom, statusEvent ); //same as above
2071  mTxtMsgStatusDlg = &dlg; //keep track of this dialog so if another comes along
2072  dlg.DoModal(); //we can close this one
2073  mTxtMsgStatusDlg = NULL;
2074 
2075  delete statusEvent;
2076 
2077  return 0;
2078 }
2079 
2080 //----------------------------------------------------------------------
2085 //----------------------------------------------------------------------
2087 {
2088  AfxGetMainWnd()->MessageBox( _T("Updating UI Text Failed!"), _T("Error!") );
2089  return 0;
2090 }
2091 #endif
2092 
2093 #if (FMI_SUPPORT_A606)
2094 //---------------------------------------------------------------------
2099 //----------------------------------------------------------------------
2101 {
2102  CSafeModeDlg dlg( this, mCom );
2103  dlg.DoModal();
2104 }
2105 
2106 //----------------------------------------------------------------------
2111 //----------------------------------------------------------------------
2112 afx_msg LRESULT CFmiPcAppDlg::OnEventFmiSafeModeError( WPARAM, LPARAM )
2113 {
2114  CString *errorString = new CString( "Error setting FMI Safe Mode!" );
2115 
2116  AfxGetMainWnd()->MessageBox( *errorString, _T( "FMI Safe Mode Failure" ) );
2117 
2118  return 0;
2119 }
2120 #endif
2121 
2122 #if( FMI_SUPPORT_A607 )
2123 //----------------------------------------------------------------------
2128 //----------------------------------------------------------------------
2130 {
2131  CTxtMsgDeleteRequestDlg dlg( this, mCom );
2132  dlg.DoModal();
2133 }
2134 
2135 //----------------------------------------------------------------------
2141 //----------------------------------------------------------------------
2143  (
2144  WPARAM aEventData,
2145  LPARAM
2146  )
2147 {
2148  boolean deleteSuccessful = (boolean)aEventData;
2149 
2150  if( deleteSuccessful )
2151  {
2152  AfxGetMainWnd()->MessageBox( _T("Text Message Deleted"), _T("Error!") );
2153  }
2154  else
2155  {
2156  AfxGetMainWnd()->MessageBox( _T("Text Message Delete failed. Check Message ID and try again"), _T("Error!") );
2157  }
2158 
2159  return 0;
2160 }
2161 
2162 #endif
2163 
2164 #if( FMI_SUPPORT_A608 )
2165 //---------------------------------------------------------------------
2170 //----------------------------------------------------------------------
2172 {
2173  CSpeedLimitAlertsDlg dlg( this, mCom );
2174  dlg.DoModal();
2175 }
2176 #endif
2177 
2178 #if( FMI_SUPPORT_A610 )
2179 //---------------------------------------------------------------------
2184 //----------------------------------------------------------------------
2186 {
2187  CAobrdOdometerDlg dlg( this, mCom );
2188  dlg.DoModal();
2189 }
2190 #endif
2191 
2192 #if( FMI_SUPPORT_A611 )
2193 //----------------------------------------------------------------------
2200 //----------------------------------------------------------------------
2202  (
2203  WPARAM aResultCode,
2204  LPARAM aEventDataPtr
2205  )
2206 {
2207  CString errorString;
2208 
2209  MessageId * messageId = (MessageId*)aEventDataPtr;
2210 
2211  switch( aResultCode )
2212  {
2214  errorString.Format( _T("Text Message id %s is an invalid size!"), messageId->toCString( mCom.mClientCodepage ) );
2215  break;
2217  errorString.Format( _T("Text Message with id %s did not start its sequence numbers at zero!"), messageId->toCString( mCom.mClientCodepage ) );
2218  break;
2220  errorString.Format( _T("Text Message with id %s already exists!"), messageId->toCString( mCom.mClientCodepage ) );
2221  break;
2223  errorString.Format( _T("Text Message with id %s already exists!"), messageId->toCString( mCom.mClientCodepage ) );
2224  break;
2226  errorString.Format( _T("Text Message with id %s could not be allocated memory!"), messageId->toCString( mCom.mClientCodepage ) );
2227  break;
2229  errorString.Format( _T("Text Message id %s is an invalid size!"), messageId->toCString( mCom.mClientCodepage ) );
2230  break;
2232  errorString.Format( _T("Text Message with id %s is the wrong id for long message continuation!"), messageId->toCString( mCom.mClientCodepage ) );
2233  break;
2235  errorString.Format( _T("Text Message with id %s did not increment its sequence numbers!"), messageId->toCString( mCom.mClientCodepage ) );
2236  break;
2238  errorString.Format( _T("Text Message with id %s did not have a matching origination time!"), messageId->toCString( mCom.mClientCodepage ) );
2239  break;
2241  errorString.Format( _T("Text Message with id %s did not have a matching message type!"), messageId->toCString( mCom.mClientCodepage ) );
2242  break;
2244  errorString.Format( _T("Text Message with id %s exceeds the maximum length!"), messageId->toCString( mCom.mClientCodepage ) );
2245  break;
2247  errorString.Format( _T("Text Message with id %s had an early null terminator!"), messageId->toCString( mCom.mClientCodepage ) );
2248  break;
2250  errorString.Format( _T("Text Message with id %s had an early null terminator!"), messageId->toCString( mCom.mClientCodepage ) );
2251  break;
2253  errorString.Format( _T("Text Message with id %s could not be allocated memory!"), messageId->toCString( mCom.mClientCodepage ) );
2254  break;
2256  errorString.Format( _T("Text Message with id %s could not be saved on the device's database!"), messageId->toCString( mCom.mClientCodepage ) );
2257  break;
2258  }
2259 
2260  AfxGetMainWnd()->MessageBox( errorString, _T("Long Text Message Failure" ) );
2261  delete messageId;
2262 
2263  return 0;
2264 }
2265 #endif
2266 
2267 #if( FMI_SUPPORT_A612 )
2268 //----------------------------------------------------------------------
2271 //----------------------------------------------------------------------
2273 {
2274  mCustomFormsDlg->ShowWindow( SW_SHOW );
2275 }
2276 
2277 #endif
2278 
2279 #if( FMI_SUPPORT_A613 )
2280 //----------------------------------------------------------------------
2283 //----------------------------------------------------------------------
2285 {
2286  if ( mMapViewerDlg == NULL )
2287  {
2288  mMapViewerDlg = new CMapViewerDlg( this, mCom );
2289  mMapViewerDlg->Create( CMapViewerDlg::IDD );
2290  }
2291  mMapViewerDlg->ShowWindow( SW_SHOW );
2292 }
2293 #endif
2294 
2295 #if( FMI_SUPPORT_A615 )
2296 //----------------------------------------------------------------------
2299 //----------------------------------------------------------------------
2301 {
2302  BOOL enabled = FALSE;
2303  uint16 settingValue = 0;
2304  UINT result = CHosSettingDlg::CaptureSetting( this,
2308  0, 65535,
2309  enabled, settingValue );
2310  if( IDOK == result )
2311  {
2312 #if( FMI_SUPPORT_A619 )
2314  memset( &setThreshold, 0, sizeof( setThreshold ) );
2316  setThreshold.enable = enabled;
2317  setThreshold.settings_value = settingValue;
2318  mCom.sendFmiPacket( FMI_HOS_SET_SETTING_DATA_REQUEST, ( uint8* ) &setThreshold, sizeof( setThreshold ) );
2319 #else
2321  memset( &message, 0, sizeof( message ) );
2322  message.enable = enabled;
2323  if( message.enable )
2324  {
2325  message.stop_moving_threshold = settingValue;
2326  }
2327 
2328  mCom.sendFmiPacket( FMI_HOS_AUTO_STATUS_FEATURE_REQUEST, (uint8*)&message, sizeof( message ) );
2329 #endif
2330  }
2331 }
2332 
2333 #if( FMI_SUPPORT_A619 )
2334 //----------------------------------------------------------------------
2337 //----------------------------------------------------------------------
2339 {
2340  BOOL enabled = FALSE;
2341  uint16 settingValue = 0;
2342  UINT result = CHosSettingDlg::CaptureSetting( this,
2346  0, 65535,
2347  enabled, settingValue );
2348  if( IDOK == result )
2349  {
2351  memset( &setThreshold, 0, sizeof( setThreshold ) );
2353  setThreshold.enable = enabled;
2354  setThreshold.settings_value = settingValue;
2355  mCom.sendFmiPacket( FMI_HOS_SET_SETTING_DATA_REQUEST, ( uint8* ) &setThreshold, sizeof( setThreshold ) );
2356  }
2357 }
2358 #endif
2359 
2360 //----------------------------------------------------------------------
2362 //----------------------------------------------------------------------
2364  {
2365  GetMenu()->GetSubMenu( 1 )->GetSubMenu( 5 )->CheckMenuRadioItem( ID_8HOURRULE_ENABLE, ID_8HOURRULE_DISABLE, ID_8HOURRULE_ENABLE, 0 );
2366 #if( FMI_SUPPORT_A619 )
2368  memset( &request, 0, sizeof( request ) );
2370  request.enable = true;
2371  mCom.sendFmiPacket( FMI_HOS_SET_SETTING_DATA_REQUEST, ( uint8* ) &request, sizeof( request ) );
2372  return;
2373 #else
2374  boolean hos8HourRuleEnabled = true;
2375  mCom.sendFmiPacket( FMI_HOS_8_HOUR_RULE_ENABLE_REQUEST, ( uint8* ) &hos8HourRuleEnabled, sizeof( boolean ) );
2376 #endif
2377  }
2378 
2379 //----------------------------------------------------------------------
2381 //----------------------------------------------------------------------
2383  {
2384  GetMenu()->GetSubMenu( 1 )->GetSubMenu( 5 )->CheckMenuRadioItem( ID_8HOURRULE_ENABLE, ID_8HOURRULE_DISABLE, ID_8HOURRULE_DISABLE, 0 );
2385 #if( FMI_SUPPORT_A619 )
2387  memset( &request, 0, sizeof( request ) );
2389  request.enable = false;
2390  mCom.sendFmiPacket( FMI_HOS_SET_SETTING_DATA_REQUEST, ( uint8* ) &request, sizeof( request ) );
2391  return;
2392 #else
2393  boolean hos8HourRuleEnabled = false;
2394  mCom.sendFmiPacket( FMI_HOS_8_HOUR_RULE_ENABLE_REQUEST, ( uint8* ) &hos8HourRuleEnabled, sizeof( boolean ) );
2395 #endif
2396  }
2397 #endif
2398 
2399 #if( FMI_SUPPORT_A616 )
2400 //----------------------------------------------------------------------
2403 //----------------------------------------------------------------------
2405 {
2406  CChangeBaudRateDlg dlg( this, mCom );
2407  dlg.DoModal();
2408 }
2409 
2410 //----------------------------------------------------------------------
2415 //----------------------------------------------------------------------
2417  {
2418  if( 0 == mRemainingRates.GetCount() )
2419  {
2420  mResolvingCommRate = FALSE;
2421  // this should only be reached after sync attempts for all supported rates result in timeout
2422  ::MessageBox( m_hWnd, _T( "Unable to establish communication with any of the supported BAUD rates" ), _T("Error"), MB_OK | MB_ICONERROR );
2423  if( !selectComPort())
2424  {
2425  AfxGetMainWnd()->SendMessage( WM_CLOSE );
2426  return false;
2427  }
2428  }
2429  else {
2430  // attempt to establish communication at current rate option
2431  // if that fails, a timeout will return control here to try the next rate
2432  switch( mRemainingRates[ 0 ] )
2433  {
2434  case FMI_BAUD_RATE_9600:
2435  {
2437  break;
2438  }
2439  case FMI_BAUD_RATE_38400:
2440  {
2442  break;
2443  }
2444  case FMI_BAUD_RATE_57600:
2445  {
2447  break;
2448  }
2449  }
2450  mRemainingRates.RemoveAt( 0 );
2451 
2452  // attempt to transmit the enable packet again
2453  mCom.clearError();
2454  }
2455 
2456  return true;
2457  }
2458 
2460 {
2461  KillTimer( BAUD_RATE_SYNC_TIMER_ID );
2462  mBaudRateSyncRetries = BAUD_RATE_SYNC_RETRY_COUNT;
2464  return 0;
2465 }
2466 
2468 {
2469  KillTimer( BAUD_RATE_SYNC_TIMER_ID );
2470  mBaudRateSyncRetries = 0;
2471  return 0;
2472 }
2473 
2474 
2475 #endif
2476 
2477 #if( FMI_SUPPORT_A617 )
2478 //----------------------------------------------------------------------
2481 //----------------------------------------------------------------------
2483 {
2484  mSendAlertDlg->reset();
2485  mSendAlertDlg->ShowWindow( SW_SHOW );
2486 }
2487 //----------------------------------------------------------------------
2490 //----------------------------------------------------------------------
2492 {
2493  mSendSensorDlg->reset();
2494  mSendSensorDlg->ShowWindow( SW_SHOW );
2495 }
2496 #endif
2497 
2498 #if( CDT_SUPPORT )
2499 LRESULT CFmiPcAppDlg::OnCDTPingReceived( WPARAM, LPARAM )
2500 {
2501  GetMenu()->GetSubMenu( 1 )->GetSubMenu( 7 )->EnableMenuItem( 0, MF_BYPOSITION | MF_ENABLED );
2502  return 0;
2503 }
2504 
2505 LRESULT CFmiPcAppDlg::OnCDTPacketReceived( WPARAM wParam, LPARAM lParam )
2506 {
2507  OnToolsCDTChat();
2508 
2509  return 0;
2510 }
2511 
2512 //----------------------------------------------------------------------
2515 //----------------------------------------------------------------------
2516 void CFmiPcAppDlg::OnToolsCDTChat()
2517 {
2518  if ( mCdtChatDlg == NULL )
2519  {
2520  mCdtChatDlg = new CCdtChatDlg( this, mCom );
2521  mCdtChatDlg->Create( CCdtChatDlg::IDD );
2522  }
2523  mCdtChatDlg->ShowWindow( SW_SHOW );
2524 }
2525 
2526 //----------------------------------------------------------------------
2529 //----------------------------------------------------------------------
2530 void CFmiPcAppDlg::OnToolsCDTPingOnce()
2531 {
2532  mCom.txCdt( CDT_PING_REQUEST, NULL, 0 );
2533 }
2534 
2535 //----------------------------------------------------------------------
2538 //----------------------------------------------------------------------
2539 void CFmiPcAppDlg::OnToolsCDTPingTool()
2540 {
2541  if ( mCdtPingDlg == NULL )
2542  {
2543  mCdtPingDlg = new CCdtPingDlg( this, mCom );
2544  mCdtPingDlg->Create( CCdtPingDlg::IDD );
2545  }
2546  mCdtPingDlg->ShowWindow( SW_SHOW );
2547 }
2548 
2549 #endif
2550 
2551 #if( FMI_SUPPORT_A620 )
2553 {
2554  COleDateTime settingValue = COleDateTime::GetCurrentTime();
2555  settingValue.SetTime( 0, 0, 0 );
2556  UINT result = CTimeOfDayPickerDlg::CaptureSetting( this,
2559  settingValue );
2560  if( IDOK == result )
2561  {
2563  memset( &setThreshold, 0, sizeof( setThreshold ) );
2564  setThreshold.tag = HOS_SETTING_START_TIME_OF_DAY;
2565  setThreshold.enable = TRUE;
2566  setThreshold.settings_value = ( settingValue.GetHour() * 60 ) + settingValue.GetMinute();
2567  mCom.sendFmiPacket( FMI_HOS_SET_SETTING_DATA_REQUEST, ( uint8* ) &setThreshold, sizeof( setThreshold ) );
2568  }
2569 }
2570 #endif
2571 
2572 #if( FMI_SUPPORT_A622 )
2573 //----------------------------------------------------------------------
2576 //----------------------------------------------------------------------
2578 {
2579  delete mDashcamDlg;
2580  mDashcamDlg = new CDashcamDlg( this, mCom );
2581  mDashcamDlg->Create( CDashcamDlg::IDD );
2582  mDashcamDlg->ShowWindow( SW_SHOW );
2583 }
2584 
2585 //----------------------------------------------------------------------
2588 //----------------------------------------------------------------------
2590 {
2591  delete mDashcamNtfctnDlg;
2592  mDashcamNtfctnDlg = new CDashcamNtfctnDlg( this, mCom );
2593  mDashcamNtfctnDlg->Create( CDashcamNtfctnDlg::IDD );
2594  mDashcamNtfctnDlg->ShowWindow( SW_SHOW );
2595 }
2596 
2597 //----------------------------------------------------------------------
2600 //----------------------------------------------------------------------
2602 {
2603  delete mFileConverterDlg;
2604  mFileConverterDlg = new CFileConverterDlg( this, mCom );
2605  mFileConverterDlg->Create( CFileConverterDlg::IDD );
2606  mFileConverterDlg->ShowWindow( SW_SHOW );
2607 }
2608 
2609 //----------------------------------------------------------------------
2615 //----------------------------------------------------------------------
2617  (
2618  WPARAM,
2619  LPARAM aEventDataPtr
2620  )
2621 {
2622  fmi_dashcam_ntfctn_req_data_type * messageEvent = (fmi_dashcam_ntfctn_req_data_type *)aEventDataPtr;
2623 
2624  CDashcamNtfctnFromClient dlg( this, mCom, *messageEvent );
2625 
2626  dlg.DoModal();
2627  delete messageEvent;
2628 
2629  return 0;
2630 }
2631 
2632 //----------------------------------------------------------------------
2638 //----------------------------------------------------------------------
2640  (
2641  WPARAM,
2642  LPARAM aEventDataPtr
2643  )
2644 {
2646 
2647  CDashcamNtfctnFromClient dlg( this, mCom, *messageEvent );
2648 
2649  dlg.DoModal();
2650  delete messageEvent;
2651 
2652  return 0;
2653 }
2654 #endif
2655 
2656 #if( FMI_SUPPORT_A623 )
2657 //----------------------------------------------------------------------
2662 //----------------------------------------------------------------------
2664 {
2665  CEtaModeDlg dlg( this, mCom );
2666  dlg.DoModal();
2667 } /* OnBnClickedETAMode() */
2668 
2669 //----------------------------------------------------------------------
2674 //----------------------------------------------------------------------
2675 afx_msg LRESULT CFmiPcAppDlg::OnEventEtaModeReceived( WPARAM, LPARAM )
2676 {
2677  UpdateData( TRUE );
2678  uint8 mode = mCom.mEtaMode;
2679 
2680  switch( mode )
2681  {
2682  case ETA_SETTING_NONE:
2683  mEtaMode = _T("0 - None");
2684  break;
2685  case ETA_SETTING_DISPATCH:
2686  mEtaMode = _T("1 - Dispatch Stops");
2687  break;
2688  case ETA_SETTING_DRIVER:
2689  mEtaMode = _T("2 - Driver Initiated Stops");
2690  break;
2692  mEtaMode = _T("3 - Dispatch or Driver Initiated Stops");
2693  break;
2694  default: // Unknown value -- leave the current value as-is
2695  break;
2696  }
2697  UpdateData( FALSE );
2698 
2699  return 0;
2700 }
2701 #endif
afx_msg void OnBnClickedMsgThrottling()
Click handler for the Message Throttling button.
#define IDC_MAIN_TXT_PVT_TIME
Definition: resource.h:132
#define ID_TOOLS_CAMERA_NOTIFICATIONS
Definition: resource.h:609
afx_msg LRESULT OnEventCommErrorDlgClosed(WPARAM, LPARAM)
Handle the Comm Error Dlg Closed event.
#define IDC_MAIN_EDIT_FMI_ID
Definition: resource.h:89
Main application dialog.
Definition: CFmiPcAppDlg.h:64
#define ID_FILE_CLEARPACKETLOG
Definition: resource.h:590
afx_msg void OnUpdateFileViewlog(CCmdUI *aCmdUI)
ON_UPDATE_COMMAND_UI handler for File > View Log menu item.
afx_msg void OnBnClickedSpeedLimit()
Click handler for the FMI Speed Limit Alerts button.
#define ID_HOS_SETSTARTTIMEOFDAY
Definition: resource.h:606
afx_msg LRESULT OnEventStopDone(WPARAM, LPARAM)
Handler for the Stop Done event from Com.
afx_msg void OnToolsFileConverter()
Handler for the Tools > File Converter action.
#define IDC_MAIN_TXT_PVT_2D_VEL
Definition: resource.h:124
afx_msg LRESULT OnEventStopListDlgClosed(WPARAM, LPARAM)
Handler for Stop List Dialog Closed event.
#define ID_8HOURRULE_DISABLE
Definition: resource.h:600
const_iterator begin()
Iterator positioned at the first element in the map.
Definition: FileBackedMap.h:59
afx_msg LRESULT OnEventCannedMessageDlgClosed(WPARAM, LPARAM)
Handler for Canned Text Message Dialog Closed event.
afx_msg LRESULT OnEventMainDlgInit(WPARAM, LPARAM)
Handler for Main Dialog Init question.
afx_msg HCURSOR OnQueryDragIcon()
The system calls this function to obtain the cursor to display while the user drags the minimized win...
virtual bool setBaudRate(uint32 aBaudRate)
Set the baud rate.
Definition: SerialPort.cpp:504
Browser-based container for listing the Dashcam library.
#define BAUD_RATE_SYNC_TIMER_INTERVAL
Interval between Baud Rate Sync retries, in milliseconds.
#define ID_HELP_ABOUT
Definition: resource.h:588
afx_msg void OnToolsConfigureHosPeriodicUpdates()
Handler for the HOS Periodic Updates configuration button.
#define IDC_MAIN_BTN_UI_TXT_CHG
Definition: resource.h:83
afx_msg LRESULT OnEventWaypointDlgClosed(WPARAM, LPARAM)
Handler for Stop List Dialog Closed event.
Modal dialog allowing the user to query the file version and size of the FMI GPI file on the client d...
Definition: CGpiQueryDlg.h:25
#define IDC_MAIN_TXT_PVT_UD_VEL
Definition: resource.h:133
afx_msg void OnTimer(UINT aTimerId)
WM_TIMER event handler.
Browser-based container for listing the Custom Avoidances library.
Definition: CMapViewerDlg.h:24
afx_msg void OnBnClickedDelData()
Click handler for the Delete Data button.
Dialog allowing the user to manage canned responses.
afx_msg void OnBnClickedManageCannedMsg()
Click handler for the Canned Messages button.
#define IDC_MAIN_BTN_FMI_SEND
Definition: resource.h:74
Data type for HOS Settings Request Packet ID (0x1500) from server to client.
Definition: fmi.h:2217
Modeless dialog allowing the user to manage the A603 stops on the client device.
Definition: CStopListDlg.h:25
afx_msg LRESULT OnEventTextMsgAck(WPARAM, LPARAM aEventDataPtr)
Handler for the Text Message Ack Received event from Com.
Data type for Dashcam Notification Packet ID (0X160C) from client to server (request) ...
Definition: fmi.h:2337
#define IDC_MAIN_TXT_ETA_MODE
Definition: resource.h:138
#define IDC_MAIN_BTN_SEND_ALERT
Definition: resource.h:435
#define IDC_MAIN_BTN_MSG_DELETE
Definition: resource.h:135
afx_msg void OnToolsHOS8HourRuleDisable()
Disable the HOS 8 Hour Rule on the device.
Dialog allowing the user to change speed limit alerts settings.
afx_msg void OnToolsCameraNtfctn()
Handler for the Tools > Camera > Notifications action.
afx_msg LRESULT OnEventFmiSafeModeError(WPARAM, LPARAM)
Handler for the FMI Safe Mode event from Com.
afx_msg void OnViewlog(BOOL aOpenOther=FALSE)
Display the log viewer.
#define IDS_HOS_START_TIME_OF_DAY_TITLE
Definition: resource.h:23
Modal pop-up dialog displaying the status of a server to client text message.
Modal pop up dialog displaying a client to server open text message.
static void clearLog()
Empties the packet log.
Definition: Logger.cpp:83
#define IDC_MAIN_LBL_ETA_LAT
Definition: resource.h:99
void doOpenLogFileQuestion()
Ask the user whether to open a log file.
afx_msg void OnFileAOBRDDrivers()
Handler for the File > AOBRD Drivers.
afx_msg void OnBnClickedIdStatus()
Click handler for the Driver ID and Status button.
afx_msg void OnBnClickedCheckPVT()
Click handler for the Enable PVT check box.
Dialog allowing the user to delete specified FMI data from the client.
Modal dialog allowing the user to request the status of a server to client text message.
uint8 id_type
Garmin packet ID.
Definition: garmin_types.h:101
Form for sending A617 alerts to the device.
Definition: CSendAlertDlg.h:10
Dialog allowing the user to manage the list of canned messages on the client.
Data type for Dashcam Notification Packet ID (0X1606) from client to server (request) ...
Definition: fmi.h:2328
#define FMI_PROTOCOL_LEVEL
Definition: fmi.h:23
STL namespace.
afx_msg LRESULT OnEventEtaModeReceived(WPARAM, LPARAM)
Handler for the ETA Mode Received event from Com.
#define BAUD_RATE_SYNC_RETRY_COUNT
Number of times to retry Baud Rate Sync.
Modal dialog allowing the user to select the port to use to communicate with the client.
Dialog allowing the user to manage AOBRD drivers.
static UINT CaptureSetting(CWnd *pParent, UINT titleStringId, UINT valueLabelStringId, COleDateTime &value)
#define IDC_MAIN_GRP_FMI_PACKET
Definition: resource.h:92
Modeless log viewer dialog.
Definition: CLogViewerDlg.h:31
#define IDD_ERROR
Definition: resource.h:27
static UINT CaptureSetting(CWnd *pParent, UINT titleStringId, UINT valueLabelStringId, UINT valueUnitStringId, long valueLowerLimit, long valueUpperLimit, BOOL &enabled, uint16 &value)
uint8 UTIL_hex_to_uint16(const char *aHexString, uint16 *aBinaryData, uint8 aMaxWords)
Converts a null-terminated string in hexadecimal format to an array of uint16 numbers, assuming natural byte ordering in the hex. No prefix should be present in the hex string.
Definition: util.cpp:411
const_iterator end()
Iterator positioned after the last element in the map.
Definition: FileBackedMap.h:67
afx_msg LRESULT OnEventAobrdFileTransferReceived(WPARAM, LPARAM)
Attempt to convert received file into human-readable CSV.
#define IDD_WAYPOINT
Definition: resource.h:45
Modal dialog allowing the user to throttle (disable) or un-throttle (enable) certain client-initiated...
afx_msg void OnBnClickedManageStops()
Click handler for the Manage Stops button.
CString getProductName(uint16 aProductId)
Translate a product ID into a display name.
#define FALSE
Definition: garmin_types.h:46
afx_msg void OnToolsHOS8HourRuleEnable()
Enable the HOS 8 Hour Rule on the device.
#define IDC_MAIN_TXT_PVT_DATE
Definition: resource.h:126
Utility for converting between raw AOBRD data to human- readable CSV file. Used to attempt to auto-co...
#define PROTOCOL_SIZE
Size of the formatted "supported protocols" string.
Definition: fmi.h:157
virtual BOOL OnInitDialog()
Initialize the dialog.
Browser-based container for listing the Custom Forms library.
afx_msg void OnBnClickedChgAutoArvl()
Click handler for the Change Auto-Arrival button.
#define IDS_HOS_REPORT_STATUS_UPDATES_TITLE
Definition: resource.h:17
void doComPortQuestion()
Ask the user to select a mCom port.
#define IDC_MAIN_TXT_PVT_EW_VEL
Definition: resource.h:127
Browser-based container for listing the Dashcam library.
Definition: CDashcamDlg.h:21
afx_msg void OnBnClickedSendAlert()
Handler for the Send Alert button.
#define IDC_MAIN_BTN_CHG_AUTO_ARVL
Definition: resource.h:70
unsigned char boolean
8-bit value representing FALSE (0) or TRUE (nonzero)
Definition: garmin_types.h:52
#define IDS_HOS_REPORT_STATUS_UPDATES_VALUE_UNIT
Definition: resource.h:21
afx_msg LRESULT OnEventDashcamNtfctnFromClient(WPARAM, LPARAM)
Handler for the Dashcam Notification Received event from Com.
#define IDC_MAIN_BTN_VIEW_STOPS
Definition: resource.h:85
afx_msg LRESULT OnEventMsgThrottleFailed(WPARAM, LPARAM)
Handler for the Message Throttle Failed event from Com.
#define IDC_MAIN_TXT_PRODUCT_ID
Definition: resource.h:122
#define IDS_HOS_REPORT_STATUS_UPDATES_VALUE_LABEL
Definition: resource.h:19
#define TRUE
Definition: garmin_types.h:45
#define IDC_MAIN_TXT_ETA_DISTANCE
Definition: resource.h:118
#define IDC_MAIN_CHK_PVT_ENABLE
Definition: resource.h:87
#define ID_TOOLS_IFTA
Definition: resource.h:596
#define IDC_MAIN_BTN_DEL_DATA
Definition: resource.h:72
FMI Feature (enable) modal dialog.
Definition: CFeatureDlg.h:22
#define IDC_MAIN_TXT_ETA_LAT
Definition: resource.h:119
#define ID_CONFIGURE_HOS_PERIODIC_UPDATES
Definition: resource.h:601
#define IDC_MAIN_BTN_SEND_SENSOR
Definition: resource.h:437
About box for this application.
Definition: CAboutDlg.h:22
CString toCString(codepage_type aCodePage) const
CString representation of the message ID.
Definition: MessageId.cpp:167
Modeless dialog allowing the user to manage waypoints.
Definition: CWaypointDlg.h:24
#define IDC_MAIN_BTN_AUTO_STATUS_UPDATES
Definition: resource.h:431
#define IDS_HOS_AUTO_STATUS_UPDATES_VALUE_LABEL
Definition: resource.h:13
afx_msg void OnUpdateFileRebootDevice(CCmdUI *aCmdUI)
ON_UPDATE_COMMAND_UI handler for File > Reboot Device menu item.
#define IDC_MAIN_LBL_ETA_TIME
Definition: resource.h:101
afx_msg void OnBnClickedAobrdOdometer()
Click handler for the AOBRD Set Odometer button.
afx_msg LRESULT OnEventLogViewerClosed(WPARAM, LPARAM)
Handler for Log Viewer Closed event.
#define IDC_MAIN_TXT_ESN
Definition: resource.h:117
#define IDC_MAIN_BTN_SEND_ENABLE
Definition: resource.h:81
#define IDC_MAIN_LBL_FMI_DATA
Definition: resource.h:102
#define IDC_MAIN_LBL_FMI_ID
Definition: resource.h:103
#define IDC_MAIN_BTN_MSG_STATUS
Definition: resource.h:77
afx_msg LRESULT OnEventCannedResponseDlgClosed(WPARAM, LPARAM)
Handler for Canned Response Dialog Closed event.
Data type for the HOS Auto Status Update Enable Packet ID (0X1300) from server to client...
Definition: fmi.h:2054
#define IDC_MAIN_BTN_VIEW_LOG
Definition: resource.h:84
#define IDD_CANNED_RESPONSE
Definition: resource.h:18
afx_msg void OnToolsCustomForms()
Handler for the Tools > Custom Forms action.
#define IDC_MAIN_BTN_CHANGE_BAUD_RATE
Definition: resource.h:433
afx_msg void OnFileClearPacketLog()
Handler for the File > Clear Packet Log action.
afx_msg void OnToolsCameraSettings()
Handler for the Tools > Camera > Settings action.
afx_msg void OnBnClickedMsgDelete()
Click handler for the Message Delete button.
#define ID_TOOLS_MAP_VIEWER
Definition: resource.h:594
uint16 UTIL_hex_to_uint8(const char *aHexString, uint8 *aBinaryData, uint16 aMaxBytes)
Convert a hexadecimal ASCII string to an array of uint8.
Definition: util.cpp:323
#define IDC_MAIN_BTN_CHG_COM_PORT
Definition: resource.h:71
Modal dialog allowing the user to set FMI Safe Mode and the threshold speed.
Definition: CSafeModeDlg.h:20
Form for interacting with IFTA data on the device.
Definition: CIftaDlg.h:21
afx_msg void OnBnClickedCannedResponses()
Click handler for the Canned Responses button.
virtual void DoDataExchange(CDataExchange *aDataExchange)
Perform dialog data exchange and validation.
afx_msg LRESULT OnEventUserInterfaceTextChangeFailed(WPARAM, LPARAM)
Handler for the UI Text Change Failed event from Com.
afx_msg LRESULT OnEventCannedRespListReceiptError(WPARAM aResultCode, LPARAM)
Handler for the Canned Response List Rcpt Error event.
#define MAIN_RX_TIMER_INTERVAL
RX polling interval, in milliseconds.
afx_msg void OnPaint()
Handler for WM_PAINT message. If the dialog is minimized, draw the icon centered in the client rectan...
afx_msg LRESULT OnEventDriverIdAndStatusDlgClosed(WPARAM, LPARAM)
Handler for Driver ID and Status Dialog Closed event.
#define IDC_MAIN_BTN_MSG_THROTTLING
Definition: resource.h:78
afx_msg void OnBnClickedAutoStatusUpdates()
Handler for the Auto Status Updates button.
Modal dialog allowing the user to set AOBRD Odometer value.
#define SAVE_RECEIVED_AOBRD_LOG
afx_msg void OnBnClickedViewlog()
Click handler for the View Packet Log button.
#define IDD_STOP_LIST
Definition: resource.h:36
#define IDC_MAIN_BTN_GPI_QUERY
Definition: resource.h:76
bool tryNextCommRate()
Used in conjunction with mRemainingRates to cycle through available rates when initializing communica...
static SerialPort * getInstance()
Get the one and only serial port object.
Definition: SerialPort.cpp:36
#define ID_FILE_REBOOTDEVICE
Definition: resource.h:592
afx_msg LRESULT OnEventLongTextMsgError(WPARAM, LPARAM)
Handler for the Server to Client Long Text Message Error event from Com.
afx_msg LRESULT OnEventProductIdReceived(WPARAM, LPARAM)
Handler for the Product ID Received event from Com.
afx_msg void OnBnClickedUiTxtChg()
Click handler for the Change UI Text button.
#define IDC_MAIN_BTN_DRIVER_INFO
Definition: resource.h:73
afx_msg void OnBnClickedChgComPort()
Click handler for the Change Com Port button.
afx_msg LRESULT OnEventCommTimeout(WPARAM, LPARAM)
Display the Com Time Out error dialog.
#define IDR_MAINFRAME
Definition: resource.h:10
File conversion tool to support various GPS file formats.
#define IDC_MAIN_GRP_ETA_DATA
Definition: resource.h:91
#define ID_FILE_AOBRDDRIVERS
Definition: resource.h:591
#define IDC_MAIN_TXT_PROTOCOLS
Definition: resource.h:123
#define IDC_MAIN_TXT_PVT_LAT
Definition: resource.h:129
#define IDC_MAIN_BTN_CANNED_RESPONSES
Definition: resource.h:69
#define IDC_MAIN_TXT_PVT_ALTITUDE
Definition: resource.h:125
Modeless dialog allowing the user to query and update Driver ID and Status on the client...
void convertToCsv(const char *source, const char *destFormat)
Convert raw file to CSV.
unsigned short int uint16
16-bit unsigned integer
Definition: garmin_types.h:64
#define IDC_MAIN_TXT_PVT_NS_VEL
Definition: resource.h:131
afx_msg void OnFileClose()
Handler for the File > Close action. Close the app.
afx_msg void OnBnClickedSend()
Click handler for the Send (FMI Packet) button.
#define IDC_MAIN_BTN_REQ_ETA
Definition: resource.h:80
#define ID_FILE_VIEWLOG
Definition: resource.h:589
#define IDC_MAIN_TXT_PVT_GPS_FIX
Definition: resource.h:128
afx_msg LRESULT OnEventEsnReceived(WPARAM, LPARAM)
Handler for the Unit ID (ESN) Received event from Com.
afx_msg LRESULT OnEventProtocolsReceived(WPARAM, LPARAM)
Handler for the Protocols Received event from Com.
afx_msg void OnBnClickedReqETA()
Click handler for the Request ETA button.
afx_msg void OnBnClickedSendSensor()
Handler for the Add/Delete Sensor button.
#define ID_TOOLS_CUSTOMFORMS
Definition: resource.h:593
afx_msg void OnUpdateFileAOBRDDrivers(CCmdUI *aCmdUI)
ON_UPDATE_COMMAND_UI handler for File > AOBRD Drivers menu item.
#define IDC_MAIN_BTN_SET_SAFE_MODE
Definition: resource.h:137
LogParser for packets sent/received by the FmiApplicationLayer.
Definition: FmiLogParser.h:22
#define IDC_MAIN_BTN_SET_AOBRD_ODOMETER
Definition: resource.h:429
Structure containing details for a client to server text message.
Definition: EventId.h:148
afx_msg void OnBnClickedWaypoints()
Click handler for the Waypoints button.
Modal dialog displaying a communication error.
Definition: CCommErrorDlg.h:22
#define ID_TOOLS_CAMERA_SETTINGS
Definition: resource.h:608
Modal dialog allowing the user to select an ETA mode for the device to operate in.
Definition: CEtaModeDlg.h:20
afx_msg LRESULT OnEventDriverStatusListDeleteFailed(WPARAM, LPARAM)
Handler for the Delete Driver Status Failed event from Com.
#define IDC_MAIN_CHK_ETA_AUTO_UPDATE
Definition: resource.h:86
Modal pop up which displays a text message ack received from the client.
Definition: CTxtMsgAckDlg.h:25
afx_msg void OnBnClickedFileTrans()
Click handler for the Transfer File button.
#define IDC_MAIN_TXT_PVT_LON
Definition: resource.h:130
#define IDC_MAIN_BTN_CANNED_MESSAGES
Definition: resource.h:68
Map whose contents are also saved to a file.
Definition: FileBackedMap.h:32
Dialog allowing the user to change certain UI text elements on the client.
afx_msg void OnBnClickedPing()
Click handler for the Ping button.
afx_msg LRESULT OnEventFmiDisabled(WPARAM, LPARAM)
Set FMI as disabled.
Modal dialog allowing the user to select a file to transfer to the client.
afx_msg void OnToolsIfta()
Handler for the Tools > IFTA.
#define IDM_ABOUTBOX
Definition: resource.h:8
#define IDC_MAIN_BTN_ETA_MODE
Definition: resource.h:586
afx_msg void OnBnClickedChangeBaudRate()
Handler for the Change Baud Rate button.
unsigned char uint8
8-bit unsigned integer
Definition: garmin_types.h:62
afx_msg void OnHelpAbout()
Opens the About Dialog box.
afx_msg LRESULT OnEventOpenTextMsgError(WPARAM, LPARAM aEventDataPtr)
Handler for the Server to Client Text Message Error event from Com.
BOOL selectComPort()
Show the Select Comm Port dialog.
#define IDD_LOG
Definition: resource.h:32
afx_msg LRESULT OnEventBaudRateSynchronizing(WPARAM, LPARAM)
Structure containing details for a text message status from the client.
Definition: EventId.h:163
#define ID_8HOURRULE_ENABLE
Definition: resource.h:599
#define IDC_MAIN_TXT_ETA_LON
Definition: resource.h:120
Modeless dialog allowing the user to view ping status and send a ping.
#define IDC_MAIN_BTN_SPEED_LIMIT_ALERTS
Definition: resource.h:403
void initProductNames()
Initialize the list of product names.
Modal pop up dialog displaying a client to server dashcam notification.
afx_msg LRESULT OnEventTxtMsgFromClient(WPARAM, LPARAM aEventDataPtr)
Handler for the Text Message Received event from Com.
afx_msg LRESULT OnEventDeleteTextMessageStatus(WPARAM aEventData, LPARAM)
Handler for the Delete Text Message Status event from Com.
#define IDC_MAIN_BTN_FILE_TRANS
Definition: resource.h:75
afx_msg void OnBnClickedMsgStatus()
Click handler for the Message Status button.
Form for sending A617 sensor popups to the device.
#define IDC_MAIN_TXT_SW_VERSION
Definition: resource.h:134
#define IDS_HOS_AUTO_STATUS_UPDATES_TITLE
Definition: resource.h:11
afx_msg LRESULT OnEventBaudRateSynchronized(WPARAM, LPARAM)
afx_msg void OnToolsMapViewer()
Handler for the Tools > Map Viewer action.
#define WM_EVENT(_event)
Translation from an application event to the corresponding Windows message.
afx_msg void OnBnClickedEnable()
Click handler for the Send Enable button.
afx_msg void OnBnClickedETAMode()
Click handler for the ETA Mode button.
TimerIdType
Timer ID values used in the application.
#define IDD_CANNED_TXT_MSG
Definition: resource.h:22
#define IDD_FMI_PC_APP_DIALOG
Definition: resource.h:28
Structure containing details for a text message ACK from the client.
Definition: EventId.h:141
afx_msg LRESULT OnEventPvtReceived(WPARAM, LPARAM)
Handler for the PVT Data Received event from Com.
#define MAIN_ETA_TIMER_INTERVAL
Interval between automatic ETA requests, in milliseconds.
afx_msg void OnBnClickedAutoETA()
Event handler for Auto ETA Request check box.
static void tick()
Timer tick.
afx_msg void OnFileRebootDevice()
Handler for the File > Reboot Device.
#define ID_CDT_CHAT
Definition: resource.h:603
#define ID_TOOLS_FILECONVERTER
Definition: resource.h:607
afx_msg void OnBnClickedOk()
Click handler for the OK button. Close the app.
#define IDC_MAIN_EDIT_FMI_DATA
Definition: resource.h:88
void initStopList()
Initialize the stop list.
#define IDC_MAIN_BTN_WAYPOINTS
Definition: resource.h:136
#define IDC_MAIN_BTN_SEND_TXT_MSG
Definition: resource.h:82
afx_msg void OnBnClickedGpiQuery()
Click handler for the GPI Query button.
#define IDC_MAIN_LBL_ETA_DISTANCE
Definition: resource.h:98
~CFmiPcAppDlg()
Destructor.
afx_msg void OnBnClickedSafeMode()
Click handler for the FMI Safe Mode button.
afx_msg LRESULT OnEventDashcamIncidentFileNtfctnFromClient(WPARAM, LPARAM)
Handler for the Dashcam Incident File Notification Received event from Com.
Modal dialog allowing the user to request the status of a server to client text message.
#define IDC_MAIN_LBL_ETA_LON
Definition: resource.h:100
Dialog allowing the user to change the auto-arrival options.
afx_msg void OnBnClickedTxt()
Click handler for the Send Text Message button.
afx_msg void OnSysCommand(UINT nID, LPARAM lParam)
Called when the user selects a command from the Control menu, or when the user selects the Maximize o...
Encapsulation of a message ID.
Definition: MessageId.h:26
#define MAX_PAYLOAD_SIZE
Maximum payload size, before DLE stuffing.
Definition: garmin_types.h:21
#define IDS_HOS_START_TIME_OF_DAY_VALUE_LABEL
Definition: resource.h:25
#define ID_CDT_PING_TOOL
Definition: resource.h:605
#define SAVE_CONVERTED_AOBRD_LOG
File name of the saved AOBRD driver event log.
#define IDS_ABOUTBOX
Definition: resource.h:9
Modal dialog allowing the user to send a text message to the client.
Definition: CTxtMsgNewDlg.h:30
afx_msg LRESULT OnEventEtaReceived(WPARAM, LPARAM)
Handler for the ETA Received event from Com.
#define IDS_HOS_AUTO_STATUS_UPDATES_VALUE_UNIT
Definition: resource.h:15
afx_msg void OnToolsHOSSetStartTimeOfDay()
#define IDD_DRIVER_ID_STATUS
Definition: resource.h:26
#define IDC_MAIN_BTN_PING
Definition: resource.h:79
static void post(EventId aEventId, uint32 aEventData=0, void *aEventDataPtr=NULL, BOOL handleNow=FALSE)
Posts a message to all windows that have registered to get events.
Definition: Event.cpp:67
#define ID_CDT_PING_ONCE
Definition: resource.h:604
afx_msg LRESULT OnEventTxtMsgStatus(WPARAM, LPARAM)
Handler for the Text Message Status Received event from Com.
#define IDC_MAIN_TXT_ETA_TIME
Definition: resource.h:121