forked from Ivasoft/DSView
Prompt users to update firmware
This commit is contained in:
@@ -275,16 +275,6 @@ bool DeviceAgent::have_enabled_channel()
|
||||
return ds_channel_is_enabled() > 0;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_status(struct sr_status &status, gboolean prg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
if (ds_get_actived_device_status(&status, prg) == SR_OK){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeviceAgent::config_changed()
|
||||
{
|
||||
if (_callback != NULL){
|
||||
@@ -317,7 +307,9 @@ const struct sr_config_info *DeviceAgent::get_config_info(int key)
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_device_status(struct sr_status &status, gboolean prg)
|
||||
{
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
if (ds_get_actived_device_status(&status, prg) == SR_OK)
|
||||
{
|
||||
return true;
|
||||
@@ -384,5 +376,16 @@ GSList *DeviceAgent::get_channels()
|
||||
return get_operation_mode() == LO_OP_STREAM;
|
||||
}
|
||||
|
||||
bool DeviceAgent::check_firmware_version()
|
||||
{
|
||||
int st = -1;
|
||||
if (ds_get_actived_device_init_status(&st) == SR_OK){
|
||||
if (st == SR_ST_INCOMPATIBLE){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------device config end -----------/
|
||||
|
||||
|
||||
@@ -150,9 +150,7 @@ public:
|
||||
*/
|
||||
bool is_trigger_enabled();
|
||||
|
||||
bool have_enabled_channel();
|
||||
|
||||
bool get_status(struct sr_status &status, gboolean prg);
|
||||
bool have_enabled_channel();
|
||||
|
||||
GSList* get_channels();
|
||||
|
||||
@@ -183,6 +181,8 @@ public:
|
||||
|
||||
bool is_stream_mode();
|
||||
|
||||
bool check_firmware_version();
|
||||
|
||||
private:
|
||||
void config_changed();
|
||||
bool is_in_history(ds_device_handle dev_handle);
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "config/appconfig.h"
|
||||
#include "utility/path.h"
|
||||
#include "ui/msgbox.h"
|
||||
#include "ui/langresource.h"
|
||||
|
||||
namespace pv
|
||||
{
|
||||
@@ -124,6 +125,7 @@ namespace pv
|
||||
_repeat_timer.SetCallback(std::bind(&SigSession::repeat_capture_wait_timeout, this));
|
||||
_repeat_wait_prog_timer.SetCallback(std::bind(&SigSession::repeat_wait_prog_timeout, this));
|
||||
_refresh_rt_timer.SetCallback(std::bind(&SigSession::realtime_refresh_timeout, this));
|
||||
_delay_prop_msg_timer.SetCallback(std::bind(&SigSession::on_delay_prop_msg, this));
|
||||
}
|
||||
|
||||
SigSession::SigSession(SigSession &o)
|
||||
@@ -249,6 +251,12 @@ namespace pv
|
||||
// The current device changed.
|
||||
_callback->trigger_message(DSV_MSG_CURRENT_DEVICE_CHANGED);
|
||||
|
||||
if (_device_agent.is_hardware() && _device_agent.check_firmware_version() == false)
|
||||
{
|
||||
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_TO_RECONNECT_FOR_FIRMWARE), "Please reconnect the device!");
|
||||
delay_prop_msg(strMsg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -690,7 +698,7 @@ namespace pv
|
||||
uint64_t sample_limits = cur_samplelimits();
|
||||
sr_status status;
|
||||
|
||||
if (_device_agent.get_status(status, true))
|
||||
if (_device_agent.get_device_status(status, true))
|
||||
{
|
||||
triggered = status.trig_hit & 0x01;
|
||||
uint64_t captured_cnt = status.trig_hit >> 2;
|
||||
@@ -2231,4 +2239,20 @@ namespace pv
|
||||
set_cur_samplelimits(_device_agent.get_sample_limit());
|
||||
}
|
||||
|
||||
void SigSession::delay_prop_msg(QString strMsg)
|
||||
{
|
||||
_strMsg = strMsg;
|
||||
if (_strMsg != ""){
|
||||
_delay_prop_msg_timer.Start(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void SigSession::on_delay_prop_msg()
|
||||
{
|
||||
_delay_prop_msg_timer.Stop();
|
||||
|
||||
if (_strMsg != "")
|
||||
MsgBox::Show("", _strMsg);
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -410,7 +410,8 @@ public:
|
||||
}
|
||||
|
||||
void on_load_config_end();
|
||||
void init_signals();
|
||||
void init_signals();
|
||||
void delay_prop_msg(QString strMsg);
|
||||
|
||||
private:
|
||||
void set_cur_samplelimits(uint64_t samplelimits);
|
||||
@@ -490,6 +491,7 @@ private:
|
||||
void realtime_refresh_timeout();
|
||||
|
||||
void clear_signals();
|
||||
void on_delay_prop_msg();
|
||||
|
||||
private:
|
||||
mutable std::mutex _sampling_mutex;
|
||||
@@ -511,6 +513,7 @@ private:
|
||||
DsTimer _repeat_timer;
|
||||
DsTimer _repeat_wait_prog_timer;
|
||||
DsTimer _refresh_rt_timer;
|
||||
DsTimer _delay_prop_msg_timer;
|
||||
int _noData_cnt;
|
||||
bool _data_lock;
|
||||
bool _data_updated;
|
||||
@@ -545,6 +548,7 @@ private:
|
||||
uint64_t _rt_ck_refresh_time_id;
|
||||
COLLECT_OPT_MODE _opt_mode;
|
||||
bool _is_stream_mode;
|
||||
QString _strMsg;
|
||||
|
||||
|
||||
ISessionCallback *_callback;
|
||||
|
||||
Reference in New Issue
Block a user