]> sigrok.org Git - libsigrok.git/commitdiff
dmm: Convert to SR_DF_ANALOG.
authorUwe Hermann <redacted>
Sat, 28 May 2016 15:33:30 +0000 (17:33 +0200)
committerUwe Hermann <redacted>
Thu, 16 Jun 2016 13:05:00 +0000 (15:05 +0200)
src/dmm/bm25x.c
src/dmm/dtm0660.c
src/dmm/es519xx.c
src/dmm/fs9721.c
src/dmm/fs9922.c
src/dmm/m2110.c
src/dmm/metex14.c
src/dmm/rs9lcd.c
src/dmm/ut372.c
src/dmm/ut71x.c
src/dmm/vc870.c

index e7aa45a1211be1996c3fda5ba68f332b432da675..d7468f49bfd300a5dd303da470bdad42810bec64 100644 (file)
@@ -147,61 +147,61 @@ special:
 }
 
 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);
index 794650af1c334077bbdfbcf717134fd31f35d205..be3afe23b2852476b0d97802c22f020718746df1 100644 (file)
@@ -248,7 +248,7 @@ static void parse_flags(const uint8_t *buf, struct dtm0660_info *info)
        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 */
@@ -265,64 +265,64 @@ static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
 
        /* 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)
@@ -354,7 +354,7 @@ SR_PRIV gboolean sr_dtm0660_packet_valid(const uint8_t *buf)
  * @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
@@ -364,7 +364,7 @@ SR_PRIV gboolean sr_dtm0660_packet_valid(const uint8_t *buf)
  *         '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;
index 69d81752b1749257407e08aa2a15bfb99a2fa10f..5b1a49e340194c51064e0717d78a809d30fdccb0 100644 (file)
@@ -444,7 +444,7 @@ static void parse_flags(const uint8_t *buf, struct es519xx_info *info)
        }
 }
 
-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)
 {
        /*
@@ -454,73 +454,73 @@ static void handle_flags(struct sr_datafeed_analog_old *analog,
 
        /* 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)
@@ -604,7 +604,7 @@ static gboolean sr_es519xx_packet_valid(const uint8_t *buf,
 }
 
 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;
@@ -640,7 +640,7 @@ SR_PRIV gboolean sr_es519xx_2400_11b_packet_valid(const uint8_t *buf)
 }
 
 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;
 
@@ -669,7 +669,7 @@ SR_PRIV gboolean sr_es519xx_2400_11b_altfn_packet_valid(const uint8_t *buf)
 }
 
 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;
 
@@ -699,7 +699,7 @@ SR_PRIV gboolean sr_es519xx_19200_11b_5digits_packet_valid(const uint8_t *buf)
 }
 
 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;
 
@@ -729,7 +729,7 @@ SR_PRIV gboolean sr_es519xx_19200_11b_clamp_packet_valid(const uint8_t *buf)
 }
 
 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;
 
@@ -758,7 +758,7 @@ SR_PRIV gboolean sr_es519xx_19200_11b_packet_valid(const uint8_t *buf)
 }
 
 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;
 
@@ -786,7 +786,7 @@ SR_PRIV gboolean sr_es519xx_19200_14b_packet_valid(const uint8_t *buf)
 }
 
 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;
 
@@ -815,7 +815,7 @@ SR_PRIV gboolean sr_es519xx_19200_14b_sel_lpf_packet_valid(const uint8_t *buf)
 }
 
 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;
 
index 3c98102191a0d45a918599b7656f8759a2c5ff31..eaf5b477518de3f0fc10dd02623620556f639f25 100644 (file)
@@ -243,7 +243,7 @@ static void parse_flags(const uint8_t *buf, struct fs9721_info *info)
        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 */
@@ -260,52 +260,52 @@ static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
 
        /* 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)
@@ -337,7 +337,7 @@ SR_PRIV gboolean sr_fs9721_packet_valid(const uint8_t *buf)
  * @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
@@ -347,7 +347,7 @@ SR_PRIV gboolean sr_fs9721_packet_valid(const uint8_t *buf)
  *         '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;
@@ -365,7 +365,7 @@ SR_PRIV int sr_fs9721_parse(const uint8_t *buf, float *floatval,
        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;
 
@@ -373,12 +373,12 @@ SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog_old *analog, void *in
 
        /* 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;
 
@@ -386,12 +386,12 @@ SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog_old *analog, void *in
 
        /* 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;
 
@@ -399,12 +399,12 @@ SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog_old *analog, void *in
 
        /* 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;
 
@@ -412,18 +412,18 @@ SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog_old *analog, voi
 
        /* 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;
 
@@ -431,16 +431,16 @@ SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog_old *analog, void *in
 
        /* 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;
 
 }
index 5325e6dd50478874c30cb910d5e29f0c798714e5..9f850c3f36d014dcda06bf93b4d20a6a3fcbf39f 100644 (file)
@@ -223,7 +223,7 @@ static void parse_flags(const uint8_t *buf, struct fs9922_info *info)
        /* 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 */
@@ -241,64 +241,64 @@ static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
        /* 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)
@@ -344,7 +344,7 @@ SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf)
  * @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
@@ -354,7 +354,7 @@ SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf)
  *         '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;
@@ -372,7 +372,7 @@ SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
        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;
 
@@ -380,8 +380,8 @@ SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog_old *analog, void *inf
 
        /* 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;
        }
 }
index ea53fae5e738aee2d7a1dc32a0a546d2e08eeee0..93887dcc804b1b6863d5eadfef14c3fdf9d1468c 100644 (file)
@@ -51,16 +51,16 @@ SR_PRIV gboolean sr_m2110_packet_valid(const uint8_t *buf)
 }
 
 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;
index b39c9324c21b12f566d82cf5f7356ecd3e8a34db..a6e2a317369170ecfd7a912bc9122f453e42bf68 100644 (file)
@@ -170,7 +170,7 @@ static void parse_flags(const char *buf, struct metex14_info *info)
        /* 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 */
@@ -189,53 +189,53 @@ static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
 
        /* 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)
@@ -311,7 +311,7 @@ SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf)
  * @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
@@ -321,7 +321,7 @@ SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf)
  *         '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;
index d337d7f7200ebf0711eccfaee8fc399406531623..664befe311904130f38c1878ca04a3c943378ad7 100644 (file)
@@ -318,7 +318,7 @@ static gboolean is_logic_high(const struct rs9lcd_packet *rs_packet)
 }
 
 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;
@@ -329,95 +329,95 @@ SR_PRIV int sr_rs9lcd_parse(const uint8_t *buf, float *floatval,
 
        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);
@@ -425,13 +425,13 @@ SR_PRIV int sr_rs9lcd_parse(const uint8_t *buf, float *floatval,
        }
 
        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;
index 74f8757555c15abbe5a2d55ba2886950d7a419b6..41d5a62b95f3f8602d58e4c56df1ea750faacdde 100644 (file)
@@ -88,7 +88,7 @@ SR_PRIV gboolean sr_ut372_packet_valid(const uint8_t *buf)
 }
 
 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;
@@ -99,21 +99,21 @@ SR_PRIV int sr_ut372_parse(const uint8_t *buf, float *floatval,
        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;
index 9af8fc12c22abb139a0bae5784b0813c459ebca6..46a31dbe95f80aef7796c774e233f6a942d85261 100644 (file)
@@ -212,73 +212,73 @@ static void parse_flags(const uint8_t *buf, struct ut71x_info *info)
        }
 }
 
-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)
@@ -325,7 +325,7 @@ SR_PRIV gboolean sr_ut71x_packet_valid(const uint8_t *buf)
 }
 
 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;
index 2663260bc48ca9464d0fe23928446156d33214e3..dea94a2d434f125b7f594d78fb4fb877dcd5eebf 100644 (file)
@@ -282,7 +282,7 @@ static void parse_flags(const uint8_t *buf, struct vc870_info *info)
        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)
 {
        /*
@@ -292,95 +292,95 @@ static void handle_flags(struct sr_datafeed_analog_old *analog,
 
        /* 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)
@@ -412,7 +412,7 @@ SR_PRIV gboolean sr_vc870_packet_valid(const uint8_t *buf)
 }
 
 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;