343326e910268eaea1897dde086918f3e3191ad1
[rtl-433.git] / src / devices / steffen.c
1 #include "rtl_433.h"
2
3 static int steffen_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) {
4
5     if (bb[0][0]==0x00 && ((bb[1][0]&0x07)==0x07) && bb[1][0]==bb[2][0] && bb[2][0]==bb[3][0]) {
6
7         fprintf(stderr, "BUTTON:TYPE=STEFFAN,");
8         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);
9
10         if ((bb[1][2]&0x0f)==0x0e)
11             fprintf(stdout, "PRESSED=A,");
12         else if ((bb[1][2]&0x0f)==0x0d)
13             fprintf(stdout, "PRESSED=B,");
14         else if ((bb[1][2]&0x0f)==0x0b)
15             fprintf(stdout, "PRESSED=C,");
16         else if ((bb[1][2]&0x0f)==0x07)
17             fprintf(stdout, "PRESSED=D,");
18         else if ((bb[1][2]&0x0f)==0x0f)
19             fprintf(stdout, "PRESSED=ALL,");
20         else
21             fprintf(stdout, "PRESSED=UNKNOWN,");
22
23         if ((bb[1][2]&0xf0)==0xf0) {
24             fprintf(stdout, "STATE=OFF\n");
25         } else {
26             fprintf(stdout, "STATE=ON\n");
27         }
28
29         if (debug_output)
30             debug_callback(bb, bits_per_row);
31
32         return 1;
33     }
34     return 0;
35 }
36
37 r_device steffen = {
38     /* .id             = */ 9,
39     /* .name           = */ "Steffen Switch Transmitter",
40     /* .modulation     = */ OOK_PWM_D,
41     /* .short_limit    = */ 140,
42     /* .long_limit     = */ 270,
43     /* .reset_limit    = */ 1500,
44     /* .json_callback  = */ &steffen_callback,
45 };