From 59a56accafc4b3397bfd79a92b818a6696bc77cb Mon Sep 17 00:00:00 2001 From: cheetah Date: Tue, 28 Jan 2020 20:09:52 +0100 Subject: [PATCH] added Nemaxx_WL10 Smoke Detector(static code-crap product) --- iq_transmitter.grc | 4 ++-- iq_transmitter.py | 2 +- main.py | 16 ++++++---------- protocols/Nemaxx_WL10_SmokeDetector.py | 23 +++++++++++++++++++++++ spoofevery15s.sh | 15 +++++++++++++++ wetterstatio.py | 7 +------ 6 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 protocols/Nemaxx_WL10_SmokeDetector.py create mode 100644 spoofevery15s.sh diff --git a/iq_transmitter.grc b/iq_transmitter.grc index 8808886..5d31cb2 100644 --- a/iq_transmitter.grc +++ b/iq_transmitter.grc @@ -412,7 +412,7 @@ _enabled - True + 1 fft_size @@ -507,7 +507,7 @@ _enabled - True + 1 _coordinate diff --git a/iq_transmitter.py b/iq_transmitter.py index 23214dc..a7504f3 100755 --- a/iq_transmitter.py +++ b/iq_transmitter.py @@ -3,7 +3,7 @@ ################################################## # GNU Radio Python Flow Graph # Title: IQ Transmitter -# Generated: Sat Jan 18 21:31:42 2020 +# Generated: Mon Jan 27 16:30:38 2020 ################################################## diff --git a/main.py b/main.py index 058e70f..8499e2a 100644 --- a/main.py +++ b/main.py @@ -4,16 +4,12 @@ import SoapySDR from SoapySDR import * #SOAPY_SDR_* constants # Protocol part -import protocols.Nexus - -nexus = protocols.Nexus.Nexus_TempHumidity() -with open('output.complex', 'wb') as f: - for bt_id in range(0,255): - for bt_channel in range(0,4): - samples = nexus.generateSamples(baseband_samplerate=2e6, id=bt_id, channel=bt_channel, temp=-50, humidity=100) - samples.tofile(f) - print("Generated Sensor ID %d Nexus Samples" % bt_id) - # +import protocols.Nemaxx_WL10_SmokeDetector + +nemaxx = protocols.Nemaxx_WL10_SmokeDetector.Nemaxx_WL10_SmokeDetector() +with open('nemaxx.complex', 'wb') as f: + samples = nemaxx.generateSamples(repeatNum=20) + samples.tofile(f) """ diff --git a/protocols/Nemaxx_WL10_SmokeDetector.py b/protocols/Nemaxx_WL10_SmokeDetector.py new file mode 100644 index 0000000..7cf1123 --- /dev/null +++ b/protocols/Nemaxx_WL10_SmokeDetector.py @@ -0,0 +1,23 @@ +from modulators.OOKModulator import OOKModulator +import numpy as np +""" +Nemaxx WL10 Smokedetectors +""" +class Nemaxx_WL10_SmokeDetector: + def __init__(self, baseband_samplerate=2e6): + self.modulator = OOKModulator(baseband_samplerate=baseband_samplerate, am_frequency=22.471e3) + def test(self): + print("Nemaxx WL10 Smokedetector (433MHz)") + def generateSamples(self, repeatNum=20, numpyType=np.complex64): + for i in range(repeatNum): + bits = [0,1,0,0,0,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,1,0] + print(bits) + self.modulator.addModulation(8120) + self.modulator.addPadding(912) + for j in bits: + self.modulator.addModulation(795) + self.modulator.addPadding(1400 if int(j) == 0 else 2750) + self.modulator.addModulation(795) + self.modulator.addPadding(1337) # Packet Sync + + return self.modulator.getSamplesAndReset(numpyType) \ No newline at end of file diff --git a/spoofevery15s.sh b/spoofevery15s.sh new file mode 100644 index 0000000..47298e3 --- /dev/null +++ b/spoofevery15s.sh @@ -0,0 +1,15 @@ +#!/bin/bash +while true; do + python iq_transmitter.py & + sleep 10 + + killall -9 python + + python /home/user/SDR/txstop.py & + sleep 5 + killall -9 python + + sleep 15 + + +done diff --git a/wetterstatio.py b/wetterstatio.py index c4a80d5..4516d52 100644 --- a/wetterstatio.py +++ b/wetterstatio.py @@ -118,12 +118,7 @@ for i in range(4): 1,0,0,0, 1,0,0,1 ] - bits = bitsStart + [ - 0,0, - 1,0,1,0, - 1,0,1,0, - 1,1,1,0 - ] + bits = bitsStart + bits_43_4 #bits = data2 print(bits) print(len(bits))