diff --git a/README.md b/README.md index 75c9f03a..233416cd 100644 --- a/README.md +++ b/README.md @@ -287,6 +287,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md). [201] Unbranded SolarTPMS for trucks [202] Funkbus / Instafunk (Berker, Jira, Jung) [203] Porsche Boxster/Cayman TPMS + [204] Jasco/GE Choice Alert Security Devices * Disabled by default, use -R n or -G diff --git a/conf/rtl_433.example.conf b/conf/rtl_433.example.conf index 39bedbf1..ec2e30e6 100644 --- a/conf/rtl_433.example.conf +++ b/conf/rtl_433.example.conf @@ -424,6 +424,7 @@ stop_after_successful_events false protocol 201 # Unbranded SolarTPMS for trucks protocol 202 # Funkbus / Instafunk (Berker, Jira, Jung) protocol 203 # Porsche Boxster/Cayman TPMS + protocol 204 # Jasco/GE Choice Alert Security Devices ## Flex devices (command line option "-X") diff --git a/include/rtl_433_devices.h b/include/rtl_433_devices.h index 6c14a0d6..a740f1ff 100644 --- a/include/rtl_433_devices.h +++ b/include/rtl_433_devices.h @@ -211,6 +211,7 @@ DECL(tpms_truck) \ DECL(funkbus_remote) \ DECL(tpms_porsche) \ + DECL(jasco) \ /* Add new decoders here. */ diff --git a/man/man1/rtl_433.1 b/man/man1/rtl_433.1 index 4aced948..3d83aaaa 100644 --- a/man/man1/rtl_433.1 +++ b/man/man1/rtl_433.1 @@ -166,7 +166,7 @@ RTL\-SDR device driver is available. To set gain for RTL\-SDR use \-g <gain> to set an overall gain in dB. .RE .RS -SoapySDR device driver is available. +SoapySDR device driver is not available. .RE .TP [ \fB\-d\fI ""\fP ] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 234d9971..3bafc98f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -123,6 +123,7 @@ add_library(r_433 STATIC devices/insteon.c devices/interlogix.c devices/intertechno.c + devices/jasco.c devices/kedsum.c devices/kerui.c devices/klimalogg.c diff --git a/src/devices/jasco.c b/src/devices/jasco.c new file mode 100644 index 00000000..dca43186 --- /dev/null +++ b/src/devices/jasco.c @@ -0,0 +1,103 @@ +/** @file + Jasco/GE Choice Alert Wireless Device Decoder. + + 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. +*/ +/** +Jasco/GE Choice Alert Wireless Device Decoder. + +- Frequency: 318.01 MHz + +v0.1 based on the contact and water sensors Model 45131 / FCC ID QOB45131-3 + +v0.2 corrected decoder + +v0.3 internal naming consistancies + +*/ + +#include "decoder.h" + +#define JASCO_MSG_BIT_LEN 86 + +static int jasco_decode(r_device *decoder, bitbuffer_t *bitbuffer) +{ + + if (bitbuffer->bits_per_row[0] != JASCO_MSG_BIT_LEN && bitbuffer->bits_per_row[0] != JASCO_MSG_BIT_LEN+1) { + if (decoder->verbose > 1 && bitbuffer->bits_per_row[0] > 0) { + fprintf(stderr, "%s: invalid bit count %d\n", __func__, + bitbuffer->bits_per_row[0]); + } + return DECODE_ABORT_LENGTH; + } + + uint8_t b[4]; + uint8_t chk; + uint32_t sensor_id = 0; + int s_closed=0; +// int battery=0; + bitbuffer_t packet_bits; + data_t *data; + uint8_t const preamble[] = {0xfc, 0x0c}; + unsigned bitpos = 0; + + if (decoder->verbose > 1) { + bitbuffer_debug(bitbuffer); + } + bitpos = bitbuffer_search(bitbuffer, 0, 0, preamble, sizeof(preamble) * 8) + sizeof(preamble) * 8; + + bitpos = bitbuffer_manchester_decode(bitbuffer, 0, bitpos, &packet_bits, 87); + + bitbuffer_extract_bytes(&packet_bits, 0, 0,b, 32); + + if (decoder->verbose > 1) { + bitbuffer_debug(&packet_bits); + } + + bitbuffer_clear(&packet_bits); + + chk = b[0] ^ b[1] ^ b[2]; + if (chk != b[3]) { + return DECODE_FAIL_MIC; + } + + + sensor_id = (b[0] << 8)+ b[1]; + + s_closed = ((b[2] & 0xef) == 0xef); + + + /* clang-format off */ + data = data_make( + "model", "", DATA_STRING, "Jasco/GE Choice Alert Security Devices", + "id", "Id", DATA_INT, sensor_id, + "status", "Closed", DATA_INT, s_closed, + "mic", "Integrity", DATA_STRING, "CRC", + NULL); + /* clang-format on */ + + decoder_output_data(decoder, data); + return 1; +} + +static char *output_fields[] = { + "model", + "id", + "status", + "mic", + NULL, +}; + +r_device jasco = { + .name = "Jasco/GE Choice Alert Security Devices", + .modulation = OOK_PULSE_PCM_RZ, + .short_width = 250, + .long_width = 250, + .reset_limit = 1800, // Maximum gap size before End Of Message + .decode_fn = &jasco_decode, + .fields = output_fields, + +}; diff --git a/vs15/rtl_433.vcxproj b/vs15/rtl_433.vcxproj index 803cdf2b..bf04a4ee 100644 --- a/vs15/rtl_433.vcxproj +++ b/vs15/rtl_433.vcxproj @@ -254,6 +254,7 @@ COPY ..\..\libusb\MS64\dll\libusb*.dll $(TargetDir)</Command> <ClCompile Include="..\src\devices\insteon.c" /> <ClCompile Include="..\src\devices\interlogix.c" /> <ClCompile Include="..\src\devices\intertechno.c" /> + <ClCompile Include="..\src\devices\jasco.c" /> <ClCompile Include="..\src\devices\kedsum.c" /> <ClCompile Include="..\src\devices\kerui.c" /> <ClCompile Include="..\src\devices\klimalogg.c" /> diff --git a/vs15/rtl_433.vcxproj.filters b/vs15/rtl_433.vcxproj.filters index 6c090546..0c10520e 100644 --- a/vs15/rtl_433.vcxproj.filters +++ b/vs15/rtl_433.vcxproj.filters @@ -499,6 +499,9 @@ <ClCompile Include="..\src\devices\intertechno.c"> <Filter>Source Files\devices</Filter> </ClCompile> + <ClCompile Include="..\src\devices\jasco.c"> + <Filter>Source Files\devices</Filter> + </ClCompile> <ClCompile Include="..\src\devices\kedsum.c"> <Filter>Source Files\devices</Filter> </ClCompile>