00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifdef WX_PRECOMP
00011 #include "wx_pch.h"
00012 #endif
00013
00014 #ifdef __BORLANDC__
00015 #pragma hdrstop
00016 #endif //__BORLANDC__
00017 #include <wx/textfile.h>
00018 #include <wx/filename.h>
00019 #include <wx/datetime.h>
00020
00021 #include "N1568DemoMain.h"
00022 #include "ChannelPanelImpl.h"
00023 #include "AllChannelPanelImpl.h"
00024 #include "SettingsDialogImpl.h"
00025 #include "wxBackgroundBitmap.h"
00026
00027
00028 enum wxbuildinfoformat {
00029 short_f, long_f
00030 };
00031
00032 wxString wxbuildinfo(wxbuildinfoformat format) {
00033 wxString wxbuild(wxVERSION_STRING);
00034
00035 if (format == long_f ) {
00036 #if defined(__WXMSW__)
00037 wxbuild << _T("-Windows");
00038 #elif defined(__WXMAC__)
00039 wxbuild << _T("-Mac");
00040 #elif defined(__UNIX__)
00041 wxbuild << _T("-Linux");
00042 #endif
00043
00044 #if wxUSE_UNICODE
00045 wxbuild << _T("-Unicode build");
00046 #else
00047 wxbuild << _T("-ANSI build");
00048 #endif // wxUSE_UNICODE
00049 }
00050
00051 return wxbuild;
00052 }
00053
00054
00055 N1568DemoFrame::N1568DemoFrame(wxFrame *frame)
00056 : GUIFrame(frame) {
00057 this->m_is_connect= false;
00058
00059 this->m_main_toolBar->PushEventHandler( new wxBackgroundBitmap( wxBitmap(_T("images/caen.png"), wxBITMAP_TYPE_PNG), this));
00060 this->m_main_toolBar->EnableTool( ID_TOOLS_EXPORT_TOOL, this->m_is_connect);
00061 this->m_main_toolBar->EnableTool( ID_TOOLS_DOWNLOAD_TOOL, this->m_is_connect);
00062 this->m_cmd_send_button->Enable( this->m_is_connect);
00063
00064 for ( int i= 0; i< MAX_CHANNELS ; i++) {
00065 this->m_channel_panel_array[ i]= new ChannelPanelImpl( this->m_channels_scrolledWindow, this);
00066 this->m_channel_panel_array[ i]->Show( false);
00067 this->m_channel_sizer->Add( this->m_channel_panel_array[ i], 0, wxEXPAND | wxALL, 0 );
00068 this->m_channel_panel_array[ i]->SetChannelId( i);
00069 this->m_channel_panel_array[ i]->EnableCommunication( false);
00070 }
00071
00072 this->m_all_channel_panel= new AllChannelPanelImpl( this->m_channels_scrolledWindow, this);
00073 this->m_all_channel_panel->Show( true);
00074 this->m_channel_sizer->Add( this->m_all_channel_panel, 0, wxEXPAND | wxALL, 0 );
00075 this->m_all_channel_panel->SetChannelId( 0);
00076 this->m_all_channel_panel->EnableCommunication( false);
00077
00078 this->AddToLogger( _( "Application started"), LMT_INTERNAL);
00079
00080
00081 if ( !this->m_application_settings.ReadSettings()) {
00082 wxFAIL_MSG( _("N1568DemoFrame:: Errors while reading application settings"));
00083 this->AddToLogger( _("N1568DemoFrame:: Errors while reading application settings"), LMT_INTERNAL);
00084 } else {
00085 this->AddToLogger( _( "Application settings read."), LMT_INTERNAL);
00086 }
00087 this->LayoutWindow();
00088 wxString sw_rev( _("N1568Demo "));
00089 sw_rev<< SW_REVISION;
00090 this->SetStatusBarText( sw_rev, SBP_SW_REVISION);
00091 this->m_module_address_spinCtrl->SetValue( this->m_application_settings.m_default_module_address);
00092 this->m_mux_out_spinCtrl->SetValue( this->m_application_settings.m_default_mux_out);
00093 this->m_next_module_address_sent= wxDateTime::UNow();
00094 this->m_next_mux_out_sent= wxDateTime::UNow();
00095
00096 }
00097
00098 N1568DemoFrame::~N1568DemoFrame() {
00099 }
00100 wxString N1568DemoFrame::GetExecutablePath() {
00101 static bool found = false;
00102 static wxString path;
00103
00104 if (found)
00105 return path;
00106 else {
00107 #ifdef __WXMSW__
00108
00109 char buf[512];
00110 *buf = '\0';
00111 GetModuleFileName(NULL, buf, 511);
00112 path = buf;
00113
00114 #elif defined(__WXMAC__)
00115
00116 ProcessInfoRec processinfo;
00117 ProcessSerialNumber procno ;
00118 FSSpec fsSpec;
00119
00120 procno.highLongOfPSN = NULL ;
00121 procno.lowLongOfPSN = kCurrentProcess ;
00122 processinfo.processInfoLength = sizeof(ProcessInfoRec);
00123 processinfo.processName = NULL;
00124 processinfo.processAppSpec = &fsSpec;
00125
00126 GetProcessInformation( &procno , &processinfo ) ;
00127 path = wxMacFSSpec2MacFilename(&fsSpec);
00128 #else
00129 wxString argv0 = wxTheApp->argv[0];
00130
00131 if (wxIsAbsolutePath(argv0))
00132 path = argv0;
00133 else {
00134 wxPathList pathlist;
00135 pathlist.AddEnvList(wxT("PATH"));
00136 path = pathlist.FindAbsoluteValidPath(argv0);
00137 }
00138
00139 wxFileName filename(path);
00140 filename.Normalize();
00141 path = filename.GetFullPath();
00142 #endif
00143 found = true;
00144 return path;
00145 }
00146 }
00147
00148 void N1568DemoFrame::OnClose(wxCloseEvent &) {
00149 Destroy();
00150 }
00151
00152 void N1568DemoFrame::OnQuit(wxCommandEvent &) {
00153 Destroy();
00154 }
00155
00156 void N1568DemoFrame::OnAbout(wxCommandEvent &) {
00157 AboutDialog dlg( this);
00158 wxString label;
00159 label= _( "N1568Demo Rev. ");
00160 label<< SW_REVISION;
00161 dlg.m_sw_rev_Text->SetLabel( label);
00162 dlg.m_sdk_sw_rev_Text->SetLabel( N1568_SW_rev());
00163 dlg.ShowModal( );
00164 }
00165 void N1568DemoFrame::OnFileQuitToolClicked( wxCommandEvent& event ) {
00166 this->OnQuit( event);
00167 }
00168 void N1568DemoFrame::OnToolsConnectToolClicked( wxCommandEvent& event ) {
00169 this->OnMenuToolsConnect( event);
00170 }
00171 void N1568DemoFrame::OnToolsExportToolClicked( wxCommandEvent& ) {
00172 this->DoExport( true);
00173 }
00174 void N1568DemoFrame::OnToolsDownloadToolClicked( wxCommandEvent& event ) {
00175 this->OnMenuToolsDownload( event);
00176 }
00177 void N1568DemoFrame::OnToolsSettingsToolClicked( wxCommandEvent& event ) {
00178 this->OnMenuToolsSettings( event);
00179 }
00180 void N1568DemoFrame::OnMenuToolsConnect( wxCommandEvent& ) {
00181 this->ConnectToDevice( !this->m_is_connect);
00182 }
00183 void N1568DemoFrame::OnMenuToolsExport( wxCommandEvent& ) {
00184 this->DoExport( true);
00185 }
00186 void N1568DemoFrame::DoExport( bool prompt) {
00187 if ( !this->m_is_connect) {
00188 return;
00189 }
00190
00191 if( prompt) {
00192 wxMessageDialog prompt_dlg( this, _("Pressing Ok the channel 0 data will be copied to other channels!\nDo you confirm the operation ?"), ("Warning"), wxOK| wxCANCEL| wxICON_WARNING);
00193 if ( prompt_dlg.ShowModal()!= wxID_OK) {
00194 return;
00195 }
00196 }
00197
00198 if ( !N1568_export( &this->m_board_data)) {
00199 wxString msg( _("Error while sending export command "));
00200 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00201 dlg.ShowModal();
00202 this->AddToLogger( msg, LMT_INTERNAL);
00203 }
00204 this->AddToLogger( N1568_get_last_answer( &this->m_board_data), LMT_COMMUNICATION);
00205
00206 this->RefreshChannels();
00207
00208 }
00209 void N1568DemoFrame::OnMenuToolsDownload( wxCommandEvent& ) {
00210 if ( !this->m_is_connect) {
00211 return;
00212 }
00213
00214 wxFileDialog file_dlg( this, _("Choose a command file to download to the board ..."), "", _T(""), _T("*.*"), wxFD_OPEN| wxFD_FILE_MUST_EXIST| wxFD_PREVIEW);
00215 if ( file_dlg.ShowModal()!= wxID_OK) {
00216 return;
00217 }
00218 wxTextFile text_file;
00219 if ( !text_file.Open( file_dlg.GetPath())) {
00220 wxString msg( _("Error while opening donwload file "));
00221 msg<< file_dlg.GetPath();
00222 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00223 dlg.ShowModal();
00224 this->AddToLogger( msg, LMT_INTERNAL);
00225 return;
00226 }
00227 UINT8 buff[ 256];
00228 for ( size_t i= 0; i< text_file.GetLineCount(); i++) {
00229 wxString line= text_file[ i].Trim().Trim( false);
00230 int timeout= 40;
00231 switch ( line[ 0]) {
00232 case '#':
00233
00234 continue;
00235 case 'M':
00236 case 'm':
00237 case 'X':
00238 case 'x':
00239 timeout= 3000;
00240 break;
00241 }
00242 UINT16 buff_size= (UINT16) line.Length();
00243 if ( buff_size>= sizeof( buff)) {
00244 wxString msg( _("Bad input line: ["));
00245 msg<< i<< _T("] '")<< line<< _T("'");
00246 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00247 dlg.ShowModal();
00248 this->AddToLogger( msg, LMT_INTERNAL);
00249 continue;
00250 }
00251 if ( !buff_size) {
00252 continue;
00253 }
00254 line<< '\r';
00255 ++buff_size;
00256 memcpy( buff, line.GetData(), buff_size);
00257 if ( !send_buffer( &this->m_board_data.m_common_data, buff, buff_size )) {
00258 wxString msg( _("Error while sending command: ["));
00259 msg<< i<< _T("] '")<< line<< _T("'");
00260 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00261 dlg.ShowModal();
00262 this->AddToLogger( msg, LMT_INTERNAL);
00263 continue;
00264 }
00265 UINT16 asw_buff_size= ASW_BUFF_SIZE- 1;
00266 if ( !receive_buffer( &this->m_board_data.m_common_data, (UINT8*)this->m_board_data.m_p_asw_buff, &asw_buff_size, timeout)) {
00267 wxString msg( _("Error while receiving answer "));
00268 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00269 dlg.ShowModal();
00270 this->AddToLogger( msg, LMT_INTERNAL);
00271 continue;
00272 }
00273 this->m_board_data.m_asw_buff_len= asw_buff_size;
00274 this->AddToLogger( N1568_get_last_answer( &this->m_board_data), LMT_COMMUNICATION);
00275 }
00276 text_file.Close();
00277
00278 this->RefreshChannels();
00279
00280 }
00281 void N1568DemoFrame::OnMenuToolsSettings( wxCommandEvent& ) {
00282 this->SetupSettings();
00283 }
00284
00285 void N1568DemoFrame::OnHelpAboutToolClicked( wxCommandEvent& event ) {
00286 this->OnAbout( event);
00287 }
00288 void N1568DemoFrame:: SetStatusBarText( const wxString &msg, STATUS_BAR_PANE pane) {
00289 #if wxUSE_STATUSBAR
00290 this->m_main_statusBar->SetStatusText( msg, (int)pane);
00291 #endif
00292 }
00293 bool N1568DemoFrame::ConnectToDevice( bool connect) {
00294 if ( connect== this->m_is_connect) {
00295 return true;
00296 }
00297
00298 if ( connect) {
00299 if ( !N1568_open( &this->m_board_data, this->m_application_settings.m_communication_device_id.GetData())) {
00300 wxString msg( _("Unable to open communication device: "));
00301 msg<< this->m_application_settings.m_communication_device_id;
00302 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00303 dlg.ShowModal();
00304 this->AddToLogger( msg, LMT_INTERNAL);
00305 this->m_main_toolBar->ToggleTool( ID_TOOLS_CONNECT_TOOL, false);
00306 this->m_menu_tools_connect->Check( false);
00307 return false;
00308 }
00309 this->m_is_connect= true;
00310 wxString log_msg= _("Communication device opened: ");
00311 log_msg<< this->m_application_settings.m_communication_device_id;
00312 this->AddToLogger( log_msg, LMT_INTERNAL);
00313 this->DoSetMuxOut();
00314 } else {
00315 if ( !N1568_close( &this->m_board_data)) {
00316 wxString msg( _("Unable to close communication device: "));
00317 msg<< this->m_application_settings.m_communication_device_id;
00318 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00319 dlg.ShowModal();
00320 this->AddToLogger( msg, LMT_INTERNAL);
00321 this->m_main_toolBar->ToggleTool( ID_TOOLS_CONNECT_TOOL, true);
00322 this->m_menu_tools_connect->Check( true);
00323 return false;
00324 } else {
00325 this->SetStatusBarText( _T(""), SBP_MODULE_ADDRESS);
00326 }
00327 this->m_is_connect= false;
00328 this->AddToLogger( _("Communication device closed"), LMT_INTERNAL);
00329 }
00330 for ( int i= 0; i< MAX_CHANNELS; i++) {
00331 this->m_channel_panel_array[ i]->EnableCommunication( this->m_is_connect);
00332 }
00333 this->m_all_channel_panel->EnableCommunication( this->m_is_connect);
00334
00335 this->m_main_toolBar->ToggleTool( ID_TOOLS_CONNECT_TOOL, this->m_is_connect);
00336 this->m_menu_tools_export->Enable( this->m_is_connect);
00337 this->m_main_toolBar->EnableTool( ID_TOOLS_EXPORT_TOOL, this->m_is_connect);
00338 this->m_menu_tools_download->Enable( this->m_is_connect);
00339 this->m_main_toolBar->EnableTool( ID_TOOLS_DOWNLOAD_TOOL, this->m_is_connect);
00340 this->m_cmd_send_button->Enable( this->m_is_connect);
00341 if ( this->m_is_connect) {
00342 wxString msg( _("CONNECTED: "));
00343 msg<< this->m_application_settings.m_communication_device_id;
00344 this->SetStatusBarText( msg, SBP_CONNECTION_STATUS);
00345 } else {
00346 this->SetStatusBarText( _("NOT CONNECTED"), SBP_CONNECTION_STATUS);
00347 }
00348 this->m_main_toolBar->SetToolNormalBitmap( ID_TOOLS_CONNECT_TOOL, wxBitmap( this->m_is_connect? wxT("images/cache_red.png"): wxT("images/cache.png"), wxBITMAP_TYPE_ANY));
00349
00350 return true;
00351 }
00352 bool N1568DemoFrame::RefreshChannels() {
00353 for ( int i= 0; i< MAX_CHANNELS; i++) {
00354 if ( !this->m_channel_panel_array[ i]->ReadFromBoard( false, false)) {
00355 return false;
00356 }
00357 }
00358 this->DoSetMuxOut();
00359 return true;
00360 }
00361 bool N1568DemoFrame::SetModuleAddress( ) {
00362
00363 if ( !N1568_set_module( &this->m_board_data, (UINT8)this->m_module_address_spinCtrl->GetValue())) {
00364 wxString msg( _("Error while sending module address "));
00365 msg<< this->m_module_address_spinCtrl->GetValue();
00366 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00367 dlg.ShowModal();
00368 this->AddToLogger( msg, LMT_INTERNAL);
00369 this->AddToLogger( N1568_get_last_answer( &this->m_board_data), LMT_COMMUNICATION);
00370 return false;
00371 }
00372 wxString msg( _("MODULE ADD: "));
00373 msg<< this->m_module_address_spinCtrl->GetValue();
00374 this->SetStatusBarText( msg, SBP_MODULE_ADDRESS);
00375 this->AddToLogger( N1568_get_last_answer( &this->m_board_data), LMT_COMMUNICATION);
00376 return true;
00377 }
00378 void N1568DemoFrame::SetupSettings( ) {
00379 SettingsDialogImpl dlg( this);
00380 if ( dlg.ShowModal()!= wxID_OK) {
00381 return;
00382 }
00383
00384
00385 wxString org_communication_device_id= this->m_application_settings.m_communication_device_id;
00386
00387 if ( !this->m_application_settings.ReadSettings()) {
00388 wxFAIL_MSG( _("N1568DemoFrame:: Errors while reading application settings"));
00389 }
00390 this->LayoutWindow();
00391 this->m_channel_sizer->Layout();
00392 this->Refresh();
00393
00394
00395 if ( this->m_is_connect) {
00396 if ( org_communication_device_id!= this->m_application_settings.m_communication_device_id) {
00397
00398 if ( this->ConnectToDevice( false)) {
00399
00400 this->ConnectToDevice( true);
00401 }
00402 }
00403 }
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416 }
00417 void N1568DemoFrame::AddToLogger( const wxString &msg, LOG_MESSAGE_TYPE type) {
00418 if ( !this->m_application_settings.m_is_logger_enabled) {
00419 return;
00420 }
00421 wxColour text_color;
00422 switch ( type) {
00423 case LMT_INTERNAL:
00424 text_color.Set( 0x30, 0x30, 0x30);
00425 break;
00426 case LMT_COMMUNICATION:
00427 text_color.Set( 0x10, 0x10, 0xff);
00428 break;
00429 default:
00430 wxFAIL_MSG( _("Internal error: N1568DemoFrame::AddtoLogger Unhandled message type"));
00431 break;
00432 }
00433 wxString log_msg= msg;
00434 this->m_logger_richText->BeginTextColour( text_color);
00435 this->m_logger_richText->AppendText( log_msg.Trim( ));
00436 this->m_logger_richText->AppendText( _T("\n"));
00437 this->m_logger_richText->EndTextColour( );
00438 this->m_logger_richText->ShowPosition( this->m_logger_richText->GetLastPosition());
00439 ::wxSafeYield( NULL, true);
00440 }
00441 void N1568DemoFrame::LayoutWindow() {
00442 this->m_bottom_panel->Show( this->m_application_settings.m_is_logger_visible);
00443 if ( this->m_application_settings.m_is_logger_visible) {
00444 this->m_main_splitter->SplitHorizontally( this->m_channels_scrolledWindow, this->m_bottom_panel, 200);
00445 } else {
00446 this->m_main_splitter->Unsplit( this->m_bottom_panel);
00447 }
00448 bool first_found= false;
00449 for ( int i= 0; i< MAX_CHANNELS ; i++) {
00450 bool to_show= (i>= this->m_application_settings.m_first_visible_channel)&& (i<= this->m_application_settings.m_last_visible_channel);
00451 this->m_channel_panel_array[ i]->Show( to_show);
00452 if ( to_show&& ( !first_found)) {
00453 first_found= true;
00454 this->m_channel_panel_array[ i]->ShowLabels( true);
00455 } else {
00456 this->m_channel_panel_array[ i]->ShowLabels( false);
00457 }
00458 }
00459 this->m_all_channel_panel->ShowLabels( !first_found);
00460 this->Layout();
00461 }
00462 void N1568DemoFrame::OnCmdTextCtrlEnter( wxCommandEvent& ){
00463 this->DoDirectCmdSend();
00464 }
00465 void N1568DemoFrame::DoDirectCmdSend() {
00466 if ( !this->m_is_connect) {
00467 return;
00468 }
00469 UINT8 buff[ 256];
00470 wxString line= this->m_cmd_textCtrl->GetValue().Trim( false);
00471 int timeout= 40;
00472 switch ( line[ 0]) {
00473 case 'M':
00474 case 'm':
00475 case 'X':
00476 case 'x':
00477 timeout= 3000;
00478 break;
00479 }
00480 UINT16 buff_size= (UINT16) line.Length();
00481 if ( buff_size>= sizeof( buff)) {
00482 wxString msg( _("Bad input line: ["));
00483 msg<< _T("] '")<< line<< _T("'");
00484 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00485 dlg.ShowModal();
00486 this->AddToLogger( msg, LMT_INTERNAL);
00487 return;
00488 }
00489 if ( !buff_size) {
00490 return;
00491 }
00492 line<< '\r';
00493 ++buff_size;
00494 memcpy( buff, line.GetData(), buff_size);
00495 if ( !send_buffer( &this->m_board_data.m_common_data, buff, buff_size )) {
00496 wxString msg( _("Error while sending command: ["));
00497 msg<< _T("] '")<< line<< _T("'");
00498 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00499 dlg.ShowModal();
00500 this->AddToLogger( msg, LMT_INTERNAL);
00501 return;
00502 }
00503 UINT16 asw_buff_size= ASW_BUFF_SIZE- 1;
00504 if ( !receive_buffer( &this->m_board_data.m_common_data, (UINT8*)this->m_board_data.m_p_asw_buff, &asw_buff_size, timeout)) {
00505 wxString msg( _("Error while receiving answer "));
00506 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00507 dlg.ShowModal();
00508 this->AddToLogger( msg, LMT_INTERNAL);
00509 return;
00510 }
00511 this->m_board_data.m_asw_buff_len= asw_buff_size;
00512 this->AddToLogger( N1568_get_last_answer( &this->m_board_data), LMT_COMMUNICATION);
00513
00514
00515 this->m_cmd_textCtrl->SetSelection( -1, -1);
00516 this->m_cmd_textCtrl->SetFocus();
00517 this->m_cmd_textCtrl->SetForegroundColour( wxColour( 0, 0, 0 ) );
00518 this->m_cmd_textCtrl->Refresh();
00519 }
00520 void N1568DemoFrame::OnCmdTextCtrl( wxCommandEvent& event ){
00521 this->m_cmd_textCtrl->SetForegroundColour( wxColour( 240, 0, 0 ) );
00522 this->m_cmd_textCtrl->Refresh();
00523 event.Skip();
00524 }
00525 void N1568DemoFrame::OnCmdSendClick( wxCommandEvent& ){
00526 this->DoDirectCmdSend();
00527 }
00528 void N1568DemoFrame::OnMuxOutChanged( wxSpinEvent& ){
00529
00530 this->m_next_mux_out_sent= wxDateTime::UNow().Add( wxTimeSpan( 0, 0, 0 , SPIN_CTRL_DELAY_MSEC));
00531
00532 }
00533 void N1568DemoFrame::DoSetMuxOut() {
00534 if( !this->m_is_connect) {
00535 return;
00536 }
00537
00538 int channel_id= this->m_mux_out_spinCtrl->GetValue();
00539 if ( !N1568_set_channel( &this->m_board_data, channel_id, NULL)) {
00540 wxString msg( _("Error while writing channel id "));
00541 msg<< channel_id;
00542 wxMessageDialog dlg( this, msg, ("Error"), wxOK| wxICON_ERROR);
00543 dlg.ShowModal();
00544 this->AddToLogger( msg);
00545 this->AddToLogger( N1568_get_last_answer( &this->m_board_data), LMT_COMMUNICATION);
00546 return;
00547 } else {
00548 this->AddToLogger( N1568_get_last_answer( &this->m_board_data), LMT_COMMUNICATION);
00549 }
00550 }
00551 void N1568DemoFrame::OnModuleAddressChanged( wxSpinEvent& ){
00552 this->m_next_module_address_sent= wxDateTime::UNow().Add( wxTimeSpan( 0, 0, 0 , SPIN_CTRL_DELAY_MSEC));
00553 }
00554
00555 void N1568DemoFrame::OnIdle( wxIdleEvent& event ) {
00556 wxDateTime now= wxDateTime::UNow();
00557 if( now>= this->m_next_module_address_sent)
00558 {
00559 if ( this->m_is_connect) {
00560 this->SetModuleAddress();
00561 this->RefreshChannels();
00562 this->m_next_module_address_sent= now.Add( wxDateSpan( 10));
00563 }
00564 }
00565 if( now>= this->m_next_mux_out_sent)
00566 {
00567 if ( this->m_is_connect) {
00568 this->DoSetMuxOut();
00569 this->m_next_mux_out_sent= now.Add( wxDateSpan( 10));
00570 }
00571 }
00572
00573 event.Skip();
00574 }
00575 void N1568DemoFrame::OnSize( wxSizeEvent& event ){
00576 this->m_main_toolBar->Refresh( true);
00577 event.Skip();
00578 }