* It does _not_ work for all Metex DMMs, some use a quite different protocol.
*/
+#include <config.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
/* 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;
/* 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 */
/* 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 */
* @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
* '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;