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; return false;
} }
int DeviceAgent::get_operation_mode() int DeviceAgent::get_hardware_operation_mode()
{ {
assert(_dev_handle); assert(_dev_handle);
@ -312,7 +312,7 @@ GSList *DeviceAgent::get_channels()
bool DeviceAgent::is_stream_mode() 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() bool DeviceAgent::check_firmware_version()

View File

@ -169,7 +169,7 @@ public:
bool channel_is_enable(int index); bool channel_is_enable(int index);
int get_operation_mode(); int get_hardware_operation_mode();
bool is_stream_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_PREV 5005
#define DSV_MSG_END_COLLECT_WORK 5006 #define DSV_MSG_END_COLLECT_WORK 5006
#define DSV_MSG_REV_END_PACKET 5007 #define DSV_MSG_REV_END_PACKET 5007
#define DSV_MSG_SWAP_CAPTURE_BUFFER 5008
#define DSV_MSG_DEVICE_LIST_UPDATED 6000 #define DSV_MSG_DEVICE_LIST_UPDATED 6000
#define DSV_MSG_BEGIN_DEVICE_OPTIONS 6001 //Begin show device options dialog. #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_CURRENT_DEVICE_DETACHED 6009
#define DSV_MSG_DEVICE_CONFIG_UPDATED 6010 #define DSV_MSG_DEVICE_CONFIG_UPDATED 6010
#define DSV_MSG_DEMO_OPERATION_MODE_CHNAGED 6011 #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_TRIG_NEXT_COLLECT 7001
#define DSV_MSG_SAVE_COMPLETE 7002 #define DSV_MSG_SAVE_COMPLETE 7002

View File

@ -1915,12 +1915,14 @@ namespace pv
break; break;
case DSV_MSG_BEGIN_DEVICE_OPTIONS: case DSV_MSG_BEGIN_DEVICE_OPTIONS:
case DSV_MSG_COLLECT_MODE_CHANGED:
if(_device_agent->is_demo()){ if(_device_agent->is_demo()){
_pattern_mode = _device_agent->get_demo_operation_mode(); _pattern_mode = _device_agent->get_demo_operation_mode();
} }
break; 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){ if(_device_agent->is_demo() &&_device_agent->get_work_mode() == LOGIC){
QString pattern_mode = _device_agent->get_demo_operation_mode(); 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->set_config_bool(SR_CONF_DEMO_INIT, true);
_device_agent->update(); _device_agent->update();
_session->clear_view_data();
_session->init_signals(); _session->init_signals();
update_toolbar_view_status(); update_toolbar_view_status();
_sampling_bar->update_sample_rate_list(); _sampling_bar->update_sample_rate_list();
_protocol_widget->del_all_protocol(); _protocol_widget->del_all_protocol();
if(_pattern_mode != "random") if(_pattern_mode != "random"){
{
_session->set_operation_mode(OPT_SINGLE); _session->set_operation_mode(OPT_SINGLE);
StoreSession ss(_session); StoreSession ss(_session);
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path()); QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
ss.load_decoders(_protocol_widget, deArray); 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(); calc_min_height();
break; 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;
} }
} }

View File

@ -118,7 +118,6 @@ namespace pv
_capture_times = 0; _capture_times = 0;
_confirm_store_time_id = 0; _confirm_store_time_id = 0;
_repeat_wait_prog_step = 10; _repeat_wait_prog_step = 10;
_lst_capture_times = 0;
_device_agent.set_callback(this); _device_agent.set_callback(this);
@ -621,6 +620,7 @@ namespace pv
clear_decode_result(); clear_decode_result();
} }
// Set the buffer to store the captured data
if (bSwapBuffer){ if (bSwapBuffer){
int buf_index = 0; int buf_index = 0;
for(int i=0; i<(int)_data_list.size(); i++){ for(int i=0; i<(int)_data_list.size(); i++){
@ -1075,16 +1075,6 @@ namespace pv
void SigSession::feed_in_logic(const sr_datafeed_logic &o) 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()) if (_capture_data->get_logic()->memory_failed())
{ {
dsv_err("%s", "Unexpected logic packet"); dsv_err("%s", "Unexpected logic packet");
@ -1979,6 +1969,8 @@ namespace pv
_opt_mode = m; _opt_mode = m;
_repeat_hold_prg = 0; _repeat_hold_prg = 0;
} }
_callback->trigger_message(DSV_MSG_COLLECT_MODE_CHANGED);
} }
void SigSession::repeat_capture_wait_timeout() void SigSession::repeat_capture_wait_timeout()
@ -2065,6 +2057,10 @@ namespace pv
bAddDecoder = true; bAddDecoder = true;
bSwapBuffer = true; bSwapBuffer = true;
} }
else if (_capture_times > 1){
bAddDecoder = true;
bSwapBuffer = true;
}
} }
else if (is_loop_mode()) else if (is_loop_mode())
{ {
@ -2076,7 +2072,7 @@ namespace pv
clear_decode_result(); clear_decode_result();
} }
//Swap caputrued data buffer //Switch the caputrued data buffer to view.
if (bSwapBuffer) if (bSwapBuffer)
{ {
if (_view_data != _capture_data) if (_view_data != _capture_data)
@ -2101,25 +2097,6 @@ namespace pv
} }
break; 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: case DSV_MSG_COLLECT_END:
break; break;
} }

View File

@ -556,7 +556,6 @@ private:
int _device_status; int _device_status;
int _work_time_id; int _work_time_id;
int _capture_times; int _capture_times;
int _lst_capture_times;
int _confirm_store_time_id; int _confirm_store_time_id;
uint64_t _rt_refresh_time_id; uint64_t _rt_refresh_time_id;
uint64_t _rt_ck_refresh_time_id; uint64_t _rt_ck_refresh_time_id;