32 ON_BN_CLICKED( IDOK, OnBnClickedOk )
34 ON_EN_SETFOCUS( IDC_DRVRINFO_EDIT_NEW_ID, OnEnSetfocusDriverIdEdit )
35 ON_EN_KILLFOCUS( IDC_DRVRINFO_EDIT_NEW_ID, OnEnKillfocusDriverIdEdit )
36 ON_EN_SETFOCUS( IDC_DRVRINFO_EDIT_STATUS_TEXT, OnEnSetfocusStatusEdit )
37 ON_EN_KILLFOCUS( IDC_DRVRINFO_EDIT_STATUS_TEXT, OnEnKillfocusStatusEdit )
38 ON_EN_SETFOCUS( IDC_DRVRINFO_EDIT_STATUS_ID, OnEnSetfocusStatusEdit )
39 ON_EN_KILLFOCUS( IDC_DRVRINFO_EDIT_STATUS_ID, OnEnKillfocusStatusEdit )
44 #if( FMI_SUPPORT_A607 ) 54 CDriverIdAndStatusDlg::CDriverIdAndStatusDlg
61 , mCurrentDriverId( _T("") )
62 , mCurrentDriverStatus( _T("") )
63 , mNewDriverId( _T("") )
64 , mSelectedListIndex( 0 )
65 , mNewDriverStatusId( _T("") )
66 , mNewDriverStatusText( _T("") )
84 CDataExchange * aDataExchange
87 CDialog::DoDataExchange( aDataExchange );
90 DDX_Text( aDataExchange, IDC_DRVRINFO_EDIT_NEW_ID, mNewDriverId );
91 DDX_CBIndex( aDataExchange, IDC_DRVRINFO_CBO_IDX, mIndex );
92 DDX_Control( aDataExchange, IDC_DRVRINFO_LST_STATUS, mDriverStatusList );
93 DDX_LBIndex( aDataExchange, IDC_DRVRINFO_LST_STATUS, mSelectedListIndex );
94 DDX_Text( aDataExchange, IDC_DRVRINFO_EDIT_STATUS_ID, mNewDriverStatusId );
95 DDX_Text( aDataExchange, IDC_DRVRINFO_EDIT_STATUS_TEXT, mNewDriverStatusText );
107 CDialog::OnInitDialog();
110 #if( FMI_SUPPORT_A607 ) 111 if( mCom.mUseMultipleDrivers )
114 GetDlgItem( IDC_DRVRINFO_CBO_IDX )->EnableWindow(
TRUE );
118 mCom.sendA607DriverIdRequest( i );
119 mCom.sendA607DriverStatusRequest( i );
126 GetDlgItem( IDC_DRVRINFO_CBO_IDX )->EnableWindow(
FALSE );
127 mCom.sendDriverIdRequest();
128 mCom.sendDriverStatusRequest();
131 SetWindowPos( NULL, 250, 600, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
146 int selectedIndex = mDriverStatusList.GetCurSel();
147 int topIndex = mDriverStatusList.GetTopIndex();
149 mDriverStatusList.ResetContent();
151 for(; it != mCom.mDriverStatuses.
end(); it++ )
153 if( it->second.isValid() )
155 listItem.Format( _T(
"%d - %s"), it->first, it->second.getCurrentName() );
156 mDriverStatusList.AddString( listItem );
161 mDriverStatusList.SetCurSel( selectedIndex );
162 mDriverStatusList.SetTopIndex( topIndex );
189 if( aIndex == (WPARAM) mIndex )
196 MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mDriverId[ aIndex ], -1, driverId, 50 );
198 mCurrentDriverId.Format( _T(
"%s"), driverId );
213 if( aIndex == (WPARAM) mIndex )
219 TCHAR driverStatus[50];
220 MultiByteToWideChar( mCom.mClientCodepage, 0, mCom.mDriverStatus[ aIndex ], -1, driverStatus, 50 );
221 driverStatus[49] =
'\0';
222 mCurrentDriverStatus.Format( _T(
" %s"), driverStatus );
238 if( mNewDriverId !=
"" )
239 GetDlgItem( IDC_DRVRINFO_BTN_SEND_ID )->EnableWindow(
TRUE );
241 GetDlgItem( IDC_DRVRINFO_BTN_SEND_ID )->EnableWindow(
FALSE );
253 int selectedIndex = mDriverStatusList.GetCurSel();
254 if( selectedIndex >= 0 && selectedIndex < mDriverStatusList.GetCount() )
256 uint32 driverStatusId = mCom.mDriverStatuses.getKeyAt( selectedIndex );
257 ClientListItem& driverStatusItem = mCom.mDriverStatuses.get( driverStatusId );
259 mNewDriverStatusId.Format( _T(
"%u"), driverStatusId );
260 mNewDriverStatusText.Format( _T(
"%s"), driverStatusItem.
getCurrentName() );
262 GetDlgItem( IDC_DRVRINFO_BTN_DELETE_STATUS )->EnableWindow(
TRUE );
266 GetDlgItem( IDC_DRVRINFO_BTN_DELETE_STATUS )->EnableWindow(
FALSE );
268 mDriverStatusList.SetCurSel( selectedIndex );
278 if( mSelectedListIndex >= 0 )
280 uint32 driverStatusId = mCom.mDriverStatuses.getKeyAt( mSelectedListIndex );
281 #if( FMI_SUPPORT_A607 ) 282 mCom.sendA607DriverStatusUpdate( driverStatusId, (
uint8) mIndex );
284 mCom.sendDriverStatusUpdate( driverStatusId );
298 WideCharToMultiByte( mCom.mClientCodepage, 0, mNewDriverId, -1, driverId, 50, NULL, NULL );
300 #if( FMI_SUPPORT_A607 ) 301 mCom.sendA607DriverIdUpdate( driverId, (
uint8) mIndex );
303 mCom.sendDriverIdUpdate( driverId );
313 #if( FMI_SUPPORT_A607 ) 314 if( mCom.mUseMultipleDrivers )
316 mCom.sendA607DriverIdRequest( (
uint8) mIndex );
321 mCom.sendDriverIdRequest();
331 #if( FMI_SUPPORT_A607 ) 332 if( mCom.mUseMultipleDrivers )
334 mCom.sendA607DriverStatusRequest( (
uint8) mIndex );
339 mCom.sendDriverStatusRequest();
352 BOOL fieldsValid =
TRUE;
357 memset( idBuffer, 0,
sizeof( idBuffer ) );
358 if( 0 == WideCharToMultiByte
362 mNewDriverStatusId.GetBuffer(),
363 mNewDriverStatusId.GetLength(),
376 if( mNewDriverStatusText.GetLength() == 0 ||
377 mNewDriverStatusText.GetLength() >= 50 )
382 GetDlgItem( IDC_DRVRINFO_BTN_ADD_STATUS )->EnableWindow( fieldsValid );
393 if( mSelectedListIndex >= 0 && (
uint32) mSelectedListIndex < mCom.mDriverStatuses.validCount() )
395 uint32 driverStatusId = mCom.mDriverStatuses.getKeyAt( mSelectedListIndex );
396 mCom.sendDeleteDriverStatusListItem( driverStatusId );
409 uint32 id = _tstoi( mNewDriverStatusId.GetBuffer() );
411 mCom.sendDriverStatusListItem(
id, mNewDriverStatusText );
430 OnDriverIdChanged( mIndex, NULL );
431 OnDriverStatusChanged( mIndex, NULL );
448 CDialog::PostNcDestroy();
459 SendMessage( DM_SETDEFID, IDC_DRVRINFO_BTN_SEND_ID );
469 SendMessage( DM_SETDEFID, IDOK );
480 SendMessage( DM_SETDEFID, IDC_DRVRINFO_BTN_ADD_STATUS );
490 SendMessage( DM_SETDEFID, IDOK );
493 #if( FMI_SUPPORT_A607 ) 502 dlg->ShowWindow( SW_SHOW );
afx_msg void OnIndexChanged()
Selection handler for the driver index combo.
virtual void DoDataExchange(CDataExchange *aDataExchange)
Perform dialog data exchange and validation.
const_iterator begin()
Iterator positioned at the first element in the map.
#define IDC_DRVRINFO_EDIT_NEW_ID
afx_msg LPARAM OnDriverIdChanged(WPARAM aIndex, LPARAM)
Event handler for the FMI_EVENT_DRIVER_ID_CHANGED event generated by FmiApplicationLayer.
afx_msg void OnBnClickedEditLogins()
Click handler for the Driver Logins button.
#define IDC_DRVRINFO_LST_STATUS
#define IDC_DRVRINFO_BTN_EDIT_LOGINS
#define IDC_DRVRINFO_TXT_CURRENT_STATUS
afx_msg void OnEnKillfocusStatusEdit()
Kill Focus handler for the Driver Status edit box.
void updateListBox()
Update the driver status list box from the map of items owned by FmiApplicationLayer.
bool UTIL_data_is_uint32(const char *aData)
Determine whether an array of characters consists only of numeric, and that the value when converted ...
#define IDC_DRVRINFO_TXT_CURRENT_ID
CString getCurrentName() const
Get the current name of this item.
afx_msg void OnEnChangeEditSet()
Edit handler for the Add/Update Status group.
#define IDC_DRVRINFO_BTN_ADD_STATUS
afx_msg void OnBnClickedSendDriverStatus()
Click handler for the Send (Driver Status) button.
afx_msg void OnEnSetfocusStatusEdit()
Set Focus handler for the Add/Update Status edit boxes.
const_iterator end()
Iterator positioned after the last element in the map.
afx_msg void OnBnClickedRefreshDriverStatus()
Click handler for the Refresh (Driver Status) button.
#define IDC_DRVRINFO_EDIT_STATUS_ID
afx_msg void OnLbnSelchangeStatuslist()
Selection Changed event handler for the status list.
#define IDC_DRVRINFO_CBO_IDX
#define IDC_DRVRINFO_BTN_DELETE_STATUS
afx_msg void OnBnClickedSendDriverId()
Click handler for the Send (Driver ID) button.
afx_msg void OnBnClickedSendDriverStatusItem()
Click handler for the Send (Driver Status Item) button.
#define FMI_DRIVER_COUNT
Number of supported drivers.
Serial communication controller for Garmin and FMI packets.
Modeless dialog allowing the user to query and update Driver ID and Status on the client...
Stores the name associated with a list item that is sent to the client.
BOOL OnInitDialog()
Initialize the dialog.
#define IDC_DRVRINFO_EDIT_STATUS_TEXT
void PostNcDestroy()
Perform final cleanup after the dialog window is destroyed.
afx_msg void OnBnClickedDelete()
Click handler for the Delete (Driver Status Item) button.
#define IDC_DRVRINFO_BTN_SEND_ID
Map whose contents are also saved to a file.
afx_msg void OnBnClickedOk()
Click handler for the OK (Close) button.
#define IDC_DRVRINFO_LBL_IDX
unsigned char uint8
8-bit unsigned integer
afx_msg void OnCancel()
Handles the Cancel action.
afx_msg LPARAM OnDriverStatusListChanged(WPARAM, LPARAM)
Event handler for the FMI_EVENT_DRIVER_STATUS_LIST_CHANGED event generated by FmiApplicationLayer.
#define IDC_DRVRINFO_BTN_GET_STATUS
Dialog allowing the user to manage canned responses.
#define IDD_DRIVER_LOGINS
#define WM_EVENT(_event)
Translation from an application event to the corresponding Windows message.
unsigned long int uint32
32-bit unsigned integer
afx_msg LPARAM OnDriverStatusChanged(WPARAM aIndex, LPARAM)
Event handler for the FMI_EVENT_DRIVER_STATUS_CHANGED event generated by FmiApplicationLayer.
afx_msg void OnEnKillfocusDriverIdEdit()
Kill Focus handler for the Driver ID edit box.
afx_msg void OnBnClickedRefreshDriverId()
Click handler for the Refresh (Driver ID) button.
#define IDC_DRVRINFO_BTN_SEND_STATUS
afx_msg void OnEnChangeEditDriverId()
Edit event handler for the Driver ID edit box.
#define IDC_DRVRINFO_BTN_GET_ID
virtual ~CDriverIdAndStatusDlg()
Destructor.
#define IDD_DRIVER_ID_STATUS
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.
afx_msg void OnEnSetfocusDriverIdEdit()
Set Focus handler for the Driver ID edit box.