- Merged with upstream version
[rtl-433.git] / src / devices / steffen.c
diff --git a/src/devices/steffen.c b/src/devices/steffen.c
new file mode 100644 (file)
index 0000000..343326e
--- /dev/null
@@ -0,0 +1,45 @@
+#include "rtl_433.h"
+
+static int steffen_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) {
+
+    if (bb[0][0]==0x00 && ((bb[1][0]&0x07)==0x07) && bb[1][0]==bb[2][0] && bb[2][0]==bb[3][0]) {
+
+        fprintf(stderr, "BUTTON:TYPE=STEFFAN,");
+       fprintf(stderr, "CODE=%d%d%d%d%d,", (bb[1][0]&0x80)>>7, (bb[1][0]&0x40)>>6, (bb[1][0]&0x20)>>5, (bb[1][0]&0x10)>>4, (bb[1][0]&0x08)>>3);
+
+       if ((bb[1][2]&0x0f)==0x0e)
+            fprintf(stdout, "PRESSED=A,");
+        else if ((bb[1][2]&0x0f)==0x0d)
+            fprintf(stdout, "PRESSED=B,");
+        else if ((bb[1][2]&0x0f)==0x0b)
+            fprintf(stdout, "PRESSED=C,");
+        else if ((bb[1][2]&0x0f)==0x07)
+            fprintf(stdout, "PRESSED=D,");
+        else if ((bb[1][2]&0x0f)==0x0f)
+            fprintf(stdout, "PRESSED=ALL,");
+       else
+           fprintf(stdout, "PRESSED=UNKNOWN,");
+
+       if ((bb[1][2]&0xf0)==0xf0) {
+            fprintf(stdout, "STATE=OFF\n");
+       } else {
+            fprintf(stdout, "STATE=ON\n");
+        }
+
+        if (debug_output)
+            debug_callback(bb, bits_per_row);
+
+        return 1;
+    }
+    return 0;
+}
+
+r_device steffen = {
+    /* .id             = */ 9,
+    /* .name           = */ "Steffen Switch Transmitter",
+    /* .modulation     = */ OOK_PWM_D,
+    /* .short_limit    = */ 140,
+    /* .long_limit     = */ 270,
+    /* .reset_limit    = */ 1500,
+    /* .json_callback  = */ &steffen_callback,
+};