mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
Config operation API
This commit is contained in:
parent
2757fc3a37
commit
b764092b91
@ -70,56 +70,6 @@ void DeviceAgent::update()
|
||||
return _di;
|
||||
}
|
||||
|
||||
GVariant* DeviceAgent::get_config(const sr_channel *ch, const sr_channel_group *group, int key)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
GVariant *data = NULL;
|
||||
|
||||
int ret = ds_get_actived_device_config(ch, group, key, &data);
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: Failed to get value of config id:", key);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config(sr_channel *ch, sr_channel_group *group, int key, GVariant *data)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
int ret = ds_set_actived_device_config(ch, group, key, data);
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
|
||||
config_changed();
|
||||
return true;
|
||||
}
|
||||
|
||||
GVariant* DeviceAgent::get_config_list(const sr_channel_group *group, int key)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *data = NULL;
|
||||
|
||||
int ret = ds_get_actived_device_config_list(group, key, &data);
|
||||
if (ret != SR_OK){
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_detail("%s%d", "WARNING: Failed to get config list, key:", key);
|
||||
|
||||
if (data != NULL){
|
||||
dsv_warn("%s%d", "WARNING: Failed to get config list, but data is not null. key:", key);
|
||||
}
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool DeviceAgent::enable_probe(const sr_channel *probe, bool enable)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
@ -349,39 +299,12 @@ GSList *DeviceAgent::get_channels()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_value_int16(int key, int &value)
|
||||
{
|
||||
GVariant* gvar = get_config(NULL, NULL, key);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_value_string(int key, QString &value)
|
||||
{
|
||||
GVariant* gvar = get_config(NULL, NULL, key);
|
||||
|
||||
if (gvar != NULL) {
|
||||
const gchar *s = g_variant_get_string(gvar, NULL);
|
||||
value = QString(s);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int DeviceAgent::get_operation_mode()
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
int mode_val = 0;
|
||||
if (get_config_value_int16(SR_CONF_OPERATION_MODE, mode_val)){
|
||||
if (get_config_int16(SR_CONF_OPERATION_MODE, mode_val)){
|
||||
return mode_val;
|
||||
}
|
||||
return -1;
|
||||
@ -414,20 +337,125 @@ GSList *DeviceAgent::get_channels()
|
||||
}
|
||||
|
||||
QString pattern_mode;
|
||||
if(get_config_value_string(SR_CONF_PATTERN_MODE, pattern_mode) == false)
|
||||
if(get_config_string(SR_CONF_PATTERN_MODE, pattern_mode) == false)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
return pattern_mode;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_string(int key, const char *value)
|
||||
GVariant* DeviceAgent::get_config_list(const sr_channel_group *group, int key)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *data = NULL;
|
||||
|
||||
int ret = ds_get_actived_device_config_list(group, key, &data);
|
||||
if (ret != SR_OK){
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_detail("%s%d", "WARNING: Failed to get config list, key:", key);
|
||||
|
||||
if (data != NULL){
|
||||
dsv_warn("%s%d", "WARNING: Failed to get config list, but data is not null. key:", key);
|
||||
}
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
GVariant* DeviceAgent::get_config(int key, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
GVariant *data = NULL;
|
||||
|
||||
int ret = ds_get_actived_device_config(ch, cg, key, &data);
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR:DeviceAgent::get_config, Failed to get value of config id:", key);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
bool DeviceAgent::have_config(int key, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant *gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL){
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config(int key, GVariant *data, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, data);
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR:DeviceAgent::set_config, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
|
||||
config_changed();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_int32(int key, int &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_int32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_int32(int key, int value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_int32(value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_int32, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_string(int key, QString &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
const gchar *s = g_variant_get_string(gvar, NULL);
|
||||
value = QString(s);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_string(int key, const char *value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(value);
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_string(value);
|
||||
int ret = ds_set_actived_device_config(NULL, NULL, key, gvar);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
@ -437,5 +465,209 @@ GSList *DeviceAgent::get_channels()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_bool(int key, bool &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
gboolean v = g_variant_get_boolean(gvar);
|
||||
value = v > 0;
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_bool(int key, bool value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_boolean(value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_bool, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_uint64(int key, uint64_t &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_uint64(int key, uint64_t value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_uint64(value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_uint64, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_uint16(int key, int &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_uint16(int key, int value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_uint16(value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_uint16, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_uint32(int key, uint32_t &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_uint32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_uint32(int key, uint32_t value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_uint32(value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_uint32, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_int16(int key, int &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_int16(int key, int value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_int16(value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_int16, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_byte(int key, int &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_byte(int key, int value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_byte((uint8_t)value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_byte, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAgent::get_config_double(int key, double &value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
GVariant* gvar = get_config(key, ch, cg);
|
||||
|
||||
if (gvar != NULL) {
|
||||
value = g_variant_get_double(gvar);
|
||||
g_variant_unref(gvar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceAgent::set_config_double(int key, double value, const sr_channel *ch, const sr_channel_group *cg)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
GVariant *gvar = g_variant_new_double(value);
|
||||
int ret = ds_set_actived_device_config(ch, cg, key, gvar);
|
||||
|
||||
if (ret != SR_OK)
|
||||
{
|
||||
if (ret != SR_ERR_NA)
|
||||
dsv_err("%s%d", "ERROR: DeviceAgent::set_config_double, Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------device config end -----------/
|
||||
|
||||
|
@ -91,22 +91,12 @@ public:
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
GVariant* get_config(const sr_channel *ch, const sr_channel_group *group, int key);
|
||||
|
||||
bool set_config(sr_channel *ch, sr_channel_group *group, int key, GVariant *data);
|
||||
|
||||
GVariant* get_config_list(const sr_channel_group *group, int key);
|
||||
|
||||
bool enable_probe(const sr_channel *probe, bool enable);
|
||||
|
||||
bool enable_probe(int probe_index, bool enable);
|
||||
|
||||
bool set_channel_name(int ch_index, const char *name);
|
||||
|
||||
bool get_config_value_int16(int key, int &value);
|
||||
|
||||
bool get_config_value_string(int key, QString &value);
|
||||
|
||||
/**
|
||||
* @brief Gets the sample limit from the driver.
|
||||
*
|
||||
@ -187,7 +177,38 @@ public:
|
||||
|
||||
QString get_demo_operation_mode();
|
||||
|
||||
bool set_config_string(int key, const char *value);
|
||||
GVariant* get_config_list(const sr_channel_group *group, int key);
|
||||
|
||||
GVariant* get_config(int key, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config(int key, GVariant *data, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool have_config(int key, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_string(int key, QString &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_string(int key, const char *value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_bool(int key, bool &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_bool(int key, bool value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_uint64(int key, uint64_t &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_uint64(int key, uint64_t value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_uint16(int key, int &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_uint16(int key, int value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_uint32(int key, uint32_t &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_uint32(int key, uint32_t value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_int16(int key, int &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_int16(int key, int value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_int32(int key, int &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_int32(int key, int value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_byte(int key, int &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_byte(int key, int value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
bool get_config_double(int key, double &value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
bool set_config_double(int key, double value, const sr_channel *ch = NULL, const sr_channel_group *cg = NULL);
|
||||
|
||||
private:
|
||||
void config_changed();
|
||||
@ -205,7 +226,6 @@ public:
|
||||
|
||||
void free_config(struct sr_config *src);
|
||||
|
||||
|
||||
private:
|
||||
ds_device_handle _dev_handle;
|
||||
int _dev_type;
|
||||
|
@ -151,22 +151,11 @@ void Calibration::update_device_info()
|
||||
assert(probe);
|
||||
|
||||
uint64_t vgain = 0, vgain_default = 0;
|
||||
uint16_t vgain_range = 0;
|
||||
GVariant* gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_VGAIN);
|
||||
if (gvar != NULL) {
|
||||
vgain = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_VGAIN_DEFAULT);
|
||||
if (gvar != NULL) {
|
||||
vgain_default = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_VGAIN_RANGE);
|
||||
if (gvar != NULL) {
|
||||
vgain_range = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
int vgain_range = 0;
|
||||
|
||||
_device_agent->get_config_uint64(SR_CONF_PROBE_VGAIN, vgain, probe, NULL);
|
||||
_device_agent->get_config_uint64(SR_CONF_PROBE_VGAIN_DEFAULT, vgain_default, probe, NULL);
|
||||
_device_agent->get_config_uint16(SR_CONF_PROBE_VGAIN_RANGE, vgain_range, probe, NULL);
|
||||
|
||||
QSlider *gain_slider = new QSlider(Qt::Horizontal, this);
|
||||
gain_slider->setRange(-vgain_range/2, vgain_range/2);
|
||||
@ -180,16 +169,15 @@ void Calibration::update_device_info()
|
||||
|
||||
uint64_t voff = 0;
|
||||
uint16_t voff_range = 0;
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_PREOFF);
|
||||
if (gvar != NULL) {
|
||||
voff = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
int v;
|
||||
|
||||
if (_device_agent->get_config_uint16(SR_CONF_PROBE_PREOFF, v, probe, NULL)) {
|
||||
voff = (uint64_t)v;
|
||||
}
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_PREOFF_MARGIN);
|
||||
if (gvar != NULL) {
|
||||
voff_range = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (_device_agent->get_config_uint16(SR_CONF_PROBE_PREOFF_MARGIN, v, probe, NULL)) {
|
||||
voff_range = (uint16_t)v;
|
||||
}
|
||||
|
||||
QSlider *off_slider = new QSlider(Qt::Horizontal, this);
|
||||
off_slider->setRange(0, voff_range);
|
||||
off_slider->setValue(voff);
|
||||
@ -201,18 +189,12 @@ void Calibration::update_device_info()
|
||||
_label_list.push_back(off_label);
|
||||
|
||||
bool comb_comp_en = false;
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_PROBE_COMB_COMP_EN);
|
||||
if (gvar != NULL) {
|
||||
comb_comp_en = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_bool(SR_CONF_PROBE_COMB_COMP_EN, comb_comp_en);
|
||||
|
||||
if (comb_comp_en) {
|
||||
int16_t comb_comp = 0;
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_COMB_COMP);
|
||||
if (gvar != NULL) {
|
||||
comb_comp = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
int comb_comp = 0;
|
||||
_device_agent->get_config_int16(SR_CONF_PROBE_COMB_COMP, comb_comp, probe, NULL);
|
||||
|
||||
QSlider *comp_slider = new QSlider(Qt::Horizontal, this);
|
||||
comp_slider->setRange(-127, 127);
|
||||
comp_slider->setValue(comb_comp);
|
||||
@ -235,14 +217,14 @@ void Calibration::update_device_info()
|
||||
void Calibration::accept()
|
||||
{
|
||||
using namespace Qt;
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_CALI, g_variant_new_boolean(false));
|
||||
_device_agent->set_config_bool(SR_CONF_CALI, false);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void Calibration::reject()
|
||||
{
|
||||
using namespace Qt;
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_CALI, g_variant_new_boolean(false));
|
||||
_device_agent->set_config_bool(SR_CONF_CALI, false);
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
@ -255,21 +237,17 @@ void Calibration::set_value(int value)
|
||||
assert(probe);
|
||||
if (sc->objectName() == VGAIN+probe->index) {
|
||||
uint64_t vgain_default;
|
||||
GVariant* gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_VGAIN_DEFAULT);
|
||||
if (gvar != NULL) {
|
||||
vgain_default = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
_device_agent->set_config(probe, NULL, SR_CONF_PROBE_VGAIN,
|
||||
g_variant_new_uint64(value+vgain_default));
|
||||
if (_device_agent->get_config_uint64(SR_CONF_PROBE_VGAIN_DEFAULT, vgain_default, probe))
|
||||
{
|
||||
_device_agent->set_config_uint64(SR_CONF_PROBE_VGAIN, value+vgain_default, probe);
|
||||
}
|
||||
break;
|
||||
} else if (sc->objectName() == VOFF+probe->index) {
|
||||
_device_agent->set_config(probe, NULL, SR_CONF_PROBE_PREOFF,
|
||||
g_variant_new_uint16(value));
|
||||
}
|
||||
else if (sc->objectName() == VOFF+probe->index) {
|
||||
_device_agent->set_config_uint16(SR_CONF_PROBE_PREOFF, value, probe);
|
||||
break;
|
||||
} else if (sc->objectName() == VCOMB+probe->index) {
|
||||
_device_agent->set_config(probe, NULL, SR_CONF_PROBE_COMB_COMP,
|
||||
g_variant_new_int16(value));
|
||||
_device_agent->set_config_int16(SR_CONF_PROBE_COMB_COMP, value, probe);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -279,12 +257,11 @@ void Calibration::on_save()
|
||||
{
|
||||
this->hide();
|
||||
QFuture<void> future;
|
||||
|
||||
future = QtConcurrent::run([&]{
|
||||
//QTime dieTime = QTime::currentTime().addSecs(1);
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO_SET,
|
||||
g_variant_new_boolean(true));
|
||||
//while( QTime::currentTime() < dieTime );
|
||||
_device_agent->set_config_bool( SR_CONF_ZERO_SET, true);
|
||||
});
|
||||
|
||||
Qt::WindowFlags flags = Qt::CustomizeWindowHint;
|
||||
QProgressDialog dlg(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_SAVE_CALIBRATION_RESULTS),
|
||||
"Save calibration results... It can take a while."),
|
||||
@ -307,13 +284,12 @@ void Calibration::on_abort()
|
||||
{
|
||||
this->hide();
|
||||
QFuture<void> future;
|
||||
|
||||
future = QtConcurrent::run([&]{
|
||||
//QTime dieTime = QTime::currentTime().addSecs(1);
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO_LOAD,
|
||||
g_variant_new_boolean(true));
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO_LOAD, true);
|
||||
reload_value();
|
||||
//while( QTime::currentTime() < dieTime );
|
||||
});
|
||||
|
||||
Qt::WindowFlags flags = Qt::CustomizeWindowHint;
|
||||
QProgressDialog dlg(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_RELOAD_CALIBRATION_RESULTS),
|
||||
"Reload last calibration results... It can take a while."),
|
||||
@ -338,35 +314,16 @@ void Calibration::reload_value()
|
||||
assert(probe);
|
||||
|
||||
uint64_t vgain = 0, vgain_default = 0;
|
||||
uint16_t vgain_range = 0;
|
||||
GVariant* gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_VGAIN);
|
||||
if (gvar != NULL) {
|
||||
vgain = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_VGAIN_DEFAULT);
|
||||
if (gvar != NULL) {
|
||||
vgain_default = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_VGAIN_RANGE);
|
||||
if (gvar != NULL) {
|
||||
vgain_range = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
int vgain_range = 0;
|
||||
_device_agent->get_config_uint64(SR_CONF_PROBE_VGAIN, vgain, probe, NULL);
|
||||
_device_agent->get_config_uint64(SR_CONF_PROBE_VGAIN_DEFAULT, vgain_default, probe, NULL);
|
||||
_device_agent->get_config_uint16(SR_CONF_PROBE_VGAIN_RANGE, vgain_range, probe, NULL);
|
||||
|
||||
uint64_t voff = 0;
|
||||
uint16_t voff_range = 0;
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_PREOFF);
|
||||
if (gvar != NULL) {
|
||||
voff = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_PREOFF_MARGIN);
|
||||
if (gvar != NULL) {
|
||||
voff_range = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
int voff = 0;
|
||||
int voff_range = 0;
|
||||
|
||||
_device_agent->get_config_uint16(SR_CONF_PROBE_PREOFF, voff, probe, NULL);
|
||||
_device_agent->get_config_uint16(SR_CONF_PROBE_PREOFF_MARGIN, voff_range, probe, NULL);
|
||||
|
||||
for(std::list<QSlider*>::iterator i = _slider_list.begin();
|
||||
i != _slider_list.end(); i++) {
|
||||
@ -387,8 +344,7 @@ void Calibration::on_reset()
|
||||
"All calibration settings will become the defualt values!"));
|
||||
|
||||
if (MsgBox::Confirm(strMsg)) {
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO_DEFAULT,
|
||||
g_variant_new_boolean(true));
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO_DEFAULT, true);
|
||||
reload_value();
|
||||
}
|
||||
}
|
||||
|
@ -144,11 +144,7 @@ DeviceOptions::DeviceOptions(QWidget *parent) :
|
||||
auto button_box = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this);
|
||||
this->layout()->addWidget(button_box);
|
||||
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_OPERATION_MODE);
|
||||
if (gvar != NULL) {
|
||||
_opt_mode = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_int16(SR_CONF_OPERATION_MODE, _opt_mode);
|
||||
|
||||
try_resize_scroll();
|
||||
|
||||
@ -282,13 +278,10 @@ void DeviceOptions::logic_probes(QVBoxLayout &layout)
|
||||
struct sr_list_item *plist = (struct sr_list_item*)g_variant_get_uint64(gvar_opts);
|
||||
g_variant_unref(gvar_opts);
|
||||
|
||||
GVariant* mode_var = _device_agent->get_config(NULL, NULL, SR_CONF_CHANNEL_MODE);
|
||||
assert(mode_var);
|
||||
int ch_mode = 0;
|
||||
_device_agent->get_config_int16(SR_CONF_CHANNEL_MODE, ch_mode);
|
||||
_channel_mode_indexs.clear();
|
||||
|
||||
int ch_mode = g_variant_get_int16(mode_var);
|
||||
g_variant_unref(mode_var);
|
||||
|
||||
while (plist != NULL && plist->id >= 0)
|
||||
{
|
||||
row1++;
|
||||
@ -312,11 +305,7 @@ void DeviceOptions::logic_probes(QVBoxLayout &layout)
|
||||
}
|
||||
}
|
||||
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_VLD_CH_NUM);
|
||||
if (gvar != NULL) {
|
||||
vld_ch_num = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_int16(SR_CONF_VLD_CH_NUM, vld_ch_num);
|
||||
|
||||
// channels
|
||||
QHBoxLayout *line_lay = NULL;
|
||||
@ -401,12 +390,10 @@ void DeviceOptions::enable_max_probes() {
|
||||
cur_ch_num++;
|
||||
}
|
||||
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_VLD_CH_NUM);
|
||||
if (gvar == NULL)
|
||||
return;
|
||||
int vld_ch_num;
|
||||
|
||||
int vld_ch_num = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (_device_agent->get_config_int16(SR_CONF_VLD_CH_NUM, vld_ch_num) == false)
|
||||
return;
|
||||
|
||||
while(cur_ch_num < vld_ch_num && cur_ch_num < (int)_probes_checkBox_list.size()) {
|
||||
auto box = _probes_checkBox_list[cur_ch_num];
|
||||
@ -419,11 +406,9 @@ void DeviceOptions::enable_max_probes() {
|
||||
|
||||
void DeviceOptions::enable_all_probes()
|
||||
{
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
bool stream_mode = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool stream_mode;
|
||||
|
||||
if (_device_agent->get_config_bool(SR_CONF_STREAM, stream_mode)) {
|
||||
if (stream_mode) {
|
||||
enable_max_probes();
|
||||
return;
|
||||
@ -448,10 +433,10 @@ void DeviceOptions::zero_adj()
|
||||
bool bRet = MsgBox::Confirm(strMsg);
|
||||
|
||||
if (bRet) {
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO, g_variant_new_boolean(true));
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO, true);
|
||||
}
|
||||
else {
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO, g_variant_new_boolean(false));
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,7 +444,7 @@ void DeviceOptions::on_calibration()
|
||||
{
|
||||
using namespace Qt;
|
||||
QDialog::accept();
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_CALI, g_variant_new_boolean(true));
|
||||
_device_agent->set_config_bool(SR_CONF_CALI, true);
|
||||
}
|
||||
|
||||
void DeviceOptions::mode_check_timeout()
|
||||
@ -469,11 +454,8 @@ void DeviceOptions::mode_check_timeout()
|
||||
|
||||
bool test;
|
||||
int mode;
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_OPERATION_MODE);
|
||||
if (gvar != NULL) {
|
||||
mode = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
if (_device_agent->get_config_int16(SR_CONF_OPERATION_MODE, mode)) {
|
||||
if (mode != _opt_mode) {
|
||||
_opt_mode = mode;
|
||||
build_dynamic_panel();
|
||||
@ -481,11 +463,7 @@ void DeviceOptions::mode_check_timeout()
|
||||
}
|
||||
}
|
||||
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_TEST);
|
||||
if (gvar != NULL) {
|
||||
test = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
if (_device_agent->get_config_bool(SR_CONF_TEST, test)) {
|
||||
if (test) {
|
||||
for (auto box : _probes_checkBox_list) {
|
||||
box->setCheckState(Qt::Checked);
|
||||
@ -509,9 +487,7 @@ void DeviceOptions::channel_check()
|
||||
}
|
||||
}
|
||||
assert(mode_index >= 0);
|
||||
|
||||
GVariant* gvar = g_variant_new_int16(mode_index);
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_CHANNEL_MODE, gvar);
|
||||
_device_agent->set_config_int16(SR_CONF_CHANNEL_MODE, mode_index);
|
||||
|
||||
build_dynamic_panel();
|
||||
try_resize_scroll();
|
||||
@ -526,8 +502,7 @@ void DeviceOptions::analog_channel_check()
|
||||
sr_channel *const probe = (sr_channel*)l->data;
|
||||
|
||||
if (sc->property("index").toInt() == probe->index){
|
||||
_device_agent->set_config(probe, NULL, SR_CONF_PROBE_MAP_DEFAULT,
|
||||
g_variant_new_boolean(sc->isChecked()));
|
||||
_device_agent->set_config_bool(SR_CONF_PROBE_MAP_DEFAULT, sc->isChecked(), probe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -548,13 +523,10 @@ void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
|
||||
if (sc == NULL || !sc->isChecked())
|
||||
return;
|
||||
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar == NULL)
|
||||
bool stream_mode;
|
||||
if (_device_agent->get_config_bool(SR_CONF_STREAM, stream_mode) == false)
|
||||
return;
|
||||
|
||||
bool stream_mode = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
if (!stream_mode)
|
||||
return;
|
||||
|
||||
@ -564,12 +536,10 @@ void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
|
||||
cur_ch_num++;
|
||||
}
|
||||
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_VLD_CH_NUM);
|
||||
if (gvar == NULL)
|
||||
int vld_ch_num;
|
||||
if (_device_agent->get_config_int16(SR_CONF_VLD_CH_NUM, vld_ch_num) == false)
|
||||
return;
|
||||
|
||||
int vld_ch_num = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (cur_ch_num > vld_ch_num) {
|
||||
QString msg_str(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_MAX_CHANNEL_COUNT_WARNING), "max count of channels!"));
|
||||
msg_str = msg_str.replace("{0}", QString::number(vld_ch_num) );
|
||||
@ -598,13 +568,8 @@ void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
|
||||
|
||||
if (ck_index != -1)
|
||||
{
|
||||
GVariant* gvar = _device_agent->get_config(_dso_channel_list[ck_index],
|
||||
NULL, SR_CONF_PROBE_MAP_DEFAULT);
|
||||
|
||||
if (gvar != NULL) {
|
||||
map_default = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_bool(SR_CONF_PROBE_MAP_DEFAULT,
|
||||
map_default, _dso_channel_list[ck_index], NULL);
|
||||
}
|
||||
|
||||
while(i--)
|
||||
@ -684,11 +649,7 @@ void DeviceOptions::analog_probes(QGridLayout &layout)
|
||||
if (probe_checkBox->isChecked() && p->name().contains("Map")) {
|
||||
bool map_default = true;
|
||||
|
||||
GVariant* gvar = _device_agent->get_config(probe, NULL, SR_CONF_PROBE_MAP_DEFAULT);
|
||||
if (gvar != NULL) {
|
||||
map_default = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_bool(SR_CONF_PROBE_MAP_DEFAULT, map_default, probe, NULL);
|
||||
|
||||
if (map_default)
|
||||
pow->setEnabled(false);
|
||||
@ -735,11 +696,9 @@ QString DeviceOptions::dynamic_widget(QLayout *lay)
|
||||
return L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel");
|
||||
}
|
||||
else if (mode == DSO) {
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_HAVE_ZERO);
|
||||
if (gvar != NULL) {
|
||||
bool have_zero = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool have_zero;
|
||||
|
||||
if (_device_agent->get_config_bool(SR_CONF_HAVE_ZERO, have_zero)) {
|
||||
QGridLayout *grid = dynamic_cast<QGridLayout*>(lay);
|
||||
assert(grid);
|
||||
|
||||
|
@ -77,11 +77,9 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
|
||||
// setup _window_combobox _len_combobox
|
||||
_sample_limit = 0;
|
||||
GVariant* gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_MAX_DSO_SAMPLELIMITS);
|
||||
|
||||
if (gvar != NULL) {
|
||||
_sample_limit = g_variant_get_uint64(gvar) * 0.5;
|
||||
g_variant_unref(gvar);
|
||||
if (_session->get_device()->get_config_uint64(SR_CONF_MAX_DSO_SAMPLELIMITS, _sample_limit)) {
|
||||
_sample_limit = _sample_limit * 0.5;
|
||||
}
|
||||
else {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_MAX_DSO_SAMPLELIMITS failed.");
|
||||
|
@ -107,9 +107,9 @@ void WaitingDialog::accept()
|
||||
|
||||
QFuture<void> future;
|
||||
future = QtConcurrent::run([&]{
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO_SET,
|
||||
g_variant_new_boolean(true));
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO_SET, true);
|
||||
});
|
||||
|
||||
Qt::WindowFlags flags = Qt::CustomizeWindowHint;
|
||||
QProgressDialog dlg(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_SAVE_CALIBRATION_RESULTS), "Save calibration results... It can take a while."),
|
||||
L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CANCEL), "Cancel"),0,0,this,flags);
|
||||
@ -135,10 +135,10 @@ void WaitingDialog::reject()
|
||||
|
||||
QFuture<void> future;
|
||||
future = QtConcurrent::run([&]{
|
||||
_device_agent->set_config(NULL, NULL, _key, g_variant_new_boolean(false));
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO_LOAD,
|
||||
g_variant_new_boolean(true));
|
||||
_device_agent->set_config_bool(_key, false);
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO_LOAD, true);
|
||||
});
|
||||
|
||||
Qt::WindowFlags flags = Qt::CustomizeWindowHint;
|
||||
QProgressDialog dlg(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_LOAD_CURRENT_SETTING), "Load current setting... It can take a while."),
|
||||
L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CANCEL), "Cancel"),0,0,this,flags);
|
||||
@ -177,39 +177,28 @@ void WaitingDialog::changeText()
|
||||
{
|
||||
tips->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_WAITING), "Waiting"));
|
||||
index = 0;
|
||||
GVariant* gvar;
|
||||
bool comb_comp_en = false;
|
||||
bool zero_fgain = false;
|
||||
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_PROBE_COMB_COMP_EN);
|
||||
if (gvar != NULL) {
|
||||
comb_comp_en = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (comb_comp_en) {
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_ZERO_COMB_FGAIN);
|
||||
if (gvar != NULL) {
|
||||
zero_fgain = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (_device_agent->get_config_bool(SR_CONF_PROBE_COMB_COMP_EN, comb_comp_en) && comb_comp_en) {
|
||||
|
||||
if (_device_agent->get_config_bool(SR_CONF_ZERO_COMB_FGAIN, zero_fgain) && zero_fgain) {
|
||||
|
||||
if (zero_fgain) {
|
||||
for(auto s : _session->get_signals()){
|
||||
if (s->signal_type() == DSO_SIGNAL){
|
||||
view::DsoSignal *dsoSig = (view::DsoSignal*)s;
|
||||
dsoSig->set_enable(dsoSig->get_index() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO_COMB, g_variant_new_boolean(true));
|
||||
}
|
||||
}
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO_COMB, true);
|
||||
}
|
||||
}
|
||||
|
||||
gvar = _device_agent->get_config(NULL, NULL, _key);
|
||||
if (gvar != NULL) {
|
||||
bool zero = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (!zero) {
|
||||
bool bzero = false;
|
||||
if (_device_agent->get_config_bool(_key, bzero)) {
|
||||
if (!bzero) {
|
||||
movie->stop();
|
||||
movie->jumpToFrame(0);
|
||||
timer->stop();
|
||||
@ -218,7 +207,8 @@ void WaitingDialog::changeText()
|
||||
_button_box.addButton(QDialogButtonBox::Save);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
tips->setText(tips->text()+".");
|
||||
}
|
||||
}
|
||||
|
@ -230,9 +230,8 @@ void DsoTriggerDock::auto_trig(int index)
|
||||
void DsoTriggerDock::pos_changed(int pos)
|
||||
{
|
||||
int ret;
|
||||
ret = _session->get_device()->set_config(NULL, NULL,
|
||||
SR_CONF_HORIZ_TRIGGERPOS,
|
||||
g_variant_new_byte((uint8_t)pos));
|
||||
ret = _session->get_device()->set_config_byte(
|
||||
SR_CONF_HORIZ_TRIGGERPOS,pos);
|
||||
if (!ret) {
|
||||
if (_session->get_device()->is_hardware()){
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_CHANGE_HOR_TRI_POS_FAIL),
|
||||
@ -258,9 +257,8 @@ void DsoTriggerDock::hold_changed(int hold)
|
||||
_holdoff_slider->setRange(0, 999);
|
||||
|
||||
holdoff = _holdoff_slider->value() * _holdoff_comboBox->currentData().toDouble() / 10;
|
||||
ret = _session->get_device()->set_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_HOLDOFF,
|
||||
g_variant_new_uint64(holdoff));
|
||||
ret = _session->get_device()->set_config_uint64(
|
||||
SR_CONF_TRIGGER_HOLDOFF,holdoff);
|
||||
|
||||
if (!ret) {
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_CHANGE_TRI_HOLDOFF_TIME_FAIL),
|
||||
@ -272,9 +270,7 @@ void DsoTriggerDock::hold_changed(int hold)
|
||||
void DsoTriggerDock::margin_changed(int margin)
|
||||
{
|
||||
int ret;
|
||||
ret = _session->get_device()->set_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_MARGIN,
|
||||
g_variant_new_byte(margin));
|
||||
ret = _session->get_device()->set_config_byte(SR_CONF_TRIGGER_MARGIN, margin);
|
||||
if (!ret) {
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_CHANGE_SENSITIVITY_FAIL),
|
||||
"Change trigger value sensitivity failed!"));
|
||||
@ -299,9 +295,7 @@ void DsoTriggerDock::source_changed()
|
||||
|
||||
dsv_info("Set DSO trig type:%d", id);
|
||||
|
||||
ret = _session->get_device()->set_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_SOURCE,
|
||||
g_variant_new_byte(id));
|
||||
ret = _session->get_device()->set_config_byte(SR_CONF_TRIGGER_SOURCE, id);
|
||||
if (!ret) {
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_CHANGE_SOURCE_FAIL),
|
||||
"Change trigger source failed!"));
|
||||
@ -317,9 +311,7 @@ void DsoTriggerDock::check_setting()
|
||||
_ch0a1_radioButton->setChecked(false);
|
||||
_ch0o1_radioButton->setChecked(false);
|
||||
|
||||
_session->get_device()->set_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_SOURCE,
|
||||
g_variant_new_byte(DSO_TRIGGER_AUTO));
|
||||
_session->get_device()->set_config_byte(SR_CONF_TRIGGER_SOURCE, int(DSO_TRIGGER_AUTO));
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,9 +342,9 @@ void DsoTriggerDock::channel_changed(int ch)
|
||||
(void)ch;
|
||||
int ret;
|
||||
|
||||
ret = _session->get_device()->set_config(NULL, NULL,
|
||||
ret = _session->get_device()->set_config_byte(
|
||||
SR_CONF_TRIGGER_CHANNEL,
|
||||
g_variant_new_byte(_channel_comboBox->currentData().toInt()));
|
||||
int(_channel_comboBox->currentData().toInt()));
|
||||
if (!ret) {
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_CHANGE_CHANNEL_FAIL),
|
||||
"Change trigger channel failed!"));
|
||||
@ -365,9 +357,9 @@ void DsoTriggerDock::type_changed()
|
||||
int id = _type_group->checkedId();
|
||||
int ret;
|
||||
|
||||
ret = _session->get_device()->set_config(NULL, NULL,
|
||||
ret = _session->get_device()->set_config_byte(
|
||||
SR_CONF_TRIGGER_SLOPE,
|
||||
g_variant_new_byte(id));
|
||||
id);
|
||||
if (!ret) {
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_CHANGE_TYPE_FAIL),
|
||||
"Change trigger type failed!"));
|
||||
@ -385,6 +377,7 @@ void DsoTriggerDock::device_change()
|
||||
void DsoTriggerDock::update_view()
|
||||
{
|
||||
bool bDisable = _session->get_device()->is_file();
|
||||
bool ret;
|
||||
|
||||
for(QAbstractButton * btn : _source_group->buttons()){
|
||||
btn->setDisabled(bDisable);
|
||||
@ -407,20 +400,17 @@ void DsoTriggerDock::update_view()
|
||||
return;
|
||||
}
|
||||
|
||||
int pos;
|
||||
int src;
|
||||
int slope;
|
||||
|
||||
// TRIGGERPOS
|
||||
GVariant* gvar = _session->get_device()->get_config(NULL, NULL,
|
||||
SR_CONF_HORIZ_TRIGGERPOS);
|
||||
if (gvar != NULL) {
|
||||
uint16_t pos = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (_session->get_device()->get_config_byte(
|
||||
SR_CONF_HORIZ_TRIGGERPOS, pos)) {
|
||||
_position_slider->setValue(pos);
|
||||
}
|
||||
|
||||
gvar = _session->get_device()->get_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_SOURCE);
|
||||
if (gvar != NULL) {
|
||||
uint8_t src = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (_session->get_device()->get_config_byte(SR_CONF_TRIGGER_SOURCE, src)) {
|
||||
_source_group->button(src)->setChecked(true);
|
||||
}
|
||||
|
||||
@ -434,11 +424,9 @@ void DsoTriggerDock::update_view()
|
||||
_channel_comboBox->addItem(dsoSig->get_name(), QVariant::fromValue(dsoSig->get_index()));
|
||||
}
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_CHANNEL);
|
||||
if (gvar != NULL) {
|
||||
uint8_t src = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
ret = _session->get_device()->get_config_byte(
|
||||
SR_CONF_TRIGGER_CHANNEL, src);
|
||||
if (ret) {
|
||||
for (int i = 0; i < _channel_comboBox->count(); i++) {
|
||||
if (src == _channel_comboBox->itemData(i).toInt()) {
|
||||
_channel_comboBox->setCurrentIndex(i);
|
||||
@ -448,22 +436,19 @@ void DsoTriggerDock::update_view()
|
||||
}
|
||||
connect(_channel_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(channel_changed(int)));
|
||||
|
||||
gvar = _session->get_device()->get_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_SLOPE);
|
||||
if (gvar != NULL) {
|
||||
uint8_t slope = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
ret = _session->get_device()->get_config_byte(
|
||||
SR_CONF_TRIGGER_SLOPE, slope);
|
||||
if (ret) {
|
||||
_type_group->button(slope)->setChecked(true);
|
||||
}
|
||||
|
||||
disconnect(_holdoff_slider, SIGNAL(valueChanged(int)), this, SLOT(hold_changed(int)));
|
||||
disconnect(_holdoff_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hold_changed(int)));
|
||||
gvar = _session->get_device()->get_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_HOLDOFF);
|
||||
if (gvar != NULL) {
|
||||
uint64_t holdoff = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
uint64_t holdoff;
|
||||
ret = _session->get_device()->get_config_uint64(
|
||||
SR_CONF_TRIGGER_HOLDOFF, holdoff);
|
||||
if (ret) {
|
||||
auto v = holdoff * 10.0;
|
||||
|
||||
for (int i=0; i<_holdoff_comboBox->count(); i++)
|
||||
@ -487,11 +472,11 @@ void DsoTriggerDock::update_view()
|
||||
connect(_holdoff_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hold_changed(int)));
|
||||
|
||||
disconnect(_margin_slider, SIGNAL(valueChanged(int)), this, SLOT(margin_changed(int)));
|
||||
gvar = _session->get_device()->get_config(NULL, NULL,
|
||||
SR_CONF_TRIGGER_MARGIN);
|
||||
if (gvar != NULL) {
|
||||
uint8_t margin = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
int margin;
|
||||
ret = _session->get_device()->get_config_byte(
|
||||
SR_CONF_TRIGGER_MARGIN, margin);
|
||||
if (ret) {
|
||||
_margin_slider->setValue(margin);
|
||||
}
|
||||
connect(_margin_slider, SIGNAL(valueChanged(int)), this, SLOT(margin_changed(int)));
|
||||
|
@ -54,11 +54,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession *session) :
|
||||
|
||||
_cur_ch_num = 16;
|
||||
if (_session->get_device()->have_instance()) {
|
||||
GVariant *gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_TOTAL_CH_NUM);
|
||||
if (gvar != NULL) {
|
||||
_cur_ch_num = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_session->get_device()->get_config_int16(SR_CONF_TOTAL_CH_NUM, _cur_ch_num);
|
||||
}
|
||||
|
||||
_widget = new QWidget(this);
|
||||
@ -193,11 +189,7 @@ void TriggerDock::adv_trigger()
|
||||
{
|
||||
if (_session->get_device()->is_hardware_logic()) {
|
||||
bool stream = false;
|
||||
GVariant *gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
stream = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_session->get_device()->get_config_bool(SR_CONF_STREAM, stream);
|
||||
|
||||
if (stream) {
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STREAM_NO_AD_TRIGGER),
|
||||
@ -256,21 +248,15 @@ void TriggerDock::device_updated()
|
||||
bool stream = false;
|
||||
uint8_t maxRange;
|
||||
uint64_t sample_limits;
|
||||
GVariant *gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_HW_DEPTH);
|
||||
int mode = _session->get_device()->get_work_mode();
|
||||
bool ret;
|
||||
int ch_num;
|
||||
|
||||
if (gvar != NULL) {
|
||||
hw_depth = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
ret = _session->get_device()->get_config_uint64(SR_CONF_HW_DEPTH, hw_depth);
|
||||
|
||||
if (ret) {
|
||||
if (mode == LOGIC) {
|
||||
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL) {
|
||||
stream = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
_session->get_device()->get_config_bool(SR_CONF_STREAM, stream);
|
||||
sample_limits = _session->get_device()->get_sample_limit();
|
||||
|
||||
_adv_radioButton->setEnabled(!stream);
|
||||
@ -294,11 +280,8 @@ void TriggerDock::device_updated()
|
||||
}
|
||||
}
|
||||
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_TOTAL_CH_NUM);
|
||||
if (gvar != NULL) {
|
||||
int ch_num = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
ret = _session->get_device()->get_config_int16(SR_CONF_TOTAL_CH_NUM, ch_num);
|
||||
if (ret) {
|
||||
if (ch_num != _cur_ch_num) {
|
||||
_cur_ch_num = ch_num;
|
||||
setup_adv_tab();
|
||||
|
@ -668,7 +668,7 @@ namespace pv
|
||||
for (unsigned int i = 0; i < num_opts; i++)
|
||||
{
|
||||
const struct sr_config_info *const info = _device_agent->get_config_info(options[i]);
|
||||
gvar = _device_agent->get_config(NULL, NULL, info->key);
|
||||
gvar = _device_agent->get_config(info->key);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
if (info->datatype == SR_T_BOOL)
|
||||
@ -870,7 +870,7 @@ namespace pv
|
||||
continue;
|
||||
}
|
||||
|
||||
bool bFlag = _device_agent->set_config(NULL, NULL, info->key, gvar);
|
||||
bool bFlag = _device_agent->set_config(info->key, gvar);
|
||||
if (!bFlag){
|
||||
dsv_err("Set device config option failed, id:%d, code:%d", info->key, id);
|
||||
}
|
||||
@ -1450,19 +1450,12 @@ namespace pv
|
||||
if (_device_agent->is_hardware())
|
||||
{
|
||||
int usb_speed = LIBUSB_SPEED_HIGH;
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_USB_SPEED);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
usb_speed = g_variant_get_int32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_int32(SR_CONF_USB_SPEED, usb_speed);
|
||||
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_USB30_SUPPORT);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
bool usb30_support = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool usb30_support = false;
|
||||
|
||||
if (_device_agent->get_config_bool(SR_CONF_USB30_SUPPORT, usb30_support))
|
||||
{
|
||||
dsv_info("The device's USB module version: %d.0", usb30_support ? 3 : 2);
|
||||
|
||||
int cable_ver = 1;
|
||||
@ -1543,11 +1536,9 @@ namespace pv
|
||||
{
|
||||
if (device_agent->get_work_mode() == LOGIC)
|
||||
{
|
||||
GVariant *gvar = device_agent->get_config(NULL, NULL, SR_CONF_FILE_VERSION);
|
||||
if (gvar != NULL)
|
||||
int version = -1;
|
||||
if (device_agent->get_config_int16(SR_CONF_FILE_VERSION, version))
|
||||
{
|
||||
int16_t version = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (version == 1)
|
||||
{
|
||||
QString strMsg(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHECK_SESSION_FILE_VERSION_ERROR),
|
||||
@ -1763,14 +1754,9 @@ namespace pv
|
||||
{
|
||||
if(_device_agent->get_work_mode() == LOGIC)
|
||||
{
|
||||
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
|
||||
if(gvar != NULL)
|
||||
{
|
||||
_pattern_mode = g_variant_get_string(gvar,NULL);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
_pattern_mode = _device_agent->get_demo_operation_mode();
|
||||
_protocol_widget->del_all_protocol();
|
||||
|
||||
if(_device_agent->get_work_mode() == LOGIC)
|
||||
{
|
||||
_view->auto_set_max_scale();
|
||||
@ -1819,12 +1805,7 @@ namespace pv
|
||||
|
||||
if(_device_agent->is_demo())
|
||||
{
|
||||
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
|
||||
if(gvar != NULL)
|
||||
{
|
||||
_pattern_mode = g_variant_get_string(gvar,NULL);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_pattern_mode = _device_agent->get_demo_operation_mode();
|
||||
_protocol_widget->del_all_protocol();
|
||||
|
||||
if(_device_agent->get_work_mode() == LOGIC)
|
||||
@ -1935,24 +1916,18 @@ namespace pv
|
||||
|
||||
case DSV_MSG_BEGIN_DEVICE_OPTIONS:
|
||||
if(_device_agent->is_demo()){
|
||||
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
|
||||
if(gvar != NULL)
|
||||
{
|
||||
_pattern_mode = g_variant_get_string(gvar,NULL);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_pattern_mode = _device_agent->get_demo_operation_mode();
|
||||
}
|
||||
break;
|
||||
|
||||
case DSV_MSG_END_DEVICE_OPTIONS:
|
||||
if(_device_agent->is_demo() &&_device_agent->get_work_mode() == LOGIC){
|
||||
QString pattern_mode;
|
||||
if(_device_agent->get_config_value_string(SR_CONF_PATTERN_MODE, pattern_mode))
|
||||
{
|
||||
QString pattern_mode = _device_agent->get_demo_operation_mode();
|
||||
|
||||
if(pattern_mode != _pattern_mode)
|
||||
{
|
||||
_pattern_mode = pattern_mode;
|
||||
_device_agent->set_config(NULL,NULL,SR_CONF_DEMO_INIT,g_variant_new_boolean(TRUE));
|
||||
_device_agent->set_config_bool(SR_CONF_DEMO_INIT, true);
|
||||
_device_agent->update();
|
||||
|
||||
_session->init_signals();
|
||||
@ -1971,7 +1946,6 @@ namespace pv
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
calc_min_height();
|
||||
break;
|
||||
|
||||
@ -1979,9 +1953,8 @@ namespace pv
|
||||
if(_device_agent->is_demo() &&_device_agent->get_work_mode() == LOGIC){
|
||||
_protocol_widget->del_all_protocol();
|
||||
_session->clear_view_data();
|
||||
QString pattern_mode;
|
||||
QString pattern_mode = _device_agent->get_demo_operation_mode();
|
||||
|
||||
if(_device_agent->get_config_value_string(SR_CONF_PATTERN_MODE, pattern_mode)){
|
||||
if(pattern_mode != "random"){
|
||||
_device_agent->update();
|
||||
_session->set_operation_mode(OPT_SINGLE);
|
||||
@ -1990,7 +1963,6 @@ namespace pv
|
||||
ss.load_decoders(_protocol_widget, deArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -145,14 +145,14 @@ GVariant* DeviceOptions::config_getter(int key)
|
||||
{
|
||||
SigSession *session = AppControl::Instance()->GetSession();
|
||||
DeviceAgent *_device_agent = session->get_device();
|
||||
return _device_agent->get_config(NULL, NULL, key);
|
||||
return _device_agent->get_config(key);
|
||||
}
|
||||
|
||||
void DeviceOptions::config_setter(int key, GVariant* value)
|
||||
{
|
||||
SigSession *session = AppControl::Instance()->GetSession();
|
||||
DeviceAgent *_device_agent = session->get_device();
|
||||
_device_agent->set_config(NULL, NULL, key, value);
|
||||
_device_agent->set_config(key, value);
|
||||
}
|
||||
|
||||
void DeviceOptions::bind_bool(const QString &name, const QString label, int key)
|
||||
@ -316,13 +316,9 @@ void DeviceOptions::bind_bandwidths(const QString &name, const QString label, in
|
||||
plist = (struct sr_list_item*)g_variant_get_uint64(gvar_list);
|
||||
assert(plist);
|
||||
|
||||
bw_limit = FALSE;
|
||||
gvar_tmp = _device_agent->get_config(NULL, NULL, SR_CONF_BANDWIDTH);
|
||||
bw_limit = false;
|
||||
_device_agent->get_config_bool(SR_CONF_BANDWIDTH, bw_limit);
|
||||
|
||||
if (gvar_tmp != NULL) {
|
||||
bw_limit = g_variant_get_boolean(gvar_tmp);
|
||||
g_variant_unref(gvar_tmp);
|
||||
}
|
||||
if (!bw_limit)
|
||||
return;
|
||||
|
||||
|
@ -109,14 +109,14 @@ GVariant* ProbeOptions::config_getter(const struct sr_channel *probe, int key)
|
||||
{
|
||||
SigSession *session = AppControl::Instance()->GetSession();
|
||||
DeviceAgent *_device_agent = session->get_device();
|
||||
return _device_agent->get_config(probe, NULL, key);
|
||||
return _device_agent->get_config(key, probe, NULL);
|
||||
}
|
||||
|
||||
void ProbeOptions::config_setter(struct sr_channel *probe, int key, GVariant* value)
|
||||
{
|
||||
SigSession *session = AppControl::Instance()->GetSession();
|
||||
DeviceAgent *_device_agent = session->get_device();
|
||||
_device_agent->set_config(probe, NULL, key, value);
|
||||
_device_agent->set_config(key, value, probe, NULL);
|
||||
}
|
||||
|
||||
void ProbeOptions::bind_bool(const QString &name, const QString label, int key)
|
||||
|
@ -402,7 +402,7 @@ namespace pv
|
||||
void SigSession::capture_init()
|
||||
{
|
||||
// update instant setting
|
||||
_device_agent.set_config(NULL, NULL, SR_CONF_INSTANT, g_variant_new_boolean(_is_instant));
|
||||
_device_agent.set_config_bool(SR_CONF_INSTANT, _is_instant);
|
||||
_callback->update_capture();
|
||||
|
||||
set_cur_snap_samplerate(_device_agent.get_sample_rate());
|
||||
@ -521,21 +521,15 @@ namespace pv
|
||||
|
||||
if (is_loop_mode() && _device_agent.is_demo())
|
||||
{
|
||||
GVariant *gvar = _device_agent.get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
|
||||
if(gvar != NULL)
|
||||
{
|
||||
QString rand_mode = g_variant_get_string(gvar,NULL);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
if (rand_mode != "random"){
|
||||
QString opt_mode = _device_agent.get_demo_operation_mode();
|
||||
if (opt_mode != "random"){
|
||||
set_operation_mode(OPT_SINGLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_device_agent.is_hardware() || _device_agent.is_demo()){
|
||||
GVariant *val = g_variant_new_boolean(is_loop_mode() && _is_stream_mode);
|
||||
_device_agent.set_config(NULL, NULL, SR_CONF_LOOP_MODE, val);
|
||||
bool bv = is_loop_mode() && _is_stream_mode;
|
||||
_device_agent.set_config_bool(SR_CONF_LOOP_MODE, bv);
|
||||
}
|
||||
}
|
||||
|
||||
@ -693,12 +687,7 @@ namespace pv
|
||||
bool wait_upload = false;
|
||||
if (is_single_mode() && _device_agent.get_work_mode() == LOGIC)
|
||||
{
|
||||
GVariant *gvar = _device_agent.get_config(NULL, NULL, SR_CONF_WAIT_UPLOAD);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
wait_upload = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent.get_config_bool(SR_CONF_WAIT_UPLOAD, wait_upload);
|
||||
}
|
||||
|
||||
if (!wait_upload)
|
||||
@ -1632,10 +1621,9 @@ namespace pv
|
||||
|
||||
void SigSession::nodata_timeout()
|
||||
{
|
||||
GVariant *gvar = _device_agent.get_config(NULL, NULL, SR_CONF_TRIGGER_SOURCE);
|
||||
if (gvar == NULL)
|
||||
return;
|
||||
if (g_variant_get_byte(gvar) != DSO_TRIGGER_AUTO)
|
||||
int flag;
|
||||
_device_agent.get_config_byte(SR_CONF_TRIGGER_SOURCE, flag);
|
||||
if (flag != DSO_TRIGGER_AUTO)
|
||||
{
|
||||
_callback->show_wait_trigger();
|
||||
}
|
||||
@ -2149,8 +2137,7 @@ namespace pv
|
||||
|
||||
if (cur_mode != mode)
|
||||
{
|
||||
GVariant *val = g_variant_new_int16(mode);
|
||||
_device_agent.set_config(NULL, NULL, SR_CONF_DEVICE_MODE, val);
|
||||
_device_agent.set_config_int16(SR_CONF_DEVICE_MODE, mode);
|
||||
|
||||
if (cur_mode == LOGIC){
|
||||
clear_all_decode_task2();
|
||||
|
@ -454,7 +454,6 @@ void StoreSession::save_proc(data::Snapshot *snapshot)
|
||||
bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
{
|
||||
GSList *l;
|
||||
GVariant *gvar;
|
||||
struct sr_channel *probe;
|
||||
int probecnt;
|
||||
char *s;
|
||||
@ -497,42 +496,33 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
|
||||
sprintf(meta, "samplerate = %s\n", s); str += meta;
|
||||
|
||||
uint64_t tmp_u64;
|
||||
int tmp_u8;
|
||||
uint32_t tmp_u32;
|
||||
|
||||
if (mode == DSO) {
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_TIMEBASE);
|
||||
if (gvar != NULL) {
|
||||
uint64_t tmp_u64 = g_variant_get_uint64(gvar);
|
||||
if (_session->get_device()->get_config_uint64(SR_CONF_TIMEBASE, tmp_u64)) {
|
||||
sprintf(meta, "hDiv = %" PRIu64 "\n", tmp_u64); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_MAX_TIMEBASE);
|
||||
if (gvar != NULL) {
|
||||
uint64_t tmp_u64 = g_variant_get_uint64(gvar);
|
||||
|
||||
if (_session->get_device()->get_config_uint64(SR_CONF_MAX_TIMEBASE, tmp_u64)) {
|
||||
sprintf(meta, "hDiv max = %" PRIu64 "\n", tmp_u64); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_MIN_TIMEBASE);
|
||||
if (gvar != NULL) {
|
||||
uint64_t tmp_u64 = g_variant_get_uint64(gvar);
|
||||
|
||||
if (_session->get_device()->get_config_uint64(SR_CONF_MIN_TIMEBASE, tmp_u64)) {
|
||||
sprintf(meta, "hDiv min = %" PRIu64 "\n", tmp_u64); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_UNIT_BITS);
|
||||
if (gvar != NULL) {
|
||||
uint8_t tmp_u8 = g_variant_get_byte(gvar);
|
||||
|
||||
if (_session->get_device()->get_config_byte(SR_CONF_UNIT_BITS, tmp_u8)) {
|
||||
sprintf(meta, "bits = %d\n", tmp_u8); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MIN);
|
||||
if (gvar != NULL) {
|
||||
uint32_t tmp_u32 = g_variant_get_uint32(gvar);
|
||||
|
||||
if (_session->get_device()->get_config_uint32(SR_CONF_REF_MIN, tmp_u32)) {
|
||||
sprintf(meta, "ref min = %d\n", tmp_u32); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MAX);
|
||||
if (gvar != NULL) {
|
||||
uint32_t tmp_u32 = g_variant_get_uint32(gvar);
|
||||
|
||||
if (_session->get_device()->get_config_uint32(SR_CONF_REF_MAX, tmp_u32)) {
|
||||
sprintf(meta, "ref max = %d\n", tmp_u32); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
}
|
||||
else if (mode == LOGIC) {
|
||||
@ -544,17 +534,13 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
uint8_t tmp_u8 = analog_snapshot->get_unit_bytes();
|
||||
sprintf(meta, "bits = %d\n", tmp_u8*8); str += meta;
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MIN);
|
||||
if (gvar != NULL) {
|
||||
uint32_t tmp_u32 = g_variant_get_uint32(gvar);
|
||||
|
||||
if (_session->get_device()->get_config_uint32(SR_CONF_REF_MIN, tmp_u32)) {
|
||||
sprintf(meta, "ref min = %d\n", tmp_u32); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MAX);
|
||||
if (gvar != NULL) {
|
||||
uint32_t tmp_u32 = g_variant_get_uint32(gvar);
|
||||
|
||||
if (_session->get_device()->get_config_uint32(SR_CONF_REF_MAX, tmp_u32)) {
|
||||
sprintf(meta, "ref max = %d\n", tmp_u32); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
}
|
||||
sprintf(meta, "trigger pos = %" PRIu64 "\n", _session->get_trigger_pos()); str += meta;
|
||||
@ -807,14 +793,11 @@ void StoreSession::export_proc(data::Snapshot *snapshot)
|
||||
meta.config = g_slist_append(meta.config, src);
|
||||
|
||||
GVariant *gvar;
|
||||
uint8_t bits=0;
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_UNIT_BITS);
|
||||
if (gvar != NULL) {
|
||||
bits = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MIN);
|
||||
int bits=0;
|
||||
|
||||
_session->get_device()->get_config_byte(SR_CONF_UNIT_BITS, bits);
|
||||
|
||||
gvar = _session->get_device()->get_config(SR_CONF_REF_MIN);
|
||||
if (gvar != NULL) {
|
||||
src = _session->get_device()->new_config(SR_CONF_REF_MIN, gvar);
|
||||
g_variant_unref(gvar);
|
||||
@ -824,8 +807,8 @@ void StoreSession::export_proc(data::Snapshot *snapshot)
|
||||
}
|
||||
|
||||
meta.config = g_slist_append(meta.config, src);
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MAX);
|
||||
|
||||
gvar = _session->get_device()->get_config(SR_CONF_REF_MAX);
|
||||
if (gvar != NULL) {
|
||||
src = _session->get_device()->new_config(SR_CONF_REF_MAX, gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
@ -165,13 +165,8 @@ namespace pv
|
||||
else
|
||||
{
|
||||
int usb_speed = LIBUSB_SPEED_HIGH;
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_USB_SPEED);
|
||||
_device_agent->get_config_int32(SR_CONF_USB_SPEED, usb_speed);
|
||||
|
||||
if (gvar != NULL)
|
||||
{
|
||||
usb_speed = g_variant_get_int32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
if (usb_speed == LIBUSB_SPEED_HIGH)
|
||||
_device_type.setText("USB 2.0");
|
||||
else if (usb_speed == LIBUSB_SPEED_SUPER)
|
||||
@ -231,13 +226,8 @@ namespace pv
|
||||
else
|
||||
{
|
||||
int usb_speed = LIBUSB_SPEED_HIGH;
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_USB_SPEED);
|
||||
_device_agent->get_config_int32(SR_CONF_USB_SPEED, usb_speed);
|
||||
|
||||
if (gvar != NULL)
|
||||
{
|
||||
usb_speed = g_variant_get_int32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
if (usb_speed == LIBUSB_SPEED_SUPER)
|
||||
_device_type.setIcon(QIcon(":/icons/usb3.svg"));
|
||||
else
|
||||
@ -289,27 +279,25 @@ namespace pv
|
||||
update_sample_rate_list();
|
||||
|
||||
int mode = _device_agent->get_work_mode();
|
||||
GVariant *gvar;
|
||||
bool zero = false;
|
||||
bool test;
|
||||
bool ret;
|
||||
|
||||
if (mode == DSO)
|
||||
{
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_ZERO);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
bool zero = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
_device_agent->get_config_bool(SR_CONF_ZERO, zero);
|
||||
|
||||
if (zero)
|
||||
{
|
||||
zero_adj();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_TEST);
|
||||
if (gvar != NULL)
|
||||
|
||||
ret = _device_agent->get_config_bool(SR_CONF_TEST, test);
|
||||
if (ret)
|
||||
{
|
||||
bool test = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (test)
|
||||
{
|
||||
update_sample_rate_selector_value();
|
||||
@ -513,20 +501,8 @@ namespace pv
|
||||
assert(!_updating_sample_count);
|
||||
_updating_sample_count = true;
|
||||
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_STREAM);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
stream_mode = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_HW_DEPTH);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
hw_depth = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
_device_agent->get_config_bool(SR_CONF_STREAM, stream_mode);
|
||||
_device_agent->get_config_uint64(SR_CONF_HW_DEPTH, hw_depth);
|
||||
int mode = _device_agent->get_work_mode();
|
||||
|
||||
if (mode == LOGIC)
|
||||
@ -548,29 +524,14 @@ namespace pv
|
||||
|
||||
if (mode == LOGIC)
|
||||
{
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_RLE_SUPPORT);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
rle_support = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_bool(SR_CONF_RLE_SUPPORT, rle_support);
|
||||
if (rle_support)
|
||||
rle_depth = min(hw_depth * SR_KB(1), sw_depth);
|
||||
}
|
||||
else if (mode == DSO)
|
||||
{
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_MAX_TIMEBASE);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
max_timebase = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_MIN_TIMEBASE);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
min_timebase = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_uint64(SR_CONF_MAX_TIMEBASE, max_timebase);
|
||||
_device_agent->get_config_uint64(SR_CONF_MIN_TIMEBASE, min_timebase);
|
||||
}
|
||||
|
||||
if (0 != _sample_count.count())
|
||||
@ -673,14 +634,13 @@ namespace pv
|
||||
|
||||
GVariant *gvar;
|
||||
double duration;
|
||||
uint64_t v;
|
||||
|
||||
if (_device_agent->get_work_mode() == DSO)
|
||||
{
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_TIMEBASE);
|
||||
if (gvar != NULL)
|
||||
if (_device_agent->get_config_uint64(SR_CONF_TIMEBASE, v))
|
||||
{
|
||||
duration = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
duration = (double)v;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -690,11 +650,9 @@ namespace pv
|
||||
}
|
||||
else
|
||||
{
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_LIMIT_SAMPLES);
|
||||
if (gvar != NULL)
|
||||
if (_device_agent->get_config_uint64(SR_CONF_LIMIT_SAMPLES, v))
|
||||
{
|
||||
duration = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
duration = (double)v;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -774,14 +732,8 @@ namespace pv
|
||||
const uint64_t sample_limit = _device_agent->get_sample_limit();
|
||||
GVariant *gvar;
|
||||
uint64_t max_sample_rate;
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_MAX_DSO_SAMPLERATE);
|
||||
|
||||
if (gvar != NULL)
|
||||
{
|
||||
max_sample_rate = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else
|
||||
if (_device_agent->get_config_uint64(SR_CONF_MAX_DSO_SAMPLERATE, max_sample_rate) == false)
|
||||
{
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_MAX_DSO_SAMPLERATE failed.");
|
||||
return -1;
|
||||
@ -793,8 +745,7 @@ namespace pv
|
||||
(_session->get_ch_num(SR_CHANNEL_DSO) ? _session->get_ch_num(SR_CHANNEL_DSO) : 1)));
|
||||
set_sample_rate(sample_rate);
|
||||
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_TIMEBASE,
|
||||
g_variant_new_uint64(hori_res));
|
||||
_device_agent->set_config_uint64( SR_CONF_TIMEBASE, hori_res);
|
||||
|
||||
return hori_res;
|
||||
}
|
||||
@ -802,15 +753,9 @@ namespace pv
|
||||
void SamplingBar::commit_settings()
|
||||
{
|
||||
bool test = false;
|
||||
|
||||
if (_device_agent->have_instance())
|
||||
{
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_TEST);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
test = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_bool(SR_CONF_TEST, test);
|
||||
}
|
||||
|
||||
if (test)
|
||||
@ -830,9 +775,9 @@ namespace pv
|
||||
if (_device_agent->have_instance())
|
||||
{
|
||||
if (sample_rate != _device_agent->get_sample_rate())
|
||||
_device_agent->set_config(NULL, NULL,
|
||||
_device_agent->set_config_uint64(
|
||||
SR_CONF_SAMPLERATE,
|
||||
g_variant_new_uint64(sample_rate));
|
||||
sample_rate);
|
||||
|
||||
if (_device_agent->get_work_mode() != DSO)
|
||||
{
|
||||
@ -841,14 +786,14 @@ namespace pv
|
||||
SAMPLES_ALIGN) &
|
||||
~SAMPLES_ALIGN;
|
||||
if (sample_count != _device_agent->get_sample_limit())
|
||||
_device_agent->set_config(NULL, NULL,
|
||||
_device_agent->set_config_uint64(
|
||||
SR_CONF_LIMIT_SAMPLES,
|
||||
g_variant_new_uint64(sample_count));
|
||||
sample_count);
|
||||
|
||||
bool rle_mode = _sample_count.currentText().contains(RLEString);
|
||||
_device_agent->set_config(NULL, NULL,
|
||||
_device_agent->set_config_bool(
|
||||
SR_CONF_RLE,
|
||||
g_variant_new_boolean(rle_mode));
|
||||
rle_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -881,13 +826,10 @@ namespace pv
|
||||
|
||||
if (_device_agent->get_work_mode() == DSO)
|
||||
{
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_ZERO);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
bool zero = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool zero;
|
||||
|
||||
if (zero)
|
||||
bool ret = _device_agent->get_config_bool(SR_CONF_ZERO, zero);
|
||||
if (ret && zero)
|
||||
{
|
||||
QString str1(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_AUTO_CALIB), "Auto Calibration"));
|
||||
QString str2(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_ADJUST_SAVE), "Please adjust zero skew and save the result"));
|
||||
@ -899,13 +841,12 @@ namespace pv
|
||||
}
|
||||
else
|
||||
{
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO, g_variant_new_boolean(false));
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO, false);
|
||||
update_view_status();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_device_agent->get_work_mode() == LOGIC && _view != NULL){
|
||||
if (_session->is_realtime_refresh())
|
||||
@ -947,14 +888,10 @@ namespace pv
|
||||
|
||||
if (_device_agent->get_work_mode() == DSO)
|
||||
{
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_ZERO);
|
||||
bool zero;
|
||||
|
||||
if (gvar != NULL)
|
||||
{
|
||||
bool zero = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
|
||||
if (zero)
|
||||
bool ret = _device_agent->get_config_bool(SR_CONF_ZERO, zero);
|
||||
if (ret && zero)
|
||||
{
|
||||
QString strMsg(L_S(STR_PAGE_MSG,S_ID(IDS_MSG_AUTO_CALIB_START), "Auto Calibration program will be started. Don't connect any probes. \nIt can take a while!"));
|
||||
|
||||
@ -964,13 +901,12 @@ namespace pv
|
||||
}
|
||||
else
|
||||
{
|
||||
_device_agent->set_config(NULL, NULL, SR_CONF_ZERO, g_variant_new_boolean(false));
|
||||
_device_agent->set_config_bool(SR_CONF_ZERO, false);
|
||||
update_view_status();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_device_agent->get_work_mode() == LOGIC && _session->is_realtime_refresh()){
|
||||
if (_view != NULL)
|
||||
@ -1022,12 +958,7 @@ namespace pv
|
||||
|
||||
if (_device_agent->have_instance())
|
||||
{
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_TEST);
|
||||
if (gvar != NULL)
|
||||
{
|
||||
test = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
_device_agent->get_config_bool(SR_CONF_TEST, test);
|
||||
}
|
||||
if (!test)
|
||||
{
|
||||
@ -1230,7 +1161,7 @@ namespace pv
|
||||
if (mode == LOGIC && _session->get_device()->is_hardware())
|
||||
{
|
||||
int mode_val = 0;
|
||||
if (_session->get_device()->get_config_value_int16(SR_CONF_OPERATION_MODE, mode_val)){
|
||||
if (_session->get_device()->get_config_int16(SR_CONF_OPERATION_MODE, mode_val)){
|
||||
if (mode_val == LO_OP_INTEST){
|
||||
_sample_rate.setEnabled(false);
|
||||
_sample_count.setEnabled(false);
|
||||
@ -1270,21 +1201,14 @@ namespace pv
|
||||
|
||||
if (_session->get_device()->is_demo() && bEnable)
|
||||
{
|
||||
GVariant *gvar = _device_agent->get_config(NULL,NULL,SR_CONF_PATTERN_MODE);
|
||||
if(gvar != NULL)
|
||||
{
|
||||
QString rand_mode = g_variant_get_string(gvar,NULL);
|
||||
g_variant_unref(gvar);
|
||||
QString opt_mode = _device_agent->get_demo_operation_mode();
|
||||
|
||||
bool is_rand = rand_mode == "random";
|
||||
|
||||
if (!is_rand && mode == LOGIC){
|
||||
if (opt_mode != "random" && mode == LOGIC){
|
||||
_sample_rate.setEnabled(false);
|
||||
_sample_count.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ds_device_handle SamplingBar::get_next_device_handle()
|
||||
{
|
||||
|
@ -56,41 +56,30 @@ AnalogSignal::AnalogSignal(data::AnalogSnapshot *data, sr_channel *probe) :
|
||||
_colour = SignalColours[probe->index % countof(SignalColours)];
|
||||
|
||||
_signal_type = ANALOG_SIGNAL;
|
||||
uint32_t ui32;
|
||||
|
||||
GVariant *gvar;
|
||||
// channel bits
|
||||
gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_UNIT_BITS);
|
||||
if (gvar != NULL) {
|
||||
_bits = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
bool ret = session->get_device()->get_config_byte(SR_CONF_UNIT_BITS, _bits);
|
||||
if (!ret) {
|
||||
_bits = DefaultBits;
|
||||
dsv_warn("%s%d", "Warning: config_get SR_CONF_UNIT_BITS failed, set to %d(default).", DefaultBits);
|
||||
}
|
||||
|
||||
gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MIN);
|
||||
if (gvar != NULL) {
|
||||
_ref_min = g_variant_get_uint32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
} else {
|
||||
ret = session->get_device()->get_config_uint32(SR_CONF_REF_MIN, ui32);
|
||||
if (ret)
|
||||
_ref_min = (double)ui32;
|
||||
else
|
||||
_ref_min = 1;
|
||||
}
|
||||
gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MAX);
|
||||
if (gvar != NULL) {
|
||||
_ref_max = g_variant_get_uint32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
} else {
|
||||
|
||||
ret = session->get_device()->get_config_uint32(SR_CONF_REF_MAX, ui32);
|
||||
if (ret)
|
||||
_ref_max = (double)ui32;
|
||||
else
|
||||
_ref_max = ((1 << _bits) - 1);
|
||||
}
|
||||
|
||||
// -- vpos
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_OFFSET);
|
||||
if (gvar != NULL) {
|
||||
_zero_offset = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
ret = session->get_device()->get_config_uint16( SR_CONF_PROBE_OFFSET, _zero_offset, _probe, NULL);
|
||||
if (!ret) {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_OFFSET failed.");
|
||||
}
|
||||
}
|
||||
@ -126,11 +115,7 @@ AnalogSignal::~AnalogSignal()
|
||||
int AnalogSignal::get_hw_offset()
|
||||
{
|
||||
int hw_offset = 0;
|
||||
GVariant *gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_HW_OFFSET);
|
||||
if (gvar != NULL) {
|
||||
hw_offset = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_uint16(SR_CONF_PROBE_HW_OFFSET, hw_offset, _probe, NULL);
|
||||
return hw_offset;
|
||||
}
|
||||
|
||||
@ -139,24 +124,24 @@ int AnalogSignal::commit_settings()
|
||||
int ret;
|
||||
|
||||
// -- enable
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_EN,
|
||||
g_variant_new_boolean(enabled()));
|
||||
ret = session->get_device()->set_config_bool(SR_CONF_PROBE_EN,
|
||||
enabled(), _probe);
|
||||
|
||||
// -- vdiv
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_VDIV,
|
||||
g_variant_new_uint64(_probe->vdiv));
|
||||
ret = session->get_device()->set_config_uint64(SR_CONF_PROBE_VDIV,
|
||||
_probe->vdiv, _probe, NULL);
|
||||
|
||||
// -- coupling
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_COUPLING,
|
||||
g_variant_new_byte(_probe->coupling));
|
||||
ret = session->get_device()->set_config_byte(SR_CONF_PROBE_COUPLING,
|
||||
_probe->coupling, _probe, NULL);
|
||||
|
||||
// -- offset
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_OFFSET,
|
||||
g_variant_new_uint16(_probe->offset));
|
||||
ret = session->get_device()->set_config_uint16(SR_CONF_PROBE_OFFSET,
|
||||
_probe->offset, _probe, NULL);
|
||||
|
||||
// -- trig_value
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_TRIGGER_VALUE,
|
||||
g_variant_new_byte(_probe->trig_value));
|
||||
session->get_device()->set_config_byte(SR_CONF_TRIGGER_VALUE,
|
||||
_probe->trig_value, _probe, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -243,77 +228,51 @@ QPointF AnalogSignal::get_point(uint64_t index, float &value)
|
||||
uint64_t AnalogSignal::get_vdiv()
|
||||
{
|
||||
uint64_t vdiv = 0;
|
||||
GVariant* gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_VDIV);
|
||||
if (gvar != NULL) {
|
||||
vdiv = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_uint64(SR_CONF_PROBE_VDIV, vdiv, _probe, NULL);
|
||||
return vdiv;
|
||||
}
|
||||
|
||||
uint8_t AnalogSignal::get_acCoupling()
|
||||
{
|
||||
uint64_t coupling = 0;
|
||||
GVariant* gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_COUPLING);
|
||||
if (gvar != NULL) {
|
||||
coupling = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
int coupling = 0;
|
||||
session->get_device()->get_config_byte(SR_CONF_PROBE_COUPLING, coupling, _probe, NULL);
|
||||
return coupling;
|
||||
}
|
||||
|
||||
bool AnalogSignal::get_mapDefault()
|
||||
{
|
||||
bool isDefault = true;
|
||||
GVariant* gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_MAP_DEFAULT);
|
||||
if (gvar != NULL) {
|
||||
isDefault = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_bool(SR_CONF_PROBE_MAP_DEFAULT, isDefault, _probe, NULL);
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
QString AnalogSignal::get_mapUnit()
|
||||
{
|
||||
QString unit;
|
||||
GVariant* gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_MAP_UNIT);
|
||||
if (gvar != NULL) {
|
||||
unit = g_variant_get_string(gvar, NULL);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_string(SR_CONF_PROBE_MAP_UNIT, unit, _probe, NULL);
|
||||
return unit;
|
||||
}
|
||||
|
||||
double AnalogSignal::get_mapMin()
|
||||
{
|
||||
double min = -1;
|
||||
GVariant* gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MIN);
|
||||
if (gvar != NULL) {
|
||||
min = g_variant_get_double(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_double(SR_CONF_PROBE_MAP_MIN, min, _probe, NULL);
|
||||
return min;
|
||||
}
|
||||
|
||||
double AnalogSignal::get_mapMax()
|
||||
{
|
||||
double max = 1;
|
||||
GVariant* gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_MAP_MAX);
|
||||
if (gvar != NULL) {
|
||||
max = g_variant_get_double(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_double(SR_CONF_PROBE_MAP_MAX, max, _probe, NULL);
|
||||
return max;
|
||||
}
|
||||
|
||||
uint64_t AnalogSignal::get_factor()
|
||||
{
|
||||
GVariant* gvar;
|
||||
uint64_t factor;
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_FACTOR);
|
||||
if (gvar != NULL) {
|
||||
factor = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool ret;
|
||||
ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_FACTOR,factor,_probe, NULL);
|
||||
if (ret) {
|
||||
return factor;
|
||||
}
|
||||
else {
|
||||
@ -364,8 +323,8 @@ void AnalogSignal::set_zero_ratio(double ratio)
|
||||
return;
|
||||
|
||||
_zero_offset = ratio2value(ratio);
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_OFFSET,
|
||||
g_variant_new_uint16(_zero_offset));
|
||||
session->get_device()->set_config_uint16(SR_CONF_PROBE_OFFSET,
|
||||
_zero_offset, _probe, NULL);
|
||||
}
|
||||
|
||||
double AnalogSignal::get_zero_ratio()
|
||||
|
@ -96,10 +96,12 @@ DsoSignal::DsoSignal(data::DsoSnapshot *data,
|
||||
GVariant *gvar;
|
||||
GVariantIter iter;
|
||||
g_variant_iter_init(&iter, gvar_list_vdivs);
|
||||
|
||||
while(NULL != (gvar = g_variant_iter_next_value(&iter))) {
|
||||
vValue.push_back(g_variant_get_uint64(gvar));
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
g_variant_unref(gvar_list_vdivs);
|
||||
g_variant_unref(gvar_list);
|
||||
}
|
||||
@ -138,14 +140,11 @@ void DsoSignal::set_enable(bool enable)
|
||||
}
|
||||
|
||||
_en_lock = true;
|
||||
GVariant* gvar;
|
||||
bool cur_enable;
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_EN);
|
||||
if (gvar != NULL) {
|
||||
cur_enable = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
bool ret;
|
||||
ret = session->get_device()->get_config_bool(SR_CONF_PROBE_EN, cur_enable, _probe, NULL);
|
||||
|
||||
if (!ret) {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_EN failed.");
|
||||
_en_lock = false;
|
||||
return;
|
||||
@ -166,8 +165,8 @@ void DsoSignal::set_enable(bool enable)
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
set_vDialActive(false);
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_EN,
|
||||
g_variant_new_boolean(enable));
|
||||
session->get_device()->set_config_bool( SR_CONF_PROBE_EN,
|
||||
enable, _probe, NULL);
|
||||
|
||||
_view->update_hori_res();
|
||||
|
||||
@ -200,15 +199,15 @@ bool DsoSignal::go_vDialPre(bool manul)
|
||||
const double pre_vdiv = _vDial->get_value();
|
||||
_vDial->set_sel(_vDial->get_sel() - 1);
|
||||
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_VDIV,
|
||||
g_variant_new_uint64(_vDial->get_value()));
|
||||
session->get_device()->set_config_uint64(SR_CONF_PROBE_VDIV,
|
||||
_vDial->get_value(), _probe, NULL);
|
||||
|
||||
if (session->is_stopped_status()) {
|
||||
session->set_stop_scale(session->stop_scale() * (pre_vdiv/_vDial->get_value()));
|
||||
set_scale(get_view_rect().height());
|
||||
}
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_OFFSET,
|
||||
g_variant_new_uint16(_zero_offset));
|
||||
session->get_device()->set_config_uint16(SR_CONF_PROBE_OFFSET,
|
||||
_zero_offset, _probe, NULL);
|
||||
|
||||
_view->vDial_updated();
|
||||
_view->set_update(_viewport, true);
|
||||
@ -235,15 +234,15 @@ bool DsoSignal::go_vDialNext(bool manul)
|
||||
const double pre_vdiv = _vDial->get_value();
|
||||
_vDial->set_sel(_vDial->get_sel() + 1);
|
||||
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_VDIV,
|
||||
g_variant_new_uint64(_vDial->get_value()));
|
||||
session->get_device()->set_config_uint64(SR_CONF_PROBE_VDIV,
|
||||
_vDial->get_value(), _probe, NULL);
|
||||
|
||||
if (session->is_stopped_status()) {
|
||||
session->set_stop_scale(session->stop_scale() * (pre_vdiv/_vDial->get_value()));
|
||||
set_scale(get_view_rect().height());
|
||||
}
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_OFFSET,
|
||||
g_variant_new_uint16(_zero_offset));
|
||||
session->get_device()->set_config_uint16(SR_CONF_PROBE_OFFSET,
|
||||
_zero_offset, _probe, NULL);
|
||||
|
||||
_view->vDial_updated();
|
||||
_view->set_update(_viewport, true);
|
||||
@ -259,13 +258,14 @@ bool DsoSignal::go_vDialNext(bool manul)
|
||||
|
||||
bool DsoSignal::load_settings()
|
||||
{
|
||||
GVariant* gvar;
|
||||
int v;
|
||||
uint32_t ui32;
|
||||
bool ret;
|
||||
|
||||
// dso channel bits
|
||||
gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_UNIT_BITS);
|
||||
if (gvar != NULL) {
|
||||
_bits = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
ret = session->get_device()->get_config_byte(SR_CONF_UNIT_BITS, v);
|
||||
if (ret) {
|
||||
_bits = (uint8_t)v;
|
||||
}
|
||||
else {
|
||||
_bits = DefaultBits;
|
||||
@ -275,39 +275,29 @@ bool DsoSignal::load_settings()
|
||||
return false;
|
||||
}
|
||||
|
||||
gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MIN);
|
||||
if (gvar != NULL) {
|
||||
_ref_min = g_variant_get_uint32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
} else {
|
||||
ret = session->get_device()->get_config_uint32(SR_CONF_REF_MIN, ui32);
|
||||
if (ret)
|
||||
_ref_min = (double)ui32;
|
||||
else
|
||||
_ref_min = 1;
|
||||
}
|
||||
gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_REF_MAX);
|
||||
if (gvar != NULL) {
|
||||
_ref_max = g_variant_get_uint32(gvar);
|
||||
g_variant_unref(gvar);
|
||||
} else {
|
||||
|
||||
ret = session->get_device()->get_config_uint32(SR_CONF_REF_MAX, ui32);
|
||||
if (ret)
|
||||
_ref_max = (double)ui32;
|
||||
else
|
||||
_ref_max = ((1 << _bits) - 1);
|
||||
}
|
||||
|
||||
// -- vdiv
|
||||
uint64_t vdiv;
|
||||
uint64_t vfactor;
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_VDIV);
|
||||
if (gvar != NULL) {
|
||||
vdiv = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_VDIV, vdiv, _probe, NULL);
|
||||
if (!ret) {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_VDIV failed.");
|
||||
return false;
|
||||
}
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_FACTOR);
|
||||
if (gvar != NULL) {
|
||||
vfactor = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
|
||||
ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_FACTOR, vfactor, _probe, NULL);
|
||||
if (!ret) {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_FACTOR failed.");
|
||||
return false;
|
||||
}
|
||||
@ -316,10 +306,9 @@ bool DsoSignal::load_settings()
|
||||
_vDial->set_factor(vfactor);
|
||||
|
||||
// -- coupling
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_COUPLING);
|
||||
if (gvar != NULL) {
|
||||
_acCoupling = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
ret = session->get_device()->get_config_byte(SR_CONF_PROBE_COUPLING, v, _probe, NULL);
|
||||
if (ret) {
|
||||
_acCoupling = uint8_t(v);
|
||||
}
|
||||
else {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_COUPLING failed.");
|
||||
@ -327,22 +316,16 @@ bool DsoSignal::load_settings()
|
||||
}
|
||||
|
||||
// -- vpos
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_OFFSET);
|
||||
if (gvar != NULL) {
|
||||
_zero_offset = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
ret = session->get_device()->get_config_uint16(SR_CONF_PROBE_OFFSET, _zero_offset, _probe, NULL);
|
||||
if (!ret) {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_OFFSET failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// -- trig_value
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_TRIGGER_VALUE);
|
||||
if (gvar != NULL) {
|
||||
_trig_value = g_variant_get_byte(gvar);
|
||||
ret = session->get_device()->get_config_byte(SR_CONF_TRIGGER_VALUE, _trig_value, _probe, NULL);
|
||||
if (ret) {
|
||||
_trig_delta = get_trig_vrate() - get_zero_ratio();
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_TRIGGER_VALUE failed.");
|
||||
@ -363,26 +346,26 @@ int DsoSignal::commit_settings()
|
||||
int ret;
|
||||
|
||||
// -- enable
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_EN,
|
||||
g_variant_new_boolean(enabled()));
|
||||
ret = session->get_device()->set_config_bool(SR_CONF_PROBE_EN,
|
||||
enabled(), _probe, NULL);
|
||||
|
||||
// -- vdiv
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_VDIV,
|
||||
g_variant_new_uint64(_vDial->get_value()));
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_FACTOR,
|
||||
g_variant_new_uint64(_vDial->get_factor()));
|
||||
ret = session->get_device()->set_config_uint64(SR_CONF_PROBE_VDIV,
|
||||
_vDial->get_value(), _probe, NULL);
|
||||
ret = session->get_device()->set_config_uint64(SR_CONF_PROBE_FACTOR,
|
||||
_vDial->get_factor(), _probe, NULL);
|
||||
|
||||
// -- coupling
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_COUPLING,
|
||||
g_variant_new_byte(_acCoupling));
|
||||
ret = session->get_device()->set_config_byte(SR_CONF_PROBE_COUPLING,
|
||||
_acCoupling, _probe, NULL);
|
||||
|
||||
// -- offset
|
||||
ret = session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_OFFSET,
|
||||
g_variant_new_uint16(_zero_offset));
|
||||
ret = session->get_device()->set_config_uint16(SR_CONF_PROBE_OFFSET,
|
||||
_zero_offset, _probe, NULL);
|
||||
|
||||
// -- trig_value
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_TRIGGER_VALUE,
|
||||
g_variant_new_byte(_trig_value));
|
||||
session->get_device()->set_config_byte(SR_CONF_TRIGGER_VALUE,
|
||||
_trig_value, _probe, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -401,8 +384,8 @@ void DsoSignal::set_acCoupling(uint8_t coupling)
|
||||
{
|
||||
if (enabled()) {
|
||||
_acCoupling = coupling;
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_COUPLING,
|
||||
g_variant_new_byte(_acCoupling));
|
||||
session->get_device()->set_config_byte(SR_CONF_PROBE_COUPLING,
|
||||
_acCoupling, _probe, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,8 +446,8 @@ void DsoSignal::set_trig_ratio(double ratio, bool delta_change)
|
||||
|
||||
if (delta_change)
|
||||
_trig_delta = get_trig_vrate() - get_zero_ratio();
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_TRIGGER_VALUE,
|
||||
g_variant_new_byte(_trig_value));
|
||||
session->get_device()->set_config_byte(SR_CONF_TRIGGER_VALUE,
|
||||
_trig_value, _probe, NULL);
|
||||
}
|
||||
|
||||
int DsoSignal::get_zero_vpos()
|
||||
@ -480,12 +463,7 @@ double DsoSignal::get_zero_ratio()
|
||||
int DsoSignal::get_hw_offset()
|
||||
{
|
||||
int hw_offset = 0;
|
||||
|
||||
GVariant *gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_HW_OFFSET);
|
||||
if (gvar != NULL) {
|
||||
hw_offset = g_variant_get_uint16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_uint16(SR_CONF_PROBE_HW_OFFSET, hw_offset, _probe, NULL);
|
||||
return hw_offset;
|
||||
}
|
||||
|
||||
@ -500,28 +478,25 @@ void DsoSignal::set_zero_vpos(int pos)
|
||||
void DsoSignal::set_zero_ratio(double ratio)
|
||||
{
|
||||
_zero_offset = ratio2value(ratio);
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_OFFSET,
|
||||
g_variant_new_uint16(_zero_offset));
|
||||
session->get_device()->set_config_uint16(SR_CONF_PROBE_OFFSET,
|
||||
_zero_offset, _probe, NULL);
|
||||
}
|
||||
|
||||
void DsoSignal::set_factor(uint64_t factor)
|
||||
{
|
||||
if (enabled()) {
|
||||
GVariant* gvar;
|
||||
uint64_t prefactor = 0;
|
||||
bool ret;
|
||||
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_FACTOR);
|
||||
if (gvar != NULL) {
|
||||
prefactor = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_FACTOR, prefactor, _probe, NULL);
|
||||
if (!ret) {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_FACTOR failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (prefactor != factor) {
|
||||
session->get_device()->set_config(_probe, NULL, SR_CONF_PROBE_FACTOR,
|
||||
g_variant_new_uint64(factor));
|
||||
session->get_device()->set_config_uint64(SR_CONF_PROBE_FACTOR,
|
||||
factor, _probe, NULL);
|
||||
_vDial->set_factor(factor);
|
||||
_view->set_update(_viewport, true);
|
||||
_view->update();
|
||||
@ -531,13 +506,10 @@ void DsoSignal::set_factor(uint64_t factor)
|
||||
|
||||
uint64_t DsoSignal::get_factor()
|
||||
{
|
||||
GVariant* gvar;
|
||||
uint64_t factor;
|
||||
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_FACTOR);
|
||||
if (gvar != NULL) {
|
||||
factor = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_FACTOR, factor, _probe, NULL);
|
||||
if (ret) {
|
||||
return factor;
|
||||
}
|
||||
else {
|
||||
@ -690,10 +662,12 @@ void DsoSignal::paint_prepare()
|
||||
if (session->trigd()) {
|
||||
if (get_index() == session->trigd_ch()) {
|
||||
uint8_t slope = DSO_TRIGGER_RISING;
|
||||
GVariant *gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_TRIGGER_SLOPE);
|
||||
if (gvar != NULL) {
|
||||
slope = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
int v;
|
||||
bool ret;
|
||||
|
||||
ret = session->get_device()->get_config_byte(SR_CONF_TRIGGER_SLOPE, v);
|
||||
if (ret) {
|
||||
slope = (uint8_t)v;
|
||||
}
|
||||
|
||||
int64_t trig_index = _view->get_trig_cursor()->index();
|
||||
@ -1142,14 +1116,11 @@ void DsoSignal::paint_type_options(QPainter &p, int right, const QPoint pt, QCol
|
||||
}
|
||||
|
||||
// paint the probe factor selector
|
||||
GVariant* gvar;
|
||||
uint64_t factor;
|
||||
gvar = session->get_device()->get_config(_probe, NULL, SR_CONF_PROBE_FACTOR);
|
||||
if (gvar != NULL) {
|
||||
factor = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
else {
|
||||
bool ret;
|
||||
|
||||
ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_FACTOR, factor, _probe, NULL);
|
||||
if (!ret) {
|
||||
dsv_err("%s", "ERROR: config_get SR_CONF_PROBE_FACTOR failed.");
|
||||
return;
|
||||
}
|
||||
@ -1362,11 +1333,8 @@ void DsoSignal::auto_set()
|
||||
if (_mValid && !session->get_data_auto_lock()) {
|
||||
if (_autoH) {
|
||||
bool roll = false;
|
||||
GVariant *gvar = session->get_device()->get_config(NULL, NULL, SR_CONF_ROLL);
|
||||
if (gvar != NULL) {
|
||||
roll = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
session->get_device()->get_config_bool(SR_CONF_ROLL, roll);
|
||||
|
||||
const double hori_res = _view->get_hori_res();
|
||||
if (_level_valid && ((!roll && _pcount < 3) || _period > 4*hori_res)) {
|
||||
_view->zoom(-1);
|
||||
|
@ -437,22 +437,21 @@ void View::set_trig_time()
|
||||
void View::receive_end()
|
||||
{
|
||||
if (_device_agent->get_work_mode() == LOGIC) {
|
||||
GVariant *gvar = _device_agent->get_config(NULL, NULL, SR_CONF_RLE);
|
||||
if (gvar != NULL) {
|
||||
bool rle = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (rle) {
|
||||
gvar = _device_agent->get_config(NULL, NULL, SR_CONF_ACTUAL_SAMPLES);
|
||||
if (gvar != NULL) {
|
||||
uint64_t actual_samples = g_variant_get_uint64(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool rle = false;
|
||||
uint64_t actual_samples;
|
||||
bool ret;
|
||||
|
||||
ret = _device_agent->get_config_bool(SR_CONF_RLE, rle);
|
||||
|
||||
if (ret && rle) {
|
||||
ret = _device_agent->get_config_uint64(SR_CONF_ACTUAL_SAMPLES, actual_samples);
|
||||
if (ret) {
|
||||
if (actual_samples != _session->cur_samplelimits()) {
|
||||
_viewbottom->set_rle_depth(actual_samples);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_time_viewport->unshow_wait_trigger();
|
||||
}
|
||||
|
||||
@ -647,12 +646,14 @@ void View::signals_changed()
|
||||
}
|
||||
|
||||
if (_device_agent->get_work_mode() == LOGIC) {
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_MAX_HEIGHT_VALUE);
|
||||
int v;
|
||||
bool ret;
|
||||
|
||||
if (gvar != NULL) {
|
||||
max_height = (g_variant_get_byte(gvar) + 1) * MaxHeightUnit;
|
||||
g_variant_unref(gvar);
|
||||
ret = _device_agent->get_config_byte(SR_CONF_MAX_HEIGHT_VALUE, v);
|
||||
if (ret) {
|
||||
max_height = (v + 1) * MaxHeightUnit;
|
||||
}
|
||||
|
||||
if (height < 2*actualMargin) {
|
||||
actualMargin /= 2;
|
||||
_signalHeight = max(1.0, (_time_viewport->height()
|
||||
@ -1209,15 +1210,13 @@ int View::get_cursor_index_by_key(uint64_t key)
|
||||
void View::check_calibration()
|
||||
{
|
||||
if (_device_agent->get_work_mode() == DSO){
|
||||
GVariant* gvar = _device_agent->get_config(NULL, NULL, SR_CONF_CALI);
|
||||
if (gvar != NULL) {
|
||||
bool cali = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
bool cali = false;
|
||||
_device_agent->get_config_bool(SR_CONF_CALI, cali);
|
||||
|
||||
if (cali) {
|
||||
show_calibration();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void View::set_scale(double scale)
|
||||
|
@ -377,21 +377,15 @@ void Viewport::paintSignals(QPainter &p, QColor fore, QColor back)
|
||||
if (_view.session().get_device()->get_work_mode() == DSO
|
||||
&& _view.session().is_running_status())
|
||||
{
|
||||
uint8_t type;
|
||||
int type;
|
||||
bool roll = false;
|
||||
QString type_str="";
|
||||
bool ret = false;
|
||||
|
||||
GVariant *gvar = _view.session().get_device()->get_config(NULL, NULL, SR_CONF_ROLL);
|
||||
if (gvar != NULL) {
|
||||
roll = g_variant_get_boolean(gvar);
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
|
||||
gvar = _view.session().get_device()->get_config(NULL, NULL, SR_CONF_TRIGGER_SOURCE);
|
||||
if (gvar != NULL) {
|
||||
type = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
_view.session().get_device()->get_config_bool(SR_CONF_ROLL, roll);
|
||||
|
||||
ret = _view.session().get_device()->get_config_byte(SR_CONF_TRIGGER_SOURCE, type);
|
||||
if (ret) {
|
||||
bool bDot = false;
|
||||
|
||||
if (type == DSO_TRIGGER_AUTO && roll) {
|
||||
|
@ -139,25 +139,11 @@ static GString *gen_header(const struct sr_output *o)
|
||||
g_string_append_printf(header, "; Channels (%d/%d)\n",
|
||||
ctx->num_enabled_channels, num_channels);
|
||||
|
||||
// if (ctx->samplerate == 0) {
|
||||
// if (sr_config_get(o->sdi->driver, o->sdi, NULL, NULL, SR_CONF_SAMPLERATE,
|
||||
// &gvar) == SR_OK) {
|
||||
// ctx->samplerate = g_variant_get_uint64(gvar);
|
||||
// g_variant_unref(gvar);
|
||||
// }
|
||||
// }
|
||||
|
||||
char *samplerate_s = sr_samplerate_string(ctx->samplerate);
|
||||
g_string_append_printf(header, "; Sample rate: %s\n", samplerate_s);
|
||||
g_free(samplerate_s);
|
||||
|
||||
// if (sr_config_get(o->sdi->driver, o->sdi, NULL, NULL, SR_CONF_LIMIT_SAMPLES,
|
||||
// &gvar) == SR_OK) {
|
||||
// uint64_t depth = g_variant_get_uint64(gvar);
|
||||
// g_variant_unref(gvar);
|
||||
// char *depth_s = sr_samplecount_string(depth);
|
||||
// g_string_append_printf(header, "; Sample count: %s\n", depth_s);
|
||||
// g_free(depth_s);
|
||||
// }
|
||||
char *depth_s = sr_samplecount_string(ctx->limit_samples);
|
||||
g_string_append_printf(header, "; Sample count: %s\n", depth_s);
|
||||
g_free(depth_s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user