#include "rtl_433.h" static int waveman_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) { /* Two bits map to 2 states, 0 1 -> 0 and 1 1 -> 1 */ int i; uint8_t nb[3] = {0}; if (((bb[0][0]&0x55)==0x55) && ((bb[0][1]&0x55)==0x55) && ((bb[0][2]&0x55)==0x55) && ((bb[0][3]&0x55)==0x00)) { for (i=0 ; i<3 ; i++) { nb[i] |= ((bb[0][i]&0xC0)==0xC0) ? 0x00 : 0x01; nb[i] |= ((bb[0][i]&0x30)==0x30) ? 0x00 : 0x02; nb[i] |= ((bb[0][i]&0x0C)==0x0C) ? 0x00 : 0x04; nb[i] |= ((bb[0][i]&0x03)==0x03) ? 0x00 : 0x08; } fprintf(stderr, "Remote button event:\n"); fprintf(stderr, "model = Waveman Switch Transmitter, %d bits\n",bits_per_row[1]); fprintf(stderr, "id = %c\n", 'A'+nb[0]); fprintf(stderr, "channel = %d\n", (nb[1]>>2)+1); fprintf(stderr, "button = %d\n", (nb[1]&3)+1); fprintf(stderr, "state = %s\n", (nb[2]==0xe) ? "on" : "off"); fprintf(stderr, "%02x %02x %02x\n",nb[0],nb[1],nb[2]); if (debug_output) debug_callback(bb, bits_per_row); return 1; } return 0; } r_device waveman = { /* .id = */ 6, /* .name = */ "Waveman Switch Transmitter", /* .modulation = */ OOK_PWM_P, /* .short_limit = */ 1000/4, /* .long_limit = */ 8000/4, /* .reset_limit = */ 30000/4, /* .json_callback = */ &waveman_callback, };