Class: PWN::SDR::Decoder::LTE::PBCHIQ
- Inherits:
-
Object
- Object
- PWN::SDR::Decoder::LTE::PBCHIQ
- Defined in:
- lib/pwn/sdr/decoder/lte.rb
Overview
Optional native implementation; never compiles or fetches at runtime. ABI contains only flat scalar buffers, not version-sensitive structs.
Direct Known Subclasses
Instance Method Summary collapse
- #feed_iq(samples, rate: nil) ⇒ Object
- #flush ⇒ Object
-
#initialize(pci:) ⇒ PBCHIQ
constructor
A new instance of PBCHIQ.
Constructor Details
#initialize(pci:) ⇒ PBCHIQ
Returns a new instance of PBCHIQ.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pwn/sdr/decoder/lte.rb', line 21 def initialize(pci:) @pci = pci @buffer = [] path = File.("../../../../ext/pwn_lte/libpwn_lte.#{RbConfig::CONFIG.fetch('DLEXT')}", __dir__) @native = Module.new do extend ::FFI::Library ffi_lib path attach_function :pwn_lte_pbch, %i[pointer uint uint pointer pointer pointer], :int end rescue LoadError => e raise LoadError, "LTE PBCH native backend unavailable; build ext/pwn_lte/build.rb against srsRAN_4G: #{e.}" end |
Instance Method Details
#feed_iq(samples, rate: nil) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/pwn/sdr/decoder/lte.rb', line 35 def feed_iq(samples, rate: nil) raise ArgumentError, 'PBCH requires 1.92 Msps' if rate && rate != FS_BASE @buffer.concat(samples) while @buffer.length >= 3840 frame = decode_subframe(@buffer.shift(3840)) yield frame if frame end end |
#flush ⇒ Object
45 46 47 |
# File 'lib/pwn/sdr/decoder/lte.rb', line 45 def flush raise ArgumentError, 'truncated LTE subframe zero (requires 1920 complex samples)' unless @buffer.empty? end |