When the device is stream mode and capture single times, real time refresh the view

This commit is contained in:
dreamsourcelabTAI 2023-04-11 16:22:42 +08:00
parent d5008eea3f
commit 7bd24cc1b6
4 changed files with 32 additions and 14 deletions

View File

@ -95,6 +95,7 @@ namespace pv
_rt_ck_refresh_time_id = 0;
_view_data = NULL;
_capture_data = NULL;
_is_stream_mode = false;
_data_list.push_back(new SessionData());
_data_list.push_back(new SessionData());
@ -463,8 +464,9 @@ namespace pv
_capture_data->clear();
_view_data->clear();
if (_device_agent.get_work_mode() == LOGIC && is_repeat_mode())
int mode = _device_agent.get_work_mode();
if (mode == LOGIC && is_repeat_mode())
{
if (_view_data == _capture_data){
for (auto dt : _data_list){
@ -473,11 +475,20 @@ namespace pv
break;
}
}
}
}
}
else{
_capture_data = _view_data;
}
_is_stream_mode = false;
if (mode == LOGIC && _device_agent.is_hardware())
{
int mode_val = 0;
if (_device_agent.get_config_value_int16(SR_CONF_OPERATION_MODE, mode_val)){
_is_stream_mode = mode_val == LO_OP_STREAM;
}
}
update_view();
@ -499,7 +510,7 @@ namespace pv
_callback->trigger_message(DSV_MSG_START_COLLECT_WORK);
// Start a timer, for able to refresh the view per (1000 / 30)ms on real-time mode.
if (is_realtime_mode()){
if (is_realtime_refresh()){
_refresh_rt_timer.Start(1000 / 30);
}
return true;
@ -1851,13 +1862,13 @@ namespace pv
}
}
void SigSession::set_operation_mode(COLLECT_OPT_MODE repeat)
void SigSession::set_operation_mode(COLLECT_OPT_MODE m)
{
assert(!_is_working);
if (_opt_mode != repeat)
if (_opt_mode != m)
{
_opt_mode = repeat;
_opt_mode = m;
_repeat_hold_prg = 0;
}
}

View File

@ -83,6 +83,7 @@ enum COLLECT_OPT_MODE{
OPT_SINGLE = 0,
OPT_REPEAT = 1,
OPT_REALTIME = 2,
OPT_LOOP = 3,
};
class SessionData
@ -329,7 +330,7 @@ public:
return _device_status == ST_STOPPED;
}
void set_operation_mode(COLLECT_OPT_MODE repeat);
void set_operation_mode(COLLECT_OPT_MODE m);
inline bool is_repeat_mode(){
return _opt_mode == OPT_REPEAT;
@ -343,6 +344,10 @@ public:
return _opt_mode == OPT_REALTIME;
}
inline bool is_realtime_refresh(){
return (is_realtime_mode() || (_is_stream_mode && is_single_mode()));
}
inline bool is_repeating(){
return _opt_mode == OPT_REPEAT && !_is_instant;
}
@ -532,6 +537,7 @@ private:
uint64_t _rt_refresh_time_id;
uint64_t _rt_ck_refresh_time_id;
COLLECT_OPT_MODE _opt_mode;
bool _is_stream_mode;
ISessionCallback *_callback;

View File

@ -903,7 +903,7 @@ namespace pv
}
}
if (_device_agent->get_work_mode() == LOGIC && _session->is_realtime_mode()){
if (_device_agent->get_work_mode() == LOGIC && _session->is_realtime_refresh()){
if (_view != NULL)
_view->auto_set_max_scale();
}
@ -979,7 +979,7 @@ namespace pv
}
}
if (_device_agent->get_work_mode() == LOGIC && _session->is_realtime_mode()){
if (_device_agent->get_work_mode() == LOGIC && _session->is_realtime_refresh()){
if (_view != NULL)
_view->auto_set_max_scale();
}
@ -1057,8 +1057,9 @@ namespace pv
{
QString iconPath = GetIconPath();
int mode = _device_agent->get_work_mode();
_action_realtime->setVisible(false);
int mode = _device_agent->get_work_mode();
if (mode == LOGIC)
{
if (_device_agent->is_file()){
@ -1074,7 +1075,7 @@ namespace pv
{
int mode_val = 0;
if (_device_agent->get_config_value_int16(SR_CONF_OPERATION_MODE, mode_val)){
_action_realtime->setVisible(mode_val == LO_OP_STREAM);
//_action_realtime->setVisible(mode_val == LO_OP_STREAM);
}
}
}

View File

@ -181,7 +181,7 @@ void Viewport::doPaint()
{
paintSignals(p, fore, back);
}
else if (_view.session().is_realtime_mode())
else if (_view.session().is_realtime_refresh())
{
_view.session().have_new_realtime_refresh(false); // Try to reset refresh timer.
paintSignals(p, fore, back);
@ -1340,7 +1340,7 @@ void Viewport::set_receive_len(quint64 length)
// Do not to refresh the view until data collection is complete.
return;
}
else if (_view.session().is_realtime_mode())
else if (_view.session().is_realtime_refresh())
{
if (_view.session().have_new_realtime_refresh(true) == false){
return;