Class: PWN::SDR::Decoder::GSM::DemodIQ

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

Overview

Streaming FCCH detector for Base.run_iq (not a channel decoder).

Instance Method Summary collapse

Constructor Details

#initialize(rate:) ⇒ DemodIQ

Returns a new instance of DemodIQ.



27
28
29
30
31
32
33
# File 'lib/pwn/sdr/decoder/gsm.rb', line 27

def initialize(rate:)
  @rate  = rate.to_f
  @spb   = @rate / SYMBOL_RATE
  @audio = []
  @audio_offset = 0
  @fcch_n = 0
end

Instance Method Details

#feed_iq(samples, rate: nil) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/pwn/sdr/decoder/gsm.rb', line 35

def feed_iq(samples, rate: nil, &)
  @rate = rate.to_f if rate
  @spb  = @rate / SYMBOL_RATE
  @fm_state ||= {}
  fm = PWN::SDR::Decoder::DSP.fm_demod_iq(iq: samples, state: @fm_state)
  @audio.concat(fm)
  scan(&) if block_given?
  max = (@rate * 0.25).to_i
  return unless @audio.length > max

  @audio_offset += @audio.length - max
  @audio.shift(@audio.length - max)
end