From b76b05fc92bb0bcd1cd610d3f8d02c3a4518a310 Mon Sep 17 00:00:00 2001 From: Tommy Vestermark Date: Fri, 21 Aug 2015 01:18:40 +0200 Subject: [PATCH] Add sensor Chuango (initial) --- include/rtl_433_devices.h | 3 ++- src/CMakeLists.txt | 1 + src/devices/chuango.c | 40 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/devices/chuango.c diff --git a/include/rtl_433_devices.h b/include/rtl_433_devices.h index dbcefc67..699cb983 100644 --- a/include/rtl_433_devices.h +++ b/include/rtl_433_devices.h @@ -31,7 +31,8 @@ DECL(gt_wt_02) \ DECL(danfoss_CFR) \ DECL(ec3k) \ - DECL(valeo) + DECL(valeo) \ + DECL(chuango) typedef struct { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c2dce71..695c7342 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,6 +48,7 @@ add_executable(rtl_433 devices/danfoss.c devices/ec3k.c devices/valeo.c + devices/chuango.c ) target_link_libraries(rtl_433 diff --git a/src/devices/chuango.c b/src/devices/chuango.c new file mode 100644 index 00000000..100a35f7 --- /dev/null +++ b/src/devices/chuango.c @@ -0,0 +1,40 @@ +/* Chuango Security Technology Corporation + * + * PIR-900 PIR sensor + * DWC-100 Door sensor + * + * Copyright (C) 2015 Tommy Vestermark + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include "rtl_433.h" + + +static int chuango_callback(bitbuffer_t *bitbuffer) { + bitrow_t *bb = bitbuffer->bb; + + // Validate package + unsigned bits = bitbuffer->bits_per_row[0]; + if ((bits == 25) +// && (bb[0][1] == 0xe8) && (bb[0][2] == 0xe8) // Check a couple of preambles + ) { + fprintf(stdout, "Chuango Security Sensor\n"); + bitbuffer_print(bitbuffer); + return 1; + } + return 0; +} + + +r_device chuango = { + .name = "Chuango Security Sensor", + .modulation = OOK_PULSE_PWM_RAW, + .short_limit = 284, // Pulse Long 426, Short 142 + .long_limit = 500, // Gaps Short 142, Long 424 + .reset_limit = 500, // Intermessage Gap 4298 (individually for now) + .json_callback = &chuango_callback, + .disabled = 0, + .demod_arg = 0, // Do not remove startbit +};