decode

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2016 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 Decoder

type Decoder struct {
	Cfg PacketConfig

	Decimation int
	DecCfg     PacketConfig

	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) (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) Search

func (d *Decoder) Search() (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.

func (*Decoder) Transpose added in v0.8.0

func (d *Decoder) Transpose(input []byte)

Transpose 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.

Transforms: <--Sym1--><--Sym2--><--Sym3--><--Sym4--><--Sym5--><--Sym6--><--Sym7--><--Sym8--> <12345678><12345678><12345678><12345678><12345678><12345678><12345678><12345678> to: <11111111><22222222><33333333><44444444><55555555><66666666><77777777><88888888>

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 NewMagLUT added in v0.8.0

func NewMagLUT() (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