struct scope_config *model;
struct scope_state *state;
const char *tmp;
- uint64_t p, q, tmp_u64;
+ uint64_t p, q;
double tmp_d;
gboolean update_sample_rate;
ret = sr_scpi_send(sdi->conn, command);
break;
case SR_CONF_TRIGGER_SLOPE:
- tmp_u64 = g_variant_get_uint64(data);
+ tmp = g_variant_get_string(data, NULL);
- if (tmp_u64 != 0 && tmp_u64 != 1)
- return SR_ERR;
+ if (!tmp || !(tmp[0] == 'f' || tmp[0] == 'r'))
+ return SR_ERR_ARG;
- state->trigger_slope = tmp_u64;
+ state->trigger_slope = (tmp[0] == 'r') ? 0 : 1;
g_snprintf(command, sizeof(command),
(*model->scpi_dialect)[SCPI_CMD_SET_TRIGGER_SLOPE],
- tmp_u64 ? "POS" : "NEG");
+ (state->trigger_slope == 0) ? "POS" : "NEG");
ret = sr_scpi_send(sdi->conn, command);
break;
devc->limit_frames = g_variant_get_uint64(data);
break;
case SR_CONF_TRIGGER_SLOPE:
- tmp_u64 = g_variant_get_uint64(data);
- if (tmp_u64 != SLOPE_NEGATIVE && tmp_u64 != SLOPE_POSITIVE)
- ret = SR_ERR_ARG;
- devc->triggerslope = tmp_u64;
+ tmp_str = g_variant_get_string(data, NULL);
+ if (!tmp_str || !(tmp_str[0] == 'f' || tmp_str[0] == 'r'))
+ return SR_ERR_ARG;
+ devc->triggerslope = (tmp_str[0] == 'r')
+ ? SLOPE_POSITIVE : SLOPE_NEGATIVE;
break;
case SR_CONF_HORIZ_TRIGGERPOS:
tmp_double = g_variant_get_double(data);
{
int ret;
struct dev_context *devc;
- uint64_t num_samples, slope;
+ uint64_t num_samples;
+ const char *slope;
int trigger_pos;
double pos;
ret = SR_OK;
break;
case SR_CONF_TRIGGER_SLOPE:
- slope = g_variant_get_uint64(data);
- if (slope != SLOPE_NEGATIVE && slope != SLOPE_POSITIVE) {
+ slope = g_variant_get_string(data, NULL);
+
+ if (!slope || !(slope[0] == 'f' || slope[0] == 'r'))
sr_err("Invalid trigger slope");
ret = SR_ERR_ARG;
} else {
- devc->trigger_slope = slope;
+ devc->trigger_slope = (slope[0] == 'r')
+ ? SLOPE_POSITIVE : SLOPE_NEGATIVE;
ret = SR_OK;
}
break;
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
- uint64_t tmp_u64, p, q;
+ uint64_t p, q;
double t_dbl;
unsigned int i, j;
int ret;
devc->limit_frames = g_variant_get_uint64(data);
break;
case SR_CONF_TRIGGER_SLOPE:
- tmp_u64 = g_variant_get_uint64(data);
- if (tmp_u64 != 0 && tmp_u64 != 1)
- return SR_ERR;
+ tmp_str = g_variant_get_string(data, NULL);
+
+ if (!tmp_str || !(tmp_str[0] == 'f' || tmp_str[0] == 'r'))
+ return SR_ERR_ARG;
+
g_free(devc->trigger_slope);
- devc->trigger_slope = g_strdup(tmp_u64 ? "POS" : "NEG");
+ devc->trigger_slope = g_strdup((tmp_str[0] == 'r') ? "POS" : "NEG");
ret = rigol_ds_config_set(sdi, ":TRIG:EDGE:SLOP %s", devc->trigger_slope);
break;
case SR_CONF_HORIZ_TRIGGERPOS:
"Swap channel order", NULL},
{SR_CONF_RLE, SR_T_BOOL, "rle",
"Run Length Encoding", NULL},
- {SR_CONF_TRIGGER_SLOPE, SR_T_UINT64, "triggerslope",
+ {SR_CONF_TRIGGER_SLOPE, SR_T_CHAR, "triggerslope",
"Trigger slope", NULL},
{SR_CONF_TRIGGER_SOURCE, SR_T_CHAR, "triggersource",
"Trigger source", NULL},