band

package
v0.0.0-...-60b8695 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package band contains structs to handle regional bands.

Index

Constants

View Source
const AS_923 = "AS_923"

AS_923 is the ID of the Asian 923Mhz band

View Source
const AU_915_928 = "AU_915_928"

AU_915_928 is the ID of the Australian band

View Source
const CN_470_510 = "CN_470_510"

CN_470_510 is the ID of the Chinese 470-510Mhz band

View Source
const CN_779_787 = "CN_779_787"

CN_779_787 is the ID of the Chinese 779-787Mhz band

View Source
const EU_433 = "EU_433"

EU_433 is the ID of the European 433Mhz band

View Source
const EU_863_870 = "EU_863_870"

EU_863_870 is the ID of the European 863-870Mhz band

View Source
const IN_865_867 = "IN_865_867"

IN_865_867 is the ID of the Indian frequency plan

View Source
const ISM_2400 = "ISM_2400"

ISM_2400 is the ID of the LoRa 2.4 GHz band.

View Source
const KR_920_923 = "KR_920_923"

KR_920_923 is the ID of the Korean frequency plan

View Source
const RU_864_870 = "RU_864_870"

RU_864_870 is the ID of the Russian frequency plan

View Source
const US_902_928 = "US_902_928"

US_902_928 is the ID of the US frequency plan

Variables

View Source
var All = make(map[string]Band)

All contains all the bands available.

Functions

func EqualChMasks

func EqualChMasks(a, b []bool) bool

Types

type Band

type Band struct {
	ID string

	Beacon            Beacon
	PingSlotFrequency *uint64

	// MaxUplinkChannels is the maximum amount of uplink channels that can be defined.
	MaxUplinkChannels uint8
	// UplinkChannels are the default uplink channels.
	UplinkChannels []Channel

	// MaxDownlinkChannels is the maximum amount of downlink channels that can be defined.
	MaxDownlinkChannels uint8
	// DownlinkChannels are the default downlink channels.
	DownlinkChannels []Channel

	// SubBands define the sub-bands, their duty-cycle limit and Tx power. The frequency ranges may not overlap.
	SubBands []SubBandParameters

	DataRates map[ttnpb.DataRateIndex]DataRate

	FreqMultiplier   uint64
	ImplementsCFList bool
	CFListType       ttnpb.CFListType

	// ReceiveDelay1 is the default Rx1 window timing in seconds.
	ReceiveDelay1 time.Duration
	// ReceiveDelay2 is the default Rx2 window timing in seconds (ReceiveDelay1 + 1s).
	ReceiveDelay2 time.Duration

	// ReceiveDelay1 is the default join-accept window timing in seconds.
	JoinAcceptDelay1 time.Duration
	// ReceiveDelay2 is the join-accept window timing in seconds.
	JoinAcceptDelay2 time.Duration
	// MaxFCntGap
	MaxFCntGap uint

	// EnableADR determines whether ADR should be enabled.
	EnableADR bool
	// ADRAckLimit
	ADRAckLimit ttnpb.ADRAckLimitExponent
	// ADRAckDelay
	ADRAckDelay   ttnpb.ADRAckDelayExponent
	MinAckTimeout time.Duration
	MaxAckTimeout time.Duration

	// TxOffset in dB: Tx power is computed by taking the MaxEIRP (default: +16dBm) and subtracting the offset.
	TxOffset []float32
	// MaxADRDataRateIndex represents the maximum non-RFU DataRateIndex suitable for ADR, which can be used according to the band's spec.
	MaxADRDataRateIndex ttnpb.DataRateIndex

	TxParamSetupReqSupport bool

	// DefaultMaxEIRP in dBm
	DefaultMaxEIRP float32

	// LoRaCodingRate is the coding rate used for LoRa modulation.
	LoRaCodingRate string

	// Rx1Channel computes the Rx1 channel index.
	Rx1Channel func(uint8) (uint8, error)
	// Rx1DataRate computes the Rx1 data rate index.
	Rx1DataRate func(ttnpb.DataRateIndex, ttnpb.DataRateOffset, bool) (ttnpb.DataRateIndex, error)

	// GenerateChMasks generates a mapping ChMaskCntl -> ChMask.
	// Length of desiredChs must be equal to length of currentChs.
	// Meaning of desiredChs is as follows: for i in range 0..len(desiredChs) if desiredChs[i] == true,
	// then channel with index i should be enabled, otherwise it should be disabled.
	// Meaning of currentChs is as follows: for i in range 0..len(currentChs) if currentChs[i] == true,
	// then channel with index i is enabled, otherwise it is disabled.
	// In case desiredChs equals currentChs, GenerateChMasks returns a singleton, which repesents a noop.
	GenerateChMasks func(currentChs, desiredChs []bool) ([]ChMaskCntlPair, error)
	// ParseChMask computes the channels that have to be masked given ChMask mask and ChMaskCntl cntl.
	ParseChMask func(mask [16]bool, cntl uint8) (map[uint8]bool, error)

	// DefaultRx2Parameters are the default parameters that determine the settings for a Tx sent during Rx2.
	DefaultRx2Parameters Rx2Parameters
	// contains filtered or unexported fields
}

Band contains a band's properties.

func GetByID

func GetByID(id string) (Band, error)

GetByID returns the band if it was found, and returns an error otherwise.

func (Band) FindSubBand

func (b Band) FindSubBand(frequency uint64) (SubBandParameters, bool)

FindSubBand returns the sub-band by frequency, if any.

func (Band) FindUplinkDataRate

func (b Band) FindUplinkDataRate(dr ttnpb.DataRate) (ttnpb.DataRateIndex, DataRate, bool)

FindUplinkDataRate returns the uplink data rate with index by API data rate, if any.

func (Band) MaxTxPowerIndex

func (b Band) MaxTxPowerIndex() uint8

func (Band) Version

func (b Band) Version(wantedVersion ttnpb.PHYVersion) (Band, error)

Version returns the band parameters for a given version.

func (Band) Versions

func (b Band) Versions() []ttnpb.PHYVersion

Versions supported for this band.

type Beacon

type Beacon struct {
	DataRateIndex    ttnpb.DataRateIndex
	CodingRate       string
	InvertedPolarity bool
	// Channel returns in Hz on which beaconing is performed.
	//
	// beaconTime is the integer value, converted in float64, of the 4 bytes “Time” field of the beacon frame.
	ComputeFrequency func(beaconTime float64) uint64
}

Beacon parameters of a specific band.

type ChMaskCntlPair

type ChMaskCntlPair struct {
	Cntl uint8
	Mask [16]bool
}

ChMaskCntlPair pairs a ChMaskCntl with a mask.

type Channel

type Channel struct {
	// Frequency indicates the frequency of the channel.
	Frequency uint64
	// MinDataRate indicates the index of the minimal data rates accepted on this channel.
	MinDataRate ttnpb.DataRateIndex
	// MinDataRate indicates the index of the maximal data rates accepted on this channel.
	MaxDataRate ttnpb.DataRateIndex
}

Channel abstracts a band's channel properties.

type DataRate

type DataRate struct {
	Rate              ttnpb.DataRate
	MaxMACPayloadSize MaxMACPayloadSizeFunc
}

DataRate indicates the properties of a band's data rate.

type MaxMACPayloadSizeFunc

type MaxMACPayloadSizeFunc func(bool) uint16

type Rx2Parameters

type Rx2Parameters struct {
	DataRateIndex ttnpb.DataRateIndex
	Frequency     uint64
}

Rx2Parameters contains downlink datarate index and channel.

type SubBandParameters

type SubBandParameters struct {
	MinFrequency uint64
	MaxFrequency uint64
	DutyCycle    float32
	MaxEIRP      float32
}

SubBandParameters contains the sub-band frequency range, duty cycle and Tx power.

func (SubBandParameters) Comprises

func (d SubBandParameters) Comprises(frequency uint64) bool

Comprises returns whether the duty cycle applies to the given frequency.

func (SubBandParameters) MaxEmissionDuring

func (d SubBandParameters) MaxEmissionDuring(period time.Duration) time.Duration

MaxEmissionDuring the period passed as parameter, that is allowed by that duty cycle.

Jump to

Keyboard shortcuts

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