Class: PWN::SDR::Decoder::Bluetooth::DemodIQ
- Inherits:
-
Object
- Object
- PWN::SDR::Decoder::Bluetooth::DemodIQ
- Defined in:
- lib/pwn/sdr/decoder/bluetooth.rb
Overview
Streaming BLE GFSK demod for Base.run_iq — I/Q → advertising PDUs.
Constant Summary collapse
- BAUD =
1_000_000
Instance Method Summary collapse
- #feed_iq(samples, rate: nil) ⇒ Object
-
#initialize(rate:, channel: 37, ble: true) ⇒ DemodIQ
constructor
A new instance of DemodIQ.
Constructor Details
#initialize(rate:, channel: 37, ble: true) ⇒ DemodIQ
Returns a new instance of DemodIQ.
31 32 33 34 35 36 37 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 31 def initialize(rate:, channel: 37, ble: true) @rate = rate.to_f @channel = channel @ble = ble @bits = [] @seen = {} end |
Instance Method Details
#feed_iq(samples, rate: nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 39 def feed_iq(samples, rate: nil, &) @rate = rate.to_f if rate # Try both polarities — GFSK sign depends on tuner spectral inversion. new_bits = PWN::SDR::Decoder::DSP.gfsk_slice( iq: samples, rate: @rate, baud: BAUD, bt: 0.5 ) @bits.concat(new_bits) scan(&) if block_given? @bits.shift(@bits.length - 4096) if @bits.length > 65_536 end |