Class: PWN::SDR::Decoder::ZigBee::DemodIQ

Inherits:
Object
  • Object
show all
Defined in:
lib/pwn/sdr/decoder/zigbee.rb

Overview

Streaming O-QPSK/MSK chip demod for Base.run_iq — I/Q → 802.15.4 MPDU.

Instance Method Summary collapse

Constructor Details

#initialize(rate:, channel: nil) ⇒ DemodIQ

Returns a new instance of DemodIQ.



31
32
33
34
35
36
# File 'lib/pwn/sdr/decoder/zigbee.rb', line 31

def initialize(rate:, channel: nil)
  @rate    = rate.to_f
  @channel = channel
  @chips   = []
  @seen    = {}
end

Instance Method Details

#feed_iq(samples, rate: nil) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/pwn/sdr/decoder/zigbee.rb', line 38

def feed_iq(samples, rate: nil, &)
  @rate = rate.to_f if rate
  chips = PWN::SDR::Decoder::DSP.gfsk_slice(
    iq: samples, rate: @rate, baud: CHIP_RATE, bt: 0.5
  )
  @chips.concat(chips)
  scan(&) if block_given?
  @chips.shift(@chips.length - 8192) if @chips.length > 65_536
end