}
SR_PRIV int sr_brymen_bm25x_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
float val;
(void)info;
- analog->mq = SR_MQ_GAIN;
- analog->unit = SR_UNIT_UNITLESS;
- analog->mqflags = 0;
+ analog->meaning->mq = SR_MQ_GAIN;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mqflags = 0;
if (buf[1] & 8)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (buf[1] & 4)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (buf[1] & 2)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (buf[1] & 1)
- analog->mqflags |= SR_MQFLAG_RELATIVE;
+ analog->meaning->mqflags |= SR_MQFLAG_RELATIVE;
if (buf[11] & 8)
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (buf[13] & 8)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
if (buf[14] & 8)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
if (buf[14] & 4) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
- if ((analog->mqflags & (SR_MQFLAG_DC | SR_MQFLAG_AC)) == 0)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
+ if ((analog->meaning->mqflags & (SR_MQFLAG_DC | SR_MQFLAG_AC)) == 0)
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
}
if (buf[14] & 2) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (buf[12] & 4) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (buf[13] & 4) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (buf[12] & 2) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (decode_digit(3, buf) == 'C') {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
if (decode_digit(3, buf) == 'F') {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_FAHRENHEIT;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_FAHRENHEIT;
}
val = decode_value(buf) * decode_prefix(buf);
info->is_max = (buf[14] & (1 << 3)) != 0;
}
-static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
+static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
const struct dtm0660_info *info)
{
/* Factors */
/* Measurement modes */
if (info->is_volt) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_ampere) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (info->is_ohm) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (info->is_hz) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_farad) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (info->is_beep) {
- analog->mq = SR_MQ_CONTINUITY;
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->mq = SR_MQ_CONTINUITY;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
*floatval = (*floatval == INFINITY) ? 0.0 : 1.0;
}
if (info->is_diode) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_percent) {
- analog->mq = SR_MQ_DUTY_CYCLE;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_DUTY_CYCLE;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
}
if (info->is_degc) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
if (info->is_degf) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_FAHRENHEIT;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_FAHRENHEIT;
}
/* Measurement related flags */
if (info->is_ac)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (info->is_dc)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (info->is_auto)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (info->is_diode)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
if (info->is_hold)
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (info->is_rel)
- analog->mqflags |= SR_MQFLAG_RELATIVE;
+ analog->meaning->mqflags |= SR_MQFLAG_RELATIVE;
if (info->is_min)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
if (info->is_max)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
/* Other flags */
if (info->is_rs232)
* @param buf Buffer containing the 15-byte protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will contain the
* result value upon parsing success. Must not be NULL.
- * @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
+ * @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct dtm0660_info. The struct will be filled
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_dtm0660_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
int ret;
struct dtm0660_info *info_local;
}
}
-static void handle_flags(struct sr_datafeed_analog_old *analog,
+static void handle_flags(struct sr_datafeed_analog *analog,
float *floatval, const struct es519xx_info *info)
{
/*
/* Measurement modes */
if (info->is_voltage) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_current) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (info->is_resistance) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (info->is_frequency) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_capacitance) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (info->is_temperature && info->is_celsius) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
if (info->is_temperature && info->is_fahrenheit) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_FAHRENHEIT;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_FAHRENHEIT;
}
if (info->is_continuity) {
- analog->mq = SR_MQ_CONTINUITY;
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->mq = SR_MQ_CONTINUITY;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
*floatval = (*floatval < 0.0 || *floatval > 25.0) ? 0.0 : 1.0;
}
if (info->is_diode) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_rpm) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_REVOLUTIONS_PER_MINUTE;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_REVOLUTIONS_PER_MINUTE;
}
if (info->is_duty_cycle) {
- analog->mq = SR_MQ_DUTY_CYCLE;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_DUTY_CYCLE;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
}
/* Measurement related flags */
if (info->is_ac)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (info->is_dc)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (info->is_auto)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (info->is_diode)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
if (info->is_hold)
/*
* Note: HOLD only affects the number displayed on the LCD,
* but not the value sent via the protocol! It also does not
* affect the bargraph on the LCD.
*/
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (info->is_max)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
if (info->is_min)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
if (info->is_rel)
- analog->mqflags |= SR_MQFLAG_RELATIVE;
+ analog->meaning->mqflags |= SR_MQFLAG_RELATIVE;
/* Other flags */
if (info->is_judge)
}
static int sr_es519xx_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog,
+ struct sr_datafeed_analog *analog,
struct es519xx_info *info)
{
int ret;
}
SR_PRIV int sr_es519xx_2400_11b_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
struct es519xx_info *info_local;
}
SR_PRIV int sr_es519xx_2400_11b_altfn_parse(const uint8_t *buf,
- float *floatval, struct sr_datafeed_analog_old *analog, void *info)
+ float *floatval, struct sr_datafeed_analog *analog, void *info)
{
struct es519xx_info *info_local;
}
SR_PRIV int sr_es519xx_19200_11b_5digits_parse(const uint8_t *buf,
- float *floatval, struct sr_datafeed_analog_old *analog, void *info)
+ float *floatval, struct sr_datafeed_analog *analog, void *info)
{
struct es519xx_info *info_local;
}
SR_PRIV int sr_es519xx_19200_11b_clamp_parse(const uint8_t *buf,
- float *floatval, struct sr_datafeed_analog_old *analog, void *info)
+ float *floatval, struct sr_datafeed_analog *analog, void *info)
{
struct es519xx_info *info_local;
}
SR_PRIV int sr_es519xx_19200_11b_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
struct es519xx_info *info_local;
}
SR_PRIV int sr_es519xx_19200_14b_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
struct es519xx_info *info_local;
}
SR_PRIV int sr_es519xx_19200_14b_sel_lpf_parse(const uint8_t *buf,
- float *floatval, struct sr_datafeed_analog_old *analog, void *info)
+ float *floatval, struct sr_datafeed_analog *analog, void *info)
{
struct es519xx_info *info_local;
info->is_c2c1_00 = (buf[13] & (1 << 0)) != 0;
}
-static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
+static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
const struct fs9721_info *info)
{
/* Factors */
/* Measurement modes */
if (info->is_volt) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_ampere) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (info->is_ohm) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (info->is_hz) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_farad) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (info->is_beep) {
- analog->mq = SR_MQ_CONTINUITY;
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->mq = SR_MQ_CONTINUITY;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
*floatval = (*floatval == INFINITY) ? 0.0 : 1.0;
}
if (info->is_diode) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_percent) {
- analog->mq = SR_MQ_DUTY_CYCLE;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_DUTY_CYCLE;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
}
/* Measurement related flags */
if (info->is_ac)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (info->is_dc)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (info->is_auto)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (info->is_diode)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
if (info->is_hold)
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (info->is_rel)
- analog->mqflags |= SR_MQFLAG_RELATIVE;
+ analog->meaning->mqflags |= SR_MQFLAG_RELATIVE;
/* Other flags */
if (info->is_rs232)
* @param buf Buffer containing the 14-byte protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will contain the
* result value upon parsing success. Must not be NULL.
- * @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
+ * @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct fs9721_info. The struct will be filled
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_fs9721_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
int ret;
struct fs9721_info *info_local;
return SR_OK;
}
-SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog_old *analog, void *info)
+SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog *analog, void *info)
{
struct fs9721_info *info_local;
/* User-defined FS9721_LP3 flag 'c2c1_00' means temperature (C). */
if (info_local->is_c2c1_00) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
}
-SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog_old *analog, void *info)
+SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog *analog, void *info)
{
struct fs9721_info *info_local;
/* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (C). */
if (info_local->is_c2c1_01) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
}
-SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog_old *analog, void *info)
+SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog *analog, void *info)
{
struct fs9721_info *info_local;
/* User-defined FS9721_LP3 flag 'c2c1_10' means temperature (C). */
if (info_local->is_c2c1_10) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
}
-SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog_old *analog, void *info)
+SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *info)
{
struct fs9721_info *info_local;
/* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (F). */
if (info_local->is_c2c1_01) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_FAHRENHEIT;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_FAHRENHEIT;
}
/* User-defined FS9721_LP3 flag 'c2c1_10' means temperature (C). */
if (info_local->is_c2c1_10) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
}
-SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog_old *analog, void *info)
+SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog *analog, void *info)
{
struct fs9721_info *info_local;
/* User-defined FS9721_LP3 flag 'c2c1_00' means MAX. */
if (info_local->is_c2c1_00)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
/* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (C). */
if (info_local->is_c2c1_01) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
/* User-defined FS9721_LP3 flag 'c2c1_11' means MIN. */
if (info_local->is_c2c1_11)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
}
/* Byte 13: Always '\n' (newline, 0x0a, 10) */
}
-static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
+static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
const struct fs9922_info *info)
{
/* Factors */
/* Measurement modes */
if (info->is_volt || info->is_diode) {
/* Note: In "diode mode" both is_diode and is_volt are set. */
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_ampere) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (info->is_ohm) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (info->is_hfe) {
- analog->mq = SR_MQ_GAIN;
- analog->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mq = SR_MQ_GAIN;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
}
if (info->is_hertz) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_farad) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (info->is_celsius) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
if (info->is_fahrenheit) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_FAHRENHEIT;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_FAHRENHEIT;
}
if (info->is_beep) {
- analog->mq = SR_MQ_CONTINUITY;
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->mq = SR_MQ_CONTINUITY;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
*floatval = (*floatval == INFINITY) ? 0.0 : 1.0;
}
if (info->is_percent) {
- analog->mq = SR_MQ_DUTY_CYCLE;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_DUTY_CYCLE;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
}
/* Measurement related flags */
if (info->is_ac)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (info->is_dc)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (info->is_auto)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (info->is_diode)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
if (info->is_hold)
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (info->is_max)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
if (info->is_min)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
if (info->is_rel)
- analog->mqflags |= SR_MQFLAG_RELATIVE;
+ analog->meaning->mqflags |= SR_MQFLAG_RELATIVE;
/* Other flags */
if (info->is_apo)
* @param buf Buffer containing the protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will contain the
* result value upon parsing success. Must not be NULL.
- * @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
+ * @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct fs9922_info. The struct will be filled
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
int ret;
struct fs9922_info *info_local;
return SR_OK;
}
-SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog_old *analog, void *info)
+SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog *analog, void *info)
{
struct fs9922_info *info_local;
/* User-defined z1 flag means "diode mode". */
if (info_local->is_z1) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
}
}
}
SR_PRIV int sr_m2110_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
float val;
(void)info;
/* We don't know the unit, so that's the best we can do. */
- analog->mq = SR_MQ_GAIN;
- analog->unit = SR_UNIT_UNITLESS;
- analog->mqflags = 0;
+ analog->meaning->mq = SR_MQ_GAIN;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mqflags = 0;
if (!strncmp((const char *)buf, "OVERRNG", 7))
*floatval = INFINITY;
/* Byte 13: Always '\r' (carriage return, 0x0d, 13) */
}
-static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
+static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
const struct metex14_info *info)
{
/* Factors */
/* Measurement modes */
if (info->is_volt) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_ampere) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (info->is_ohm) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (info->is_hertz) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_farad) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (info->is_celsius) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
if (info->is_diode) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_gain) {
- analog->mq = SR_MQ_GAIN;
- analog->unit = SR_UNIT_DECIBEL_VOLT;
+ analog->meaning->mq = SR_MQ_GAIN;
+ analog->meaning->unit = SR_UNIT_DECIBEL_VOLT;
}
if (info->is_hfe) {
- analog->mq = SR_MQ_GAIN;
- analog->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mq = SR_MQ_GAIN;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
}
if (info->is_logic) {
- analog->mq = SR_MQ_GAIN;
- analog->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mq = SR_MQ_GAIN;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
}
/* Measurement related flags */
if (info->is_ac)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (info->is_dc)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (info->is_diode)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
}
static gboolean flags_valid(const struct metex14_info *info)
* @param buf Buffer containing the protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will be modified
* in-place depending on the protocol packet. Must not be NULL.
- * @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
+ * @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct metex14_info. The struct will be filled
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_metex14_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
int ret;
struct metex14_info *info_local;
}
SR_PRIV int sr_rs9lcd_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
const struct rs9lcd_packet *rs_packet = (void *)buf;
double rawval;
switch (rs_packet->mode) {
case MODE_DC_V:
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
break;
case MODE_AC_V:
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
break;
case MODE_DC_UA: /* Fall through */
case MODE_DC_MA: /* Fall through */
case MODE_DC_A:
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
break;
case MODE_AC_UA: /* Fall through */
case MODE_AC_MA: /* Fall through */
case MODE_AC_A:
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
break;
case MODE_OHM:
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
break;
case MODE_FARAD:
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
break;
case MODE_CONT:
- analog->mq = SR_MQ_CONTINUITY;
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->mq = SR_MQ_CONTINUITY;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
rawval = is_shortcirc(rs_packet);
break;
case MODE_DIODE:
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
- analog->mqflags |= SR_MQFLAG_DIODE | SR_MQFLAG_DC;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE | SR_MQFLAG_DC;
break;
case MODE_HZ: /* Fall through */
case MODE_VOLT_HZ: /* Fall through */
case MODE_AMP_HZ:
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
break;
case MODE_LOGIC:
/*
* No matter whether or not we have an actual voltage reading,
* we are measuring voltage, so we set our MQ as VOLTAGE.
*/
- analog->mq = SR_MQ_VOLTAGE;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
if (!isnan(rawval)) {
/* We have an actual voltage. */
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->unit = SR_UNIT_VOLT;
} else {
/* We have either HI or LOW. */
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
rawval = is_logic_high(rs_packet);
}
break;
case MODE_HFE:
- analog->mq = SR_MQ_GAIN;
- analog->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mq = SR_MQ_GAIN;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
break;
case MODE_DUTY: /* Fall through */
case MODE_VOLT_DUTY: /* Fall through */
case MODE_AMP_DUTY:
- analog->mq = SR_MQ_DUTY_CYCLE;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_DUTY_CYCLE;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
break;
case MODE_WIDTH: /* Fall through */
case MODE_VOLT_WIDTH: /* Fall through */
case MODE_AMP_WIDTH:
- analog->mq = SR_MQ_PULSE_WIDTH;
- analog->unit = SR_UNIT_SECOND;
+ analog->meaning->mq = SR_MQ_PULSE_WIDTH;
+ analog->meaning->unit = SR_UNIT_SECOND;
break;
case MODE_TEMP:
- analog->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
/* We need to reparse. */
rawval = lcd_to_double(rs_packet, READ_TEMP);
- analog->unit = is_celsius(rs_packet) ?
+ analog->meaning->unit = is_celsius(rs_packet) ?
SR_UNIT_CELSIUS : SR_UNIT_FAHRENHEIT;
break;
case MODE_DBM:
- analog->mq = SR_MQ_POWER;
- analog->unit = SR_UNIT_DECIBEL_MW;
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mq = SR_MQ_POWER;
+ analog->meaning->unit = SR_UNIT_DECIBEL_MW;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
break;
default:
sr_dbg("Unknown mode: %d.", rs_packet->mode);
}
if (rs_packet->info & INFO_HOLD)
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (rs_packet->digit4 & DIG4_MAX)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
if (rs_packet->indicatrix2 & IND2_MIN)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
if (rs_packet->info & INFO_AUTO)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
*floatval = rawval;
return SR_OK;
}
SR_PRIV int sr_ut372_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
unsigned int i, j, value, divisor;
uint8_t segments, flags1, flags2;
flags2 = decode_pair(buf + 23);
if (flags2 & FLAGS2_RPM_MASK) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_REVOLUTIONS_PER_MINUTE;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_REVOLUTIONS_PER_MINUTE;
} else if (flags2 & FLAGS2_COUNT_MASK) {
- analog->mq = SR_MQ_COUNT;
- analog->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mq = SR_MQ_COUNT;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
}
if (flags1 & FLAGS1_HOLD_MASK)
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (flags2 & FLAGS2_MIN_MASK)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
if (flags2 & FLAGS2_MAX_MASK)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
if (flags2 & FLAGS2_AVG_MASK)
- analog->mqflags |= SR_MQFLAG_AVG;
+ analog->meaning->mqflags |= SR_MQFLAG_AVG;
value = 0;
divisor = 1;
}
}
-static void handle_flags(struct sr_datafeed_analog_old *analog,
+static void handle_flags(struct sr_datafeed_analog *analog,
float *floatval, const struct ut71x_info *info)
{
/* Measurement modes */
if (info->is_voltage) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_current) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (info->is_resistance) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (info->is_frequency) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_capacitance) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (info->is_temperature && info->is_celsius) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
}
if (info->is_temperature && info->is_fahrenheit) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_FAHRENHEIT;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_FAHRENHEIT;
}
if (info->is_continuity) {
- analog->mq = SR_MQ_CONTINUITY;
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->mq = SR_MQ_CONTINUITY;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
*floatval = (*floatval < 0.0 || *floatval > 60.0) ? 0.0 : 1.0;
}
if (info->is_diode) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_duty_cycle) {
- analog->mq = SR_MQ_DUTY_CYCLE;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_DUTY_CYCLE;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
}
if (info->is_power) {
- analog->mq = SR_MQ_POWER;
- analog->unit = SR_UNIT_WATT;
+ analog->meaning->mq = SR_MQ_POWER;
+ analog->meaning->unit = SR_UNIT_WATT;
}
if (info->is_loop_current) {
/* 4mA = 0%, 20mA = 100% */
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
}
/* Measurement related flags */
if (info->is_ac)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (info->is_dc)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (info->is_ac)
/* All AC modes do True-RMS measurements. */
- analog->mqflags |= SR_MQFLAG_RMS;
+ analog->meaning->mqflags |= SR_MQFLAG_RMS;
if (info->is_auto)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (info->is_diode)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
}
static gboolean flags_valid(const struct ut71x_info *info)
}
SR_PRIV int sr_ut71x_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
int ret;
struct ut71x_info *info_local;
info->is_auto = !info->is_manu;
}
-static void handle_flags(struct sr_datafeed_analog_old *analog,
+static void handle_flags(struct sr_datafeed_analog *analog,
float *floatval, const struct vc870_info *info)
{
/*
/* Measurement modes */
if (info->is_voltage) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_current) {
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_AMPERE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_AMPERE;
}
if (info->is_resistance) {
- analog->mq = SR_MQ_RESISTANCE;
- analog->unit = SR_UNIT_OHM;
+ analog->meaning->mq = SR_MQ_RESISTANCE;
+ analog->meaning->unit = SR_UNIT_OHM;
}
if (info->is_frequency) {
- analog->mq = SR_MQ_FREQUENCY;
- analog->unit = SR_UNIT_HERTZ;
+ analog->meaning->mq = SR_MQ_FREQUENCY;
+ analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_capacitance) {
- analog->mq = SR_MQ_CAPACITANCE;
- analog->unit = SR_UNIT_FARAD;
+ analog->meaning->mq = SR_MQ_CAPACITANCE;
+ analog->meaning->unit = SR_UNIT_FARAD;
}
if (info->is_temperature) {
- analog->mq = SR_MQ_TEMPERATURE;
- analog->unit = SR_UNIT_CELSIUS;
+ analog->meaning->mq = SR_MQ_TEMPERATURE;
+ analog->meaning->unit = SR_UNIT_CELSIUS;
/* TODO: Handle Fahrenheit in auxiliary display. */
- // analog->unit = SR_UNIT_FAHRENHEIT;
+ // analog->meaning->unit = SR_UNIT_FAHRENHEIT;
}
if (info->is_continuity) {
- analog->mq = SR_MQ_CONTINUITY;
- analog->unit = SR_UNIT_BOOLEAN;
+ analog->meaning->mq = SR_MQ_CONTINUITY;
+ analog->meaning->unit = SR_UNIT_BOOLEAN;
/* Vendor docs: "< 20 Ohm acoustic" */
*floatval = (*floatval < 0.0 || *floatval > 20.0) ? 0.0 : 1.0;
}
if (info->is_diode) {
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
}
if (info->is_loop_current) {
/* 4mA = 0%, 20mA = 100% */
- analog->mq = SR_MQ_CURRENT;
- analog->unit = SR_UNIT_PERCENTAGE;
+ analog->meaning->mq = SR_MQ_CURRENT;
+ analog->meaning->unit = SR_UNIT_PERCENTAGE;
}
if (info->is_power) {
- analog->mq = SR_MQ_POWER;
- analog->unit = SR_UNIT_WATT;
+ analog->meaning->mq = SR_MQ_POWER;
+ analog->meaning->unit = SR_UNIT_WATT;
}
if (info->is_power_apparent_power) {
- analog->mq = SR_MQ_POWER;
- analog->unit = SR_UNIT_WATT;
+ analog->meaning->mq = SR_MQ_POWER;
+ analog->meaning->unit = SR_UNIT_WATT;
/* TODO: Handle apparent power. */
- // analog->mq = SR_MQ_APPARENT_POWER;
- // analog->unit = SR_UNIT_VOLT_AMPERE;
+ // analog->meaning->mq = SR_MQ_APPARENT_POWER;
+ // analog->meaning->unit = SR_UNIT_VOLT_AMPERE;
}
if (info->is_power_factor_freq) {
- analog->mq = SR_MQ_POWER_FACTOR;
- analog->unit = SR_UNIT_UNITLESS;
+ analog->meaning->mq = SR_MQ_POWER_FACTOR;
+ analog->meaning->unit = SR_UNIT_UNITLESS;
/* TODO: Handle frequency. */
- // analog->mq = SR_MQ_FREQUENCY;
- // analog->unit = SR_UNIT_HERTZ;
+ // analog->meaning->mq = SR_MQ_FREQUENCY;
+ // analog->meaning->unit = SR_UNIT_HERTZ;
}
if (info->is_v_a_rms_value) {
- analog->mqflags |= SR_MQFLAG_RMS;
- analog->mq = SR_MQ_VOLTAGE;
- analog->unit = SR_UNIT_VOLT;
+ analog->meaning->mqflags |= SR_MQFLAG_RMS;
+ analog->meaning->mq = SR_MQ_VOLTAGE;
+ analog->meaning->unit = SR_UNIT_VOLT;
/* TODO: Handle effective current value */
- // analog->mq = SR_MQ_CURRENT;
- // analog->unit = SR_UNIT_AMPERE;
+ // analog->meaning->mq = SR_MQ_CURRENT;
+ // analog->meaning->unit = SR_UNIT_AMPERE;
}
/* Measurement related flags */
if (info->is_ac)
- analog->mqflags |= SR_MQFLAG_AC;
+ analog->meaning->mqflags |= SR_MQFLAG_AC;
if (info->is_dc)
- analog->mqflags |= SR_MQFLAG_DC;
+ analog->meaning->mqflags |= SR_MQFLAG_DC;
if (info->is_auto)
- analog->mqflags |= SR_MQFLAG_AUTORANGE;
+ analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (info->is_diode)
- analog->mqflags |= SR_MQFLAG_DIODE;
+ analog->meaning->mqflags |= SR_MQFLAG_DIODE;
if (info->is_hold)
/*
* Note: HOLD only affects the number displayed on the LCD,
* but not the value sent via the protocol! It also does not
* affect the bargraph on the LCD.
*/
- analog->mqflags |= SR_MQFLAG_HOLD;
+ analog->meaning->mqflags |= SR_MQFLAG_HOLD;
if (info->is_max)
- analog->mqflags |= SR_MQFLAG_MAX;
+ analog->meaning->mqflags |= SR_MQFLAG_MAX;
if (info->is_min)
- analog->mqflags |= SR_MQFLAG_MIN;
+ analog->meaning->mqflags |= SR_MQFLAG_MIN;
if (info->is_rel)
- analog->mqflags |= SR_MQFLAG_RELATIVE;
+ analog->meaning->mqflags |= SR_MQFLAG_RELATIVE;
/* Other flags */
if (info->is_batt)
}
SR_PRIV int sr_vc870_parse(const uint8_t *buf, float *floatval,
- struct sr_datafeed_analog_old *analog, void *info)
+ struct sr_datafeed_analog *analog, void *info)
{
int ret;
struct vc870_info *info_local;