- g_print("%s ev %02x hd 0x%04x value: ", tstr, pdu[0], handle);
- for (i = 3; i < len; i++)
- g_print("%02x ", pdu[i]);
- g_print("\n");
+ which = pdu[3];
+ if ((pdu[0] == 0x1b) && (handle == 0x0012) && (len == 9) &&
+ ((which == 1) || (which == 2))) {
+ uint32_t val = bt_get_le32(&pdu[5]);
+ g_debug("store: \"%hhu,%u\"\n", which, val);
+ if (dbstore(which, val))
+ g_warning("error storing \"%hhu,%u\"\n", which, val);
+ } else {
+ time_t t;
+ int i;
+ struct tm tm;
+ char buf[64];
+ char tstr[64];
+
+ t = time(NULL);
+ (void)gmtime_r(&t, &tm);
+ (void)strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S", &tm);
+ for (i = 3; (i < len) && ((i-3) < (sizeof(buf)/3)); i++)
+ sprintf(buf+strlen(buf), " %02x ", pdu[i]);
+ g_warning("%s ev %02x hd 0x%04x value: %s",
+ tstr, pdu[0], handle, buf);
+ }