| 370 | } |
| 371 | |
| 372 | void MainWindow::on_session_error() |
| 373 | { |
| 374 | QString title; |
| 375 | QString details; |
| 376 | QString ch_status = ""; |
| 377 | |
| 378 | switch (_session->get_error()) |
| 379 | { |
| 380 | case SigSession::Hw_err: |
| 381 | dsv_info("MainWindow::on_session_error(),Hw_err, stop capture"); |
| 382 | _session->stop_capture(); |
| 383 | title = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_HARDWARE_ERROR), "Hardware Operation Failed"); |
| 384 | details = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_HARDWARE_ERROR_DET), |
| 385 | "Please replug device to refresh hardware configuration!"); |
| 386 | break; |
| 387 | case SigSession::Malloc_err: |
| 388 | dsv_info("MainWindow::on_session_error(),Malloc_err, stop capture"); |
| 389 | _session->stop_capture(); |
| 390 | title = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_MALLOC_ERROR), "Malloc Error"); |
| 391 | details = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_MALLOC_ERROR_DET), |
| 392 | "Memory is not enough for this sample!\nPlease reduce the sample depth!"); |
| 393 | break; |
| 394 | case SigSession::Pkt_data_err: |
| 395 | title = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_PACKET_ERROR), "Packet Error"); |
| 396 | details = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_PACKET_ERROR_DET), |
| 397 | "the content of received packet are not expected!"); |
| 398 | _session->refresh(0); |
| 399 | break; |
| 400 | case SigSession::Data_overflow: |
| 401 | dsv_info("MainWindow::on_session_error(),Data_overflow, stop capture"); |
| 402 | _session->stop_capture(); |
| 403 | title = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DATA_OVERFLOW), "Data Overflow"); |
| 404 | details = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DATA_OVERFLOW_DET), |
| 405 | "USB bandwidth can not support current sample rate! \nPlease reduce the sample rate!"); |
| 406 | break; |
| 407 | default: |
| 408 | title = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_UNDEFINED_ERROR), "Undefined Error"); |
| 409 | details = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_UNDEFINED_ERROR_DET), "Not expected error!"); |
| 410 | break; |
| 411 | } |
| 412 | |
| 413 | pv::dialogs::DSMessageBox msg(this, title); |
| 414 | msg.mBox()->setText(details); |
| 415 | msg.mBox()->setStandardButtons(QMessageBox::Ok); |
| 416 | msg.mBox()->setIcon(QMessageBox::Warning); |
| 417 | connect(_session->device_event_object(), SIGNAL(device_updated()), &msg, SLOT(accept())); |
| 418 | _msg = &msg; |
| 419 | msg.exec(); |
| 420 | _msg = NULL; |
| 421 | |
| 422 | _session->clear_error(); |
| 423 | } |
| 424 | |
| 425 | void MainWindow::save_config() |
| 426 | { |
nothing calls this directly
no test coverage detected