static int dev_open(struct sr_dev_inst *sdi)
{
+ struct dev_context *devc;
struct sr_scpi_dev_inst *scpi;
+ GVariant *beeper;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
sdi->status = SR_ST_ACTIVE;
scpi_cmd(sdi, SCPI_CMD_REMOTE);
+ devc = sdi->priv;
+ devc->beeper_was_set = FALSE;
+ if (scpi_cmd_resp(sdi, &beeper, G_VARIANT_TYPE_BOOLEAN, SCPI_CMD_BEEPER) == SR_OK) {
+ if (g_variant_get_boolean(beeper)) {
+ devc->beeper_was_set = TRUE;
+ scpi_cmd(sdi, SCPI_CMD_BEEPER_DISABLE);
+ }
+ g_variant_unref(beeper);
+ }
return SR_OK;
}
static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_scpi_dev_inst *scpi;
+ struct dev_context *devc;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
+ devc = sdi->priv;
scpi = sdi->conn;
if (scpi) {
+ if (devc->beeper_was_set)
+ scpi_cmd(sdi, SCPI_CMD_BEEPER_ENABLE);
scpi_cmd(sdi, SCPI_CMD_LOCAL);
sr_scpi_close(scpi);
sdi->status = SR_ST_INACTIVE;
struct scpi_command rigol_dp800_cmd[] = {
{ SCPI_CMD_REMOTE, "SYST:REMOTE" },
{ SCPI_CMD_LOCAL, "SYST:LOCAL" },
+ { SCPI_CMD_BEEPER, "SYST:BEEP:STAT?" },
+ { SCPI_CMD_BEEPER_ENABLE, "SYST:BEEP:STAT ON" },
+ { SCPI_CMD_BEEPER_DISABLE, "SYST:BEEP:STAT OFF" },
{ SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
{ SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
{ SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
enum pps_scpi_cmds {
SCPI_CMD_REMOTE,
SCPI_CMD_LOCAL,
+ SCPI_CMD_BEEPER,
+ SCPI_CMD_BEEPER_ENABLE,
+ SCPI_CMD_BEEPER_DISABLE,
SCPI_CMD_SELECT_CHANNEL,
SCPI_CMD_GET_MEAS_VOLTAGE,
SCPI_CMD_GET_MEAS_CURRENT,
void *cb_data;
/* Operational state */
+ gboolean beeper_was_set;
/* Temporary state across callbacks */
struct sr_channel *cur_channel;