- Merged with upstream version
[rtl-433.git] / src / devices / silvercrest.c
1 #include "rtl_433.h"
2
3 static int silvercrest_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) {
4     /* FIXME validate the received message better */
5     if (bb[1][0] == 0xF8 &&
6         bb[2][0] == 0xF8 &&
7         bb[3][0] == 0xF8 &&
8         bb[4][0] == 0xF8 &&
9         bb[1][1] == 0x4d &&
10         bb[2][1] == 0x4d &&
11         bb[3][1] == 0x4d &&
12         bb[4][1] == 0x4d) {
13         /* Pretty sure this is a Silvercrest remote */
14         fprintf(stdout, "BUTTON:TYPE=SILVERCREST,");
15         fprintf(stdout, "MESSAGE=%02x%02x%02x%02x%02x\n",bb[1][0],bb[0][1],bb[0][2],bb[0][3],bb[0][4]);
16
17         if (debug_output)
18             debug_callback(bb, bits_per_row);
19
20         return 1;
21     }
22     return 0;
23 }
24
25 r_device silvercrest = {
26     /* .id             = */ 3,
27     /* .name           = */ "Silvercrest Remote Control",
28     /* .modulation     = */ OOK_PWM_P,
29     /* .short_limit    = */ 600/4,
30     /* .long_limit     = */ 5000/4,
31     /* .reset_limit    = */ 15000/4,
32     /* .json_callback  = */ &silvercrest_callback,
33 };