decode

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2015 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextPowerOf2

func NextPowerOf2(v int) int

func Quantize

func Quantize(input []float64, output []byte)

Bit-value is determined by the sign of each sample after filtering.

Types

type AlphaMaxBetaMinLUT

type AlphaMaxBetaMinLUT []float64

Alpha*Max + Beta*Min Magnitude Approximation Lookup Table.

func NewAlphaMaxBetaMinLUT

func NewAlphaMaxBetaMinLUT() (lut AlphaMaxBetaMinLUT)

Pre-computes absolute values with most common DC offset for rtl-sdr dongles.

func (AlphaMaxBetaMinLUT) Execute

func (lut AlphaMaxBetaMinLUT) Execute(input []byte, output []float64)

Calculates complex magnitude on given IQ stream writing result to output.

type Decoder

type Decoder struct {
	Cfg PacketConfig

	Decimation int
	DecCfg     PacketConfig

	IQ        []byte
	Signal    []float64
	Filtered  []float64
	Quantized []byte
	// contains filtered or unexported fields
}

Decoder contains buffers and radio configuration.

func NewDecoder

func NewDecoder(cfg PacketConfig, decimation int, fastMag bool) (d Decoder)

Create a new decoder with the given packet configuration.

func (Decoder) Decode

func (d Decoder) Decode(input []byte) []int

Decode accepts a sample block and performs various DSP techniques to extract a packet.

func (Decoder) Filter

func (d Decoder) Filter(input, output []float64)

Matched filter for Manchester coded signals. Output signal's sign at each sample determines the bit-value since Manchester symbols have odd symmetry.

func (Decoder) Log added in v0.6.2

func (d Decoder) Log()

func (Decoder) Pack

func (d Decoder) Pack(input []byte, slices [][]byte)

Packs quantized signal into slices such that the first rank represents sample offsets and the second represents the value of each symbol from the given offset.

func (Decoder) Search

func (d Decoder) Search(slices [][]byte, preamble []byte) (indexes []int)

For each sample offset look for the preamble. Return a list of indexes the preamble is found at. Indexes are absolute in the unsliced quantized buffer.

func (Decoder) Slice added in v0.6.1

func (d Decoder) Slice(indices []int) (pkts [][]byte)

Given a list of indeces the preamble exists at, sample the appropriate bits of the signal's bit-decision. Pack bits of each index into an array of byte arrays and return.

type Demodulator added in v0.6.1

type Demodulator interface {
	Execute([]byte, []float64)
}

A Demodulator knows how to demodulate an array of uint8 IQ samples into an array of float64 samples.

type MagLUT

type MagLUT []float64

Default Magnitude Lookup Table

func NewSqrtMagLUT

func NewSqrtMagLUT() (lut MagLUT)

Pre-computes normalized squares with most common DC offset for rtl-sdr dongles.

func (MagLUT) Execute

func (lut MagLUT) Execute(input []byte, output []float64)

Calculates complex magnitude on given IQ stream writing result to output.

type PacketConfig

type PacketConfig struct {
	DataRate int

	BlockSize, BlockSize2       int
	SymbolLength, SymbolLength2 int
	SampleRate                  int

	PreambleSymbols, PacketSymbols int
	PreambleLength, PacketLength   int
	Preamble                       string

	BufferLength int

	CenterFreq uint32
}

PacketConfig specifies packet-specific radio configuration.

func (PacketConfig) Decimate added in v0.6.2

func (cfg PacketConfig) Decimate(decimation int) PacketConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL