2 * This file is part of the libsigrok project.
4 * Copyright (C) 2016 Vlad Ivanov <vlad.ivanov@lab-systems.ru>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 RS_CMD_CONTROL_REMOTE,
34 static char *commands[] = {
35 [RS_CMD_CONTROL_REMOTE] = "\n",
36 [RS_CMD_SET_FREQ] = "FREQ %.1fHz",
37 [RS_CMD_SET_POWER] = "POW %.1fdBm",
38 [RS_CMD_GET_FREQ] = "FREQ?",
39 [RS_CMD_GET_POWER] = "POW?"
42 SR_PRIV int rs_sme0x_mode_remote(struct sr_scpi_dev_inst *scpi) {
43 return sr_scpi_send(scpi, commands[RS_CMD_CONTROL_REMOTE]);
46 SR_PRIV int rs_sme0x_get_freq(const struct sr_dev_inst *sdi, double *freq) {
47 if (sr_scpi_get_double(sdi->conn, commands[RS_CMD_GET_FREQ], freq) != SR_OK) {
54 SR_PRIV int rs_sme0x_get_power(const struct sr_dev_inst *sdi, double *power) {
55 if (sr_scpi_get_double(sdi->conn, commands[RS_CMD_GET_POWER], power) != SR_OK) {
62 SR_PRIV int rs_sme0x_set_freq(const struct sr_dev_inst *sdi, double freq) {
63 struct dev_context *devc;
64 const struct rs_device_model *config;
67 config = devc->model_config;
69 if ((freq > config->freq_max) || (freq < config->freq_min)) {
73 return sr_scpi_send(sdi->conn, commands[RS_CMD_SET_FREQ], freq);
76 SR_PRIV int rs_sme0x_set_power(const struct sr_dev_inst *sdi, double power) {
77 struct dev_context *devc;
78 const struct rs_device_model *config;
81 config = devc->model_config;
83 if ((power > config->power_max) || (power < config->power_min)) {
87 return sr_scpi_send(sdi->conn, commands[RS_CMD_SET_POWER], power);