#include "rtl_433.h" int leak_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) { int i,j,k; int rows_used[BITBUF_ROWS]; int col_max = 0; int row_cnt = 0; // determine what part of bb[][] has non-zero data to avoid // outputting lots of empty rows for (i=0 ; i 0 ; j--) { if (bb[i][j] != 0) break; } if (j != 0) { rows_used[i] = 1; row_cnt++; if (j > col_max) col_max = j; } else { rows_used[i] = 0; } } fprintf(stderr,"Rows=%d,Cols=%d",row_cnt,col_max); if (row_cnt != 1) { return 0; } if (col_max !=4) { return 0; } if ((bb[0][0] == 0x76) || (bb[0][0] == 0x77)) { fprintf(stdout,"ALARM:TYPE=LEAK,ID=%2X%2X%2X%2X\n",bb[0][0],bb[0][1],bb[0][2],bb[0][3]); } return 1; } r_device leak = { /* .id = */ 20, /* .name = */ "Leak sensor", /* .modulation = */ OOK_MANCHESTER, /* .short_limit = */ 150, /* .long_limit = */ 0, /* .reset_limit = */ 1000, /* .json_callback = */ &leak_callback, };