dutycycle

package
v0.0.0-...-9b9f36b Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EuropeG  subBand = "europe g"
	EuropeG1         = "europe g1"
	EuropeG2         = "europe g2"
	EuropeG3         = "europe g3"
	EuropeG4         = "europe g4"
)

Available sub-bands

View Source
const (
	Europe region = iota
	US
	China
)

Available regions for LoRaWAN

Variables

This section is empty.

Functions

func GetSubBand

func GetSubBand(freq float32) (subBand, error)

GetSubBand returns the subband associated to a given frequency

func ParseDatr

func ParseDatr(datr string) (float64, float64, error)

ParseDatr extract the spread factor and the bandwidth from a DataRate identifier

Types

type BestTarget

type BestTarget struct {
	ID    int  // The ID provided during updates
	IsRX2 bool // Whether it should use RX2
}

BestTarget represents the best result that has been computed after all updates.

type Cycles

type Cycles map[subBand]uint32

Cycles gives a representation of sub-band usages

type DutyManager

type DutyManager interface {
	Update(id []byte, freq float32, size uint32, datr string, codr string) error
	Lookup(id []byte) (Cycles, error)
	Close() error
}

DutyManager provides an interface to manipulate and compute gateways duty-cycles.

func NewManager

func NewManager(filepath string, cycleLength time.Duration, r region) (DutyManager, error)

NewManager constructs a new gateway manager from

type ScoreComputer

type ScoreComputer struct {
	// contains filtered or unexported fields
}

ScoreComputer enables an external component to manipulate metadata associated to several targets in order to determine which target is the most suitable for a downlink response. It considers two windows RX1 and RX2 with the following conventions:

For SF7 & SF8, RX1, the algorithm favors RX1

For SF9+ or, if no target is available on RX1, then RX2 is used

Within RX1 or RX2, the SNR is considered first (the higher the better), then the RSSI on a lower plan.

func NewScoreComputer

func NewScoreComputer(datr string) (*ScoreComputer, scores, error)

NewScoreComputer constructs a new ScoreComputer and initiate an empty scores table

func (*ScoreComputer) Get

func (c *ScoreComputer) Get(s scores) *BestTarget

Get returns the best score according to the configured spread factor and all updates. It returns nil if none of the target is available for a response

func (*ScoreComputer) Update

func (c *ScoreComputer) Update(s scores, id int, metadata core.Metadata) scores

Update computes the score associated to the given target and update the internal score accordingly whether it is better than the existing one

type State

type State uint

State Refers to an actual State of a transmitter

const (
	StateHighlyAvailable State = iota
	StateAvailable
	StateWarning
	StateBlocked
)

func StateFromDuty

func StateFromDuty(duty uint32) State

StateFromDuty retrieve the associated transmitter state from a duty value

Jump to

Keyboard shortcuts

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