dutycycle

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

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

Go to latest
Published: Jan 26, 2017 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	EuropeG  subBand = "europe g"
	EuropeG1         = "europe g1"
	EuropeG2         = "europe g2"
	EuropeG3         = "europe g3"
	EuropeG4         = "europe g4"
	UsISM            = "united states"
	AuISM            = "australia"
)

Available sub-bands

View Source
const (
	Europe    Region = "eu"
	US               = "us"
	China            = "cn"
	Australia        = "au"
	World            = "world"
)

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) (int, int, error)

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

Types

type Configuration

type Configuration struct {
	ID        int // The ID provided during updates
	Frequency float32
	DataRate  string
	RXDelay   uint32
	JoinDelay uint32
	Power     uint32
	CFList    [5]uint32
}

Configuration 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 Region

type Region string

func GetRegion

func GetRegion(region string) (Region, error)

GetRegion converts a string to a dutycycle.Region

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(r Region, 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, isJoin bool) *Configuration

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