2
0
forked from Ivasoft/DSView

Merge pull request #609 from yunyaobaihong/demo

Demo
This commit is contained in:
dreamsourcelabTAI
2023-05-05 10:16:25 +08:00
committed by GitHub
19 changed files with 2481 additions and 838 deletions

View File

@@ -116,6 +116,8 @@ namespace pv
_is_auto_switch_device = false;
_is_save_confirm_msg = false;
_pattern_mode = "RANDOM";
setup_ui();
setContextMenuPolicy(Qt::NoContextMenu);
@@ -1712,7 +1714,10 @@ namespace pv
_session->device_event_object()->device_updated();
if (_device_agent->is_hardware())
{
_session->on_load_config_end();
}
if (_device_agent->get_work_mode() == LOGIC && _device_agent->is_file() == false)
_view->auto_set_max_scale();
@@ -1731,7 +1736,33 @@ namespace pv
}
_session->start_capture(true);
}
}
if (_device_agent->is_demo())
{
if(_device_agent->get_work_mode() == LOGIC)
{
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
if(gvar != NULL)
{
_pattern_mode = g_variant_get_string(gvar,NULL);
g_variant_unref(gvar);
}
_protocol_widget->del_all_protocol();
if(_device_agent->get_work_mode() == LOGIC)
{
_view->auto_set_max_scale();
if(_pattern_mode != "RANDOM")
{
StoreSession ss(_session);
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
ss.load_decoders(_protocol_widget, deArray);
}
}
}
}
}
break;
@@ -1746,10 +1777,11 @@ namespace pv
_view->timebase_changed();
break;
case DSV_MSG_DEVICE_MODE_CHANGED:
case DSV_MSG_DEVICE_MODE_CHANGED:
_view->mode_changed();
reset_all_view();
load_device_config();
load_device_config();
update_toolbar_view_status();
_sampling_bar->update_sample_rate_list();
@@ -1758,6 +1790,27 @@ namespace pv
if (_device_agent->get_work_mode() == LOGIC)
_view->auto_set_max_scale();
if(_device_agent->is_demo())
{
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
if(gvar != NULL)
{
_pattern_mode = g_variant_get_string(gvar,NULL);
g_variant_unref(gvar);
}
_protocol_widget->del_all_protocol();
if(_device_agent->get_work_mode() == LOGIC)
{
if(_pattern_mode != "RANDOM")
{
StoreSession ss(_session);
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
ss.load_decoders(_protocol_widget, deArray);
}
}
}
break;
case DSV_MSG_NEW_USB_DEVICE:
@@ -1838,9 +1891,47 @@ namespace pv
}
break;
case DSV_MSG_END_DEVICE_OPTIONS:
break;
case DSV_MSG_END_DEVICE_OPTIONS:
if(_device_agent->is_demo() &&_device_agent->get_work_mode() == LOGIC)
{
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
if(gvar != NULL)
{
std::string pattern_mode = g_variant_get_string(gvar,NULL);
g_variant_unref(gvar);
if(pattern_mode != _pattern_mode)
{
_pattern_mode = pattern_mode;
_device_agent->set_config(NULL,NULL,SR_CONF_DEMO_INIT,g_variant_new_boolean(TRUE));
_device_agent->update();
_session->init_signals();
update_toolbar_view_status();
_sampling_bar->update_sample_rate_list();
_protocol_widget->del_all_protocol();
if(_pattern_mode != "RANDOM")
{
StoreSession ss(_session);
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
ss.load_decoders(_protocol_widget, deArray);
_session->start_capture(false);
}
}
}
}
break;
case DSV_MSG_BEGIN_DEVICE_OPTIONS:
if(_device_agent->is_demo())
{
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
if(gvar != NULL)
{
_pattern_mode = g_variant_get_string(gvar,NULL);
g_variant_unref(gvar);
}
}
}
}

View File

@@ -214,6 +214,7 @@ private:
bool _is_auto_switch_device;
high_resolution_clock::time_point _last_key_press_time;
bool _is_save_confirm_msg;
std::string _pattern_mode;
int _key_value;
bool _key_vaild;

View File

@@ -758,7 +758,10 @@ namespace pv
std::vector<view::Signal *> sigs;
unsigned int logic_probe_count = 0;
unsigned int dso_probe_count = 0;
unsigned int analog_probe_count = 0;
unsigned int analog_probe_count = 0;
set_cur_snap_samplerate(_device_agent.get_sample_rate());
set_cur_samplelimits(_device_agent.get_sample_limit());
// Detect what data types we will receive
if (_device_agent.have_instance())
@@ -841,6 +844,9 @@ namespace pv
int dso_chan_num = 0;
int all_chann_num = 0;
set_cur_snap_samplerate(_device_agent.get_sample_rate());
set_cur_samplelimits(_device_agent.get_sample_limit());
// Make the logic probe list
for (GSList *l = _device_agent.get_channels(); l; l = l->next)
{
@@ -2104,7 +2110,9 @@ namespace pv
set_cur_samplelimits(_device_agent.get_sample_limit());
dsv_info("Switch work mode to:%d", mode);
broadcast_msg(DSV_MSG_DEVICE_MODE_CHANGED);
return true;
}
return false;

View File

@@ -410,6 +410,7 @@ public:
}
void on_load_config_end();
void init_signals();
private:
void set_cur_samplelimits(uint64_t samplelimits);
@@ -446,7 +447,7 @@ private:
void capture_init();
void nodata_timeout();
void feed_timeout();
void init_signals();
void clear_decode_result();
void attach_data_to_signal(SessionData *data);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.