The time to switch the captured data buffer, and the demo device's collect mode

This commit is contained in:
dreamsourcelabTAI 2023-05-23 15:03:00 +08:00
parent ed097505cc
commit 8d11cd618d
6 changed files with 24 additions and 65 deletions

View File

@ -299,7 +299,7 @@ GSList *DeviceAgent::get_channels()
return false;
}
int DeviceAgent::get_operation_mode()
int DeviceAgent::get_hardware_operation_mode()
{
assert(_dev_handle);
@ -312,7 +312,7 @@ GSList *DeviceAgent::get_channels()
bool DeviceAgent::is_stream_mode()
{
return get_operation_mode() == LO_OP_STREAM;
return get_hardware_operation_mode() == LO_OP_STREAM;
}
bool DeviceAgent::check_firmware_version()

View File

@ -169,7 +169,7 @@ public:
bool channel_is_enable(int index);
int get_operation_mode();
int get_hardware_operation_mode();
bool is_stream_mode();

View File

@ -75,7 +75,6 @@ public:
#define DSV_MSG_END_COLLECT_WORK_PREV 5005
#define DSV_MSG_END_COLLECT_WORK 5006
#define DSV_MSG_REV_END_PACKET 5007
#define DSV_MSG_SWAP_CAPTURE_BUFFER 5008
#define DSV_MSG_DEVICE_LIST_UPDATED 6000
#define DSV_MSG_BEGIN_DEVICE_OPTIONS 6001 //Begin show device options dialog.
@ -89,6 +88,7 @@ public:
#define DSV_MSG_CURRENT_DEVICE_DETACHED 6009
#define DSV_MSG_DEVICE_CONFIG_UPDATED 6010
#define DSV_MSG_DEMO_OPERATION_MODE_CHNAGED 6011
#define DSV_MSG_COLLECT_MODE_CHANGED 6012
#define DSV_MSG_TRIG_NEXT_COLLECT 7001
#define DSV_MSG_SAVE_COMPLETE 7002

View File

@ -1914,13 +1914,15 @@ namespace pv
}
break;
case DSV_MSG_BEGIN_DEVICE_OPTIONS:
case DSV_MSG_BEGIN_DEVICE_OPTIONS:
case DSV_MSG_COLLECT_MODE_CHANGED:
if(_device_agent->is_demo()){
_pattern_mode = _device_agent->get_demo_operation_mode();
}
break;
case DSV_MSG_END_DEVICE_OPTIONS:
case DSV_MSG_END_DEVICE_OPTIONS:
case DSV_MSG_DEMO_OPERATION_MODE_CHNAGED:
if(_device_agent->is_demo() &&_device_agent->get_work_mode() == LOGIC){
QString pattern_mode = _device_agent->get_demo_operation_mode();
@ -1930,44 +1932,25 @@ namespace pv
_device_agent->set_config_bool(SR_CONF_DEMO_INIT, true);
_device_agent->update();
_session->clear_view_data();
_session->init_signals();
update_toolbar_view_status();
_sampling_bar->update_sample_rate_list();
_protocol_widget->del_all_protocol();
if(_pattern_mode != "random")
{
if(_pattern_mode != "random"){
_session->set_operation_mode(OPT_SINGLE);
StoreSession ss(_session);
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
ss.load_decoders(_protocol_widget, deArray);
_session->start_capture(false);
if (msg == DSV_MSG_END_DEVICE_OPTIONS)
_session->start_capture(false); // Auto load data.
}
}
}
calc_min_height();
break;
case DSV_MSG_DEMO_OPERATION_MODE_CHNAGED:
if(_device_agent->is_demo() &&_device_agent->get_work_mode() == LOGIC){
_session->clear_view_data();
_device_agent->set_config_bool(SR_CONF_DEMO_INIT, true);
_device_agent->update();
_session->init_signals();
update_toolbar_view_status();
_sampling_bar->update_sample_rate_list();
_protocol_widget->del_all_protocol();
QString pattern_mode = _device_agent->get_demo_operation_mode();
if(pattern_mode != "random"){
_session->set_operation_mode(OPT_SINGLE);
StoreSession ss(_session);
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
ss.load_decoders(_protocol_widget, deArray);
}
}
break;
break;
}
}

View File

@ -118,7 +118,6 @@ namespace pv
_capture_times = 0;
_confirm_store_time_id = 0;
_repeat_wait_prog_step = 10;
_lst_capture_times = 0;
_device_agent.set_callback(this);
@ -621,6 +620,7 @@ namespace pv
clear_decode_result();
}
// Set the buffer to store the captured data
if (bSwapBuffer){
int buf_index = 0;
for(int i=0; i<(int)_data_list.size(); i++){
@ -1074,17 +1074,7 @@ namespace pv
}
void SigSession::feed_in_logic(const sr_datafeed_logic &o)
{
//Switch the data buffer.
if (o.length > 0 && is_repeat_mode() && _is_stream_mode)
{
if (_capture_times != _lst_capture_times && _capture_times > 1)
{
_lst_capture_times = _capture_times;
_callback->trigger_message(DSV_MSG_SWAP_CAPTURE_BUFFER);
}
}
{
if (_capture_data->get_logic()->memory_failed())
{
dsv_err("%s", "Unexpected logic packet");
@ -1979,6 +1969,8 @@ namespace pv
_opt_mode = m;
_repeat_hold_prg = 0;
}
_callback->trigger_message(DSV_MSG_COLLECT_MODE_CHANGED);
}
void SigSession::repeat_capture_wait_timeout()
@ -2065,6 +2057,10 @@ namespace pv
bAddDecoder = true;
bSwapBuffer = true;
}
else if (_capture_times > 1){
bAddDecoder = true;
bSwapBuffer = true;
}
}
else if (is_loop_mode())
{
@ -2076,7 +2072,7 @@ namespace pv
clear_decode_result();
}
//Swap caputrued data buffer
//Switch the caputrued data buffer to view.
if (bSwapBuffer)
{
if (_view_data != _capture_data)
@ -2100,25 +2096,6 @@ namespace pv
}
}
break;
case DSV_MSG_SWAP_CAPTURE_BUFFER:
{
clear_all_decode_task2();
clear_decode_result();
_view_data = _capture_data;
attach_data_to_signal(_view_data);
if (_is_stream_mode && is_repeat_mode())
{
for (auto de : _decode_traces){
de->decoder()->set_capture_end_flag(false);
de->frame_ended();
add_decode_task(de);
}
}
}
break;
case DSV_MSG_COLLECT_END:
break;

View File

@ -555,8 +555,7 @@ private:
bool _is_instant;
int _device_status;
int _work_time_id;
int _capture_times;
int _lst_capture_times;
int _capture_times;
int _confirm_store_time_id;
uint64_t _rt_refresh_time_id;
uint64_t _rt_ck_refresh_time_id;