2
0
forked from Ivasoft/DSView

Remember the collection mode

This commit is contained in:
dreamsourcelabTAI
2023-05-24 15:00:11 +08:00
parent 71543d35ba
commit bd4c037af2
5 changed files with 45 additions and 27 deletions

View File

@@ -654,6 +654,11 @@ namespace pv
sessionVar["Language"] = QJsonValue::fromVariant(app._frameOptions.language);
sessionVar["Title"] = QJsonValue::fromVariant(title);
if (_device_agent->is_hardware() && _device_agent->get_work_mode() == LOGIC)
{
sessionVar["CollectMode"] = _session->get_collect_mode();
}
gvar_opts = _device_agent->get_config_list(NULL, SR_CONF_DEVICE_SESSIONS);
if (gvar_opts == NULL)
{
@@ -780,7 +785,12 @@ namespace pv
{
dsv_err("%s", "session file version is error!");
return false;
}
}
if (sessionObj.contains("CollectMode") && _device_agent->is_hardware()){
int collect_mode = sessionObj["CollectMode"].toInt();
_session->set_collect_mode((DEVICE_COLLECT_MODE)collect_mode);
}
int conf_dev_mode = sessionObj["DeviceMode"].toInt();
@@ -1938,7 +1948,7 @@ namespace pv
_protocol_widget->del_all_protocol();
if(_pattern_mode != "random"){
_session->set_operation_mode(OPT_SINGLE);
_session->set_collect_mode(COLLECT_SINGLE);
StoreSession ss(_session);
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
ss.load_decoders(_protocol_widget, deArray);

View File

@@ -91,7 +91,7 @@ namespace pv
_noData_cnt = 0;
_data_lock = false;
_data_updated = false;
_opt_mode = OPT_SINGLE;
_clt_mode = COLLECT_SINGLE;
_rt_refresh_time_id = 0;
_rt_ck_refresh_time_id = 0;
_view_data = NULL;
@@ -216,7 +216,7 @@ namespace pv
ds_device_handle old_dev = _device_agent.handle();
set_operation_mode(OPT_SINGLE);
set_collect_mode(COLLECT_SINGLE);
_callback->trigger_message(DSV_MSG_CURRENT_DEVICE_CHANGE_PREV);
@@ -515,14 +515,14 @@ namespace pv
}
if (is_loop_mode() && !_is_stream_mode){
set_operation_mode(OPT_SINGLE); // Reset the capture mode.
set_collect_mode(COLLECT_SINGLE); // Reset the capture mode.
}
if (is_loop_mode() && _device_agent.is_demo())
{
QString opt_mode = _device_agent.get_demo_operation_mode();
if (opt_mode != "random"){
set_operation_mode(OPT_SINGLE);
set_collect_mode(COLLECT_SINGLE);
}
}
@@ -1960,13 +1960,13 @@ namespace pv
}
}
void SigSession::set_operation_mode(COLLECT_OPT_MODE m)
void SigSession::set_collect_mode(DEVICE_COLLECT_MODE m)
{
assert(!_is_working);
if (_opt_mode != m)
if (_clt_mode != m)
{
_opt_mode = m;
_clt_mode = m;
_repeat_hold_prg = 0;
}
@@ -2114,6 +2114,8 @@ namespace pv
if (cur_mode != mode)
{
set_collect_mode(COLLECT_SINGLE);
_device_agent.set_config_int16(SR_CONF_DEVICE_MODE, mode);
if (cur_mode == LOGIC){

View File

@@ -74,15 +74,18 @@ class LissajousTrace;
class MathTrace;
}
enum DEVICE_STATUS_TYPE{
enum DEVICE_STATUS_TYPE
{
ST_INIT = 0,
ST_RUNNING = 1,
ST_STOPPED = 2,
};
enum COLLECT_OPT_MODE{
OPT_SINGLE = 0,
OPT_REPEAT = 1,
OPT_LOOP = 2,
enum DEVICE_COLLECT_MODE
{
COLLECT_SINGLE = 0,
COLLECT_REPEAT = 1,
COLLECT_LOOP = 2,
};
class SessionData
@@ -329,24 +332,28 @@ public:
return _device_status == ST_STOPPED;
}
void set_operation_mode(COLLECT_OPT_MODE m);
void set_collect_mode(DEVICE_COLLECT_MODE m);
inline int get_collect_mode(){
return (int)_clt_mode;
}
inline bool is_repeat_mode(){
return _opt_mode == OPT_REPEAT;
return _clt_mode == COLLECT_REPEAT;
}
inline bool is_single_mode(){
return _opt_mode == OPT_SINGLE;
return _clt_mode == COLLECT_SINGLE;
}
inline bool is_loop_mode(){
return _opt_mode == OPT_LOOP;
return _clt_mode == COLLECT_LOOP;
}
bool is_realtime_refresh();
inline bool is_repeating(){
return _opt_mode == OPT_REPEAT && !_is_instant;
return _clt_mode == COLLECT_REPEAT && !_is_instant;
}
inline void session_save(){
@@ -559,7 +566,7 @@ private:
int _confirm_store_time_id;
uint64_t _rt_refresh_time_id;
uint64_t _rt_ck_refresh_time_id;
COLLECT_OPT_MODE _opt_mode;
DEVICE_COLLECT_MODE _clt_mode;
bool _is_stream_mode;
bool _is_action;

View File

@@ -996,7 +996,7 @@ namespace pv
if (_session->is_loop_mode() && _device_agent->is_stream_mode() == false
&& _device_agent->is_hardware()){
_session->set_operation_mode(OPT_SINGLE);
_session->set_collect_mode(COLLECT_SINGLE);
}
if (_device_agent->is_stream_mode() || _device_agent->is_demo())
@@ -1030,7 +1030,7 @@ namespace pv
if (act == _action_single)
{
_session->set_operation_mode(OPT_SINGLE);
_session->set_collect_mode(COLLECT_SINGLE);
if (_device_agent->is_demo()){
_device_agent->set_config_string(SR_CONF_PATTERN_MODE, "protocol");
@@ -1042,7 +1042,7 @@ namespace pv
if (_device_agent->is_stream_mode() || _device_agent->is_demo())
{
_session->set_repeat_intvl(0.1);
_session->set_operation_mode(OPT_REPEAT);
_session->set_collect_mode(COLLECT_REPEAT);
}
else{
pv::dialogs::Interval interval_dlg(this);
@@ -1053,7 +1053,7 @@ namespace pv
if (interval_dlg.is_done())
{
_session->set_repeat_intvl(interval_dlg.get_interval());
_session->set_operation_mode(OPT_REPEAT);
_session->set_collect_mode(COLLECT_REPEAT);
}
}
@@ -1065,7 +1065,7 @@ namespace pv
}
else if (act == _action_loop)
{
_session->set_operation_mode(OPT_LOOP);
_session->set_collect_mode(COLLECT_LOOP);
if (_device_agent->is_demo()){
_device_agent->set_config_string(SR_CONF_PATTERN_MODE, "random");

View File

@@ -213,8 +213,7 @@ void DevMode::on_mode_change()
break;
}
_session->stop_capture();
_session->set_operation_mode(OPT_SINGLE);
_session->stop_capture();
_session->session_save();
_session->switch_work_mode(mode);