Module: PWN::SDR::Decoder::LoRa
- Defined in:
- lib/pwn/sdr/decoder/lora.rb
Overview
True-air + detector-fallback decoder for LoRa. Prefers PWN::FFI I/Q (RTL-SDR / ADALM-Pluto / HackRF / capture file) via Base.run_iq; degrades to Base.run_detector with no hardware.
Defined Under Namespace
Classes: DemodIQ
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
0day Inc.
-
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::LoRa.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' ).
- .help ⇒ Object
- .parse_line(opts = {}) ⇒ Object
Class Method Details
.authors ⇒ Object
- Author(s)
0day Inc. support@0dayinc.com
118 119 120 |
# File 'lib/pwn/sdr/decoder/lora.rb', line 118 public_class_method def self. "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n" end |
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::LoRa.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' )
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/pwn/sdr/decoder/lora.rb', line 76 public_class_method def self.decode(opts = {}) freq_obj = opts[:freq_obj] rate = (opts[:sample_rate] || freq_obj[:iq_rate] || 1_000_000).to_i proto = 'LoRa' demod = DemodIQ.new( rate: rate, protocol: proto, modulation: 'CSS', extra: { threshold: 8.0 } ) PWN::SDR::Decoder::Base.run_iq( freq_obj: freq_obj, protocol: proto, sample_rate: rate, source: opts[:source], file: opts[:file], demod: demod, threshold: 8.0, note: 'CSS over 125–500 kHz — true-air I/Q path estimates SF from chirp duration; full dechirp via FFTW is layered when available.', describe: proc { |b| { modulation: 'CSS', bw_khz_assumed: 125, sf_estimate: (begin; t = b[:duration_ms] / 20.0; t.positive? ? Math.log2(t * 125).round.clamp(6, 12) : nil; end) }.compact } ) end |
.help ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/pwn/sdr/decoder/lora.rb', line 122 public_class_method def self.help puts "USAGE (true-air I/Q via PWN::FFI + detector fallback): #{self}.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq', source: 'optional - :auto|:rtlsdr|:adalm_pluto|:file', file: 'optional - .cu8/.cs16 capture' ) #{self}.authors " end |
.parse_line(opts = {}) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/pwn/sdr/decoder/lora.rb', line 98 public_class_method def self.parse_line(opts = {}) line = opts[:line].to_s h = begin JSON.parse(line, symbolize_names: true) rescue StandardError { unparsed: line } end out = { protocol: 'LoRa' }.merge(h) bits = [] bits << "SF#{out[:sf]}" if out[:sf] bits << "BW#{out[:bw]}" if out[:bw] bits << "CR#{out[:cr]}" if out[:cr] bits << "RSSI=#{out[:rssi]}" if out[:rssi] bits << out[:payload].to_s[0, 40] if out[:payload] out[:summary] = bits.empty? ? line[0, 120] : bits.join(' ') out end |