#include "rtl_433.h"
-static int steffen_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) {
+static int steffen_callback(bitbuffer_t *bitbuffer) {
+ bitrow_t *bb = bitbuffer->bb;
if (bb[0][0]==0x00 && ((bb[1][0]&0x07)==0x07) && bb[1][0]==bb[2][0] && bb[2][0]==bb[3][0]) {
- fprintf(stderr, "BUTTON:TYPE=STEFFAN,");
- 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);
+ fprintf(stdout, "Remote button event:\n");
+ fprintf(stdout, "model = Steffan Switch Transmitter, %d bits\n",bitbuffer->bits_per_row[1]);
+ fprintf(stdout, "code = %d%d%d%d%d\n", (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);
if ((bb[1][2]&0x0f)==0x0e)
- fprintf(stdout, "PRESSED=A,");
+ fprintf(stdout, "button = A\n");
else if ((bb[1][2]&0x0f)==0x0d)
- fprintf(stdout, "PRESSED=B,");
+ fprintf(stdout, "button = B\n");
else if ((bb[1][2]&0x0f)==0x0b)
- fprintf(stdout, "PRESSED=C,");
+ fprintf(stdout, "button = C\n");
else if ((bb[1][2]&0x0f)==0x07)
- fprintf(stdout, "PRESSED=D,");
+ fprintf(stdout, "button = D\n");
else if ((bb[1][2]&0x0f)==0x0f)
- fprintf(stdout, "PRESSED=ALL,");
+ fprintf(stdout, "button = ALL\n");
else
- fprintf(stdout, "PRESSED=UNKNOWN,");
+ fprintf(stdout, "button = unknown\n");
if ((bb[1][2]&0xf0)==0xf0) {
- fprintf(stdout, "STATE=OFF\n");
+ fprintf(stdout, "state = OFF\n");
} else {
- fprintf(stdout, "STATE=ON\n");
+ fprintf(stdout, "state = ON\n");
}
- if (debug_output)
- debug_callback(bb, bits_per_row);
-
return 1;
}
return 0;
}
r_device steffen = {
- /* .id = */ 9,
- /* .name = */ "Steffen Switch Transmitter",
- /* .modulation = */ OOK_PWM_D,
- /* .short_limit = */ 140,
- /* .long_limit = */ 270,
- /* .reset_limit = */ 1500,
- /* .json_callback = */ &steffen_callback,
+ .name = "Steffen Switch Transmitter",
+ .modulation = OOK_PULSE_PPM_RAW,
+ .short_limit = 560,
+ .long_limit = 1080,
+ .reset_limit = 6000,
+ .json_callback = &steffen_callback,
+ .disabled = 1,
+ .demod_arg = 0,
};