Редизайн на основе текущей ветки мейнстрима + новые устройства.
[rtl-433.git] / src / devices / silvercrest.c
index 03fbe937e8b100dc46f4b822c8a99743705652da..72d2dba279075b1ae65c70e9183d84168bfccb8b 100644 (file)
@@ -1,6 +1,7 @@
 #include "rtl_433.h"
 
-static int silvercrest_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) {
+static int silvercrest_callback(bitbuffer_t *bitbuffer) {
+    bitrow_t *bb = bitbuffer->bb;
     /* FIXME validate the received message better */
     if (bb[1][0] == 0xF8 &&
         bb[2][0] == 0xF8 &&
@@ -11,11 +12,9 @@ static int silvercrest_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bit
         bb[3][1] == 0x4d &&
         bb[4][1] == 0x4d) {
         /* Pretty sure this is a Silvercrest remote */
-        fprintf(stdout, "BUTTON:TYPE=SILVERCREST,");
-        fprintf(stdout, "MESSAGE=%02x%02x%02x%02x%02x\n",bb[1][0],bb[0][1],bb[0][2],bb[0][3],bb[0][4]);
-
-        if (debug_output)
-            debug_callback(bb, bits_per_row);
+        fprintf(stdout, "Remote button event:\n");
+        fprintf(stdout, "model = Silvercrest, %d bits\n",bitbuffer->bits_per_row[1]);
+        fprintf(stdout, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[0][1],bb[0][2],bb[0][3],bb[0][4]);
 
         return 1;
     }
@@ -23,11 +22,12 @@ static int silvercrest_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bit
 }
 
 r_device silvercrest = {
-    /* .id             = */ 3,
-    /* .name           = */ "Silvercrest Remote Control",
-    /* .modulation     = */ OOK_PWM_P,
-    /* .short_limit    = */ 600/4,
-    /* .long_limit     = */ 5000/4,
-    /* .reset_limit    = */ 15000/4,
-    /* .json_callback  = */ &silvercrest_callback,
+    .name           = "Silvercrest Remote Control",
+    .modulation     = OOK_PULSE_PWM_RAW,
+    .short_limit    = 600,
+    .long_limit     = 5000,
+    .reset_limit    = 15000,
+    .json_callback  = &silvercrest_callback,
+    .disabled       = 1,
+    .demod_arg      = 1,       // Remove startbit
 };