X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdmm%2Fmetex14.c;h=b39c9324c21b12f566d82cf5f7356ecd3e8a34db;hb=5faebab2903dc91949edc31f0a4b118d86090a30;hp=90278ffd21646e8eee5e4d833a58f10f2975a060;hpb=c1aae90038456a61d0f9313d34e6107c3440d3e7;p=libsigrok.git diff --git a/src/dmm/metex14.c b/src/dmm/metex14.c index 90278ffd..b39c9324 100644 --- a/src/dmm/metex14.c +++ b/src/dmm/metex14.c @@ -30,6 +30,7 @@ * It does _not_ work for all Metex DMMs, some use a quite different protocol. */ +#include #include #include #include @@ -56,14 +57,14 @@ static int parse_value(const uint8_t *buf, struct metex14_info *info, /* Bytes 5-7: Over limit (various forms) */ is_ol = 0; - is_ol += (!strcasecmp((const char *)&valstr, ".OL")) ? 1 : 0; - is_ol += (!strcasecmp((const char *)&valstr, "O.L")) ? 1 : 0; - is_ol += (!strcasecmp((const char *)&valstr, "OL.")) ? 1 : 0; - is_ol += (!strcasecmp((const char *)&valstr, "OL")) ? 1 : 0; - is_ol += (!strcasecmp((const char *)&valstr, "-.OL")) ? 1 : 0; - is_ol += (!strcasecmp((const char *)&valstr, "-O.L")) ? 1 : 0; - is_ol += (!strcasecmp((const char *)&valstr, "-OL.")) ? 1 : 0; - is_ol += (!strcasecmp((const char *)&valstr, "-OL")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, ".OL")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, "O.L")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, "OL.")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, "OL")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, "-.OL")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, "-O.L")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, "-OL.")) ? 1 : 0; + is_ol += (!g_ascii_strcasecmp((const char *)&valstr, "-OL")) ? 1 : 0; if (is_ol != 0) { sr_spew("Over limit."); *result = INFINITY; @@ -114,35 +115,35 @@ static void parse_flags(const char *buf, struct metex14_info *info) /* Bytes 9-12: Unit */ u = (const char *)&unit; - if (!strcasecmp(u, "A")) + if (!g_ascii_strcasecmp(u, "A")) info->is_ampere = TRUE; - else if (!strcasecmp(u, "mA")) + else if (!g_ascii_strcasecmp(u, "mA")) info->is_milli = info->is_ampere = TRUE; - else if (!strcasecmp(u, "uA")) + else if (!g_ascii_strcasecmp(u, "uA")) info->is_micro = info->is_ampere = TRUE; - else if (!strcasecmp(u, "V")) + else if (!g_ascii_strcasecmp(u, "V")) info->is_volt = TRUE; - else if (!strcasecmp(u, "mV")) + else if (!g_ascii_strcasecmp(u, "mV")) info->is_milli = info->is_volt = TRUE; - else if (!strcasecmp(u, "Ohm")) + else if (!g_ascii_strcasecmp(u, "Ohm")) info->is_ohm = TRUE; - else if (!strcasecmp(u, "KOhm")) + else if (!g_ascii_strcasecmp(u, "KOhm")) info->is_kilo = info->is_ohm = TRUE; - else if (!strcasecmp(u, "MOhm")) + else if (!g_ascii_strcasecmp(u, "MOhm")) info->is_mega = info->is_ohm = TRUE; - else if (!strcasecmp(u, "pF")) + else if (!g_ascii_strcasecmp(u, "pF")) info->is_pico = info->is_farad = TRUE; - else if (!strcasecmp(u, "nF")) + else if (!g_ascii_strcasecmp(u, "nF")) info->is_nano = info->is_farad = TRUE; - else if (!strcasecmp(u, "uF")) + else if (!g_ascii_strcasecmp(u, "uF")) info->is_micro = info->is_farad = TRUE; - else if (!strcasecmp(u, "KHz")) + else if (!g_ascii_strcasecmp(u, "KHz")) info->is_kilo = info->is_hertz = TRUE; - else if (!strcasecmp(u, "C")) + else if (!g_ascii_strcasecmp(u, "C")) info->is_celsius = TRUE; - else if (!strcasecmp(u, "DB")) + else if (!g_ascii_strcasecmp(u, "DB")) info->is_decibel = TRUE; - else if (!strcasecmp(u, "")) + else if (!g_ascii_strcasecmp(u, "")) info->is_unitless = TRUE; /* Bytes 0-1: Measurement mode, except AC/DC */ @@ -169,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 *analog, float *floatval, +static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval, const struct metex14_info *info) { /* Factors */ @@ -310,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. The struct will be + * @param analog Pointer to a struct sr_datafeed_analog_old. 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 @@ -320,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 *analog, void *info) + struct sr_datafeed_analog_old *analog, void *info) { int ret; struct metex14_info *info_local;