check required channels of the decoder

This commit is contained in:
dreamsourcelabTAI 2024-03-25 11:12:29 +08:00
parent 3e8e7c7807
commit 54ce519978
3 changed files with 35 additions and 14 deletions

View File

@ -402,6 +402,17 @@ void DecoderStack::begin_decode_work()
_decode_state = Stopped; _decode_state = Stopped;
} }
bool DecoderStack::check_required_probes()
{
for(auto dec : _stack){
if (!dec->have_required_probes()) {
return false;
}
}
return true;
}
void DecoderStack::do_decode_work() void DecoderStack::do_decode_work()
{ {
//set the flag to exit from task thread //set the flag to exit from task thread
@ -425,14 +436,12 @@ void DecoderStack::do_decode_work()
_snapshot = NULL; _snapshot = NULL;
// Check that all decoders have the required channels // Check that all decoders have the required channels
for(auto dec : _stack){ if (!check_required_probes()) {
if (!dec->have_required_probes()) { _error_message = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_WORK_ERROR),
_error_message = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_WORK_ERROR), "One or more required channels have not been specified");
"One or more required channels have not been specified"); dsv_err("ERROR:%s", _error_message.toStdString().c_str());
dsv_err("ERROR:%s", _error_message.toStdString().c_str()); return;
return; }
}
}
// We get the logic data of the first channel in the list. // We get the logic data of the first channel in the list.
// This works because we are currently assuming all // This works because we are currently assuming all

View File

@ -181,6 +181,8 @@ public:
return _progress; return _progress;
} }
bool check_required_probes();
private: private:
void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session); void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session);
void execute_decode_stack(); void execute_decode_stack();

View File

@ -664,10 +664,12 @@ bool DecodeTrace::create_popup(bool isnew)
{ {
(void)isnew; (void)isnew;
int ret = false; //setting have changed flag int ret = false; //setting have changed flag
bool bOpenDlg = true;
while (true) while (bOpenDlg)
{ {
bOpenDlg = false;
QWidget *top = AppControl::Instance()->GetTopWindow(); QWidget *top = AppControl::Instance()->GetTopWindow();
dialogs::DecoderOptionsDlg dlg(top); dialogs::DecoderOptionsDlg dlg(top);
dlg.set_cursor_range(_decode_cursor1, _decode_cursor2); dlg.set_cursor_range(_decode_cursor1, _decode_cursor2);
@ -688,14 +690,22 @@ bool DecodeTrace::create_popup(bool isnew)
} }
dlg.get_cursor_range(_decode_cursor1, _decode_cursor2); dlg.get_cursor_range(_decode_cursor1, _decode_cursor2);
// Reopen the dialog to select the required probes.
if (ret && _decoder_stack->check_required_probes() == false)
{
QString errMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_WORK_ERROR),
"One or more required channels have not been specified");
MsgBox::Show(errMsg);
ret = false;
bOpenDlg = true;
}
} }
if (dlg.is_reload_form()){ if (dlg.is_reload_form()){
ret = false; ret = false;
} bOpenDlg = true;
if (QDialog::Rejected == dlg_ret || dlg.is_reload_form() == false){
break;
} }
} }