- 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(stderr, "Remote button event:\n");
15         fprintf(stderr, "model = Silvercrest, %d bits\n",bits_per_row[1]);
16         fprintf(stderr, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[0][1],bb[0][2],bb[0][3],bb[0][4]);
17
18         if (debug_output)
19             debug_callback(bb, bits_per_row);
20
21         return 1;
22     }
23     return 0;
24 }
25
26 r_device silvercrest = {
27     /* .id             = */ 3,
28     /* .name           = */ "Silvercrest Remote Control",
29     /* .modulation     = */ OOK_PWM_P,
30     /* .short_limit    = */ 600/4,
31     /* .long_limit     = */ 5000/4,
32     /* .reset_limit    = */ 15000/4,
33     /* .json_callback  = */ &silvercrest_callback,
34 };