-/* Message logging helpers with subsystem-specific prefix string. */
-#define LOG_PREFIX "gmc-mh-1x-2x: "
-#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
-#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
-#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
-#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
-#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
-#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
+#define LOG_PREFIX "gmc-mh-1x-2x"
+
+#define GMC_BUFSIZE 266
+
+/** Message ID bits 4, 5 */
+#define MSGID_MASK 0x30 /**< Mask to get message ID bits */
+#define MSGID_INF 0x00 /**< Start of message with device info */
+#define MSGID_D10 0x10 /**< Start of data message, non-displayed intermediate */
+#define MSGID_DTA 0x20 /**< Start of data message, displayed, averaged */
+#define MSGID_DATA 0x30 /**< Data byte in message */
+
+#define MSGC_MASK 0x0f /**< Mask to get message byte contents in send mode */
+
+#define MSGSRC_MASK 0xc0 /**< Mask to get bits related to message source */
+
+#define bc(x) (x & MSGC_MASK) /**< Get contents from a byte */
+
+#define MASK_6BITS 0x3f /**< Mask lower six bits. */
+
+/**
+ * Internal multimeter model codes. In opposite to the multimeter models from
+ * protocol (see decode_model()), these codes allow working with ranges.
+ */
+enum model {
+ METRAHIT_NONE = 0, /**< Value for uninitialized variable */
+ METRAHIT_12S = 12,
+ METRAHIT_13S14A = 13,
+ METRAHIT_14S = 14,
+ METRAHIT_15S = 15,
+ METRAHIT_16S = 16,
+ METRAHIT_16I = 17,
+ METRAHIT_16X = METRAHIT_16I, /**< All Metrahit 16 */
+ /* A Metrahit 17 exists, but seems not to have an IR interface. */
+ METRAHIT_18S = 18,
+ METRAHIT_2X = 20, /**< For model type comparisons */
+ METRAHIT_22SM = METRAHIT_2X + 1, /**< Send mode */
+ METRAHIT_22S = METRAHIT_22SM + 1, /**< Bidi mode */
+ METRAHIT_22M = METRAHIT_22S + 1, /**< Bidi mode */
+ METRAHIT_23S = METRAHIT_22M + 1,
+ METRAHIT_24S = METRAHIT_23S + 1,
+ METRAHIT_25S = METRAHIT_24S + 1,
+ METRAHIT_26SM = METRAHIT_25S + 1, /**< Send mode */
+ METRAHIT_26S = METRAHIT_26SM + 1, /**< Bidi mode */
+ METRAHIT_26M = METRAHIT_26S + 1, /**< Bidi mode */
+ METRAHIT_28S = METRAHIT_26M + 1,
+ METRAHIT_29S = METRAHIT_28S + 1,
+};