Documentation ¶
Overview ¶
Package band provides band specific defaults and configuration for downlink communication with end-nodes.
Index ¶
- Variables
- type Band
- func (b *Band) AddChannel(freq int) error
- func (b *Band) DisableUplinkChannel(i int) error
- func (b *Band) EnableUplinkChannel(i int) error
- func (b *Band) GetCFList() *lorawan.CFList
- func (b *Band) GetDataRate(dr DataRate) (int, error)
- func (b *Band) GetDisabledUplinkChannels() []int
- func (b *Band) GetEnabledChannelsForLinkADRReqPayloads(nodeChannels []int, pls []lorawan.LinkADRReqPayload) ([]int, error)
- func (b *Band) GetEnabledUplinkChannels() []int
- func (b *Band) GetLinkADRReqPayloadsForEnabledChannels(nodeChannels []int) []lorawan.LinkADRReqPayload
- func (b *Band) GetRX1Channel(txChannel int) int
- func (b *Band) GetRX1DataRate(uplinkDR, rx1DROffset int) (int, error)
- func (b *Band) GetRX1Frequency(txFrequency int) (int, error)
- func (b *Band) GetUplinkChannelNumber(frequency int) (int, error)
- func (b *Band) GetUplinkChannels() []int
- type Channel
- type DataRate
- type MaxPayloadSize
- type Modulation
- type Name
Constants ¶
This section is empty.
Variables ¶
var (
ErrChannelDoesNotExist = errors.New("lorawan/band: channel does not exist")
)
errors
Functions ¶
This section is empty.
Types ¶
type Band ¶
type Band struct { // DefaultTXPower defines the default radiated transmit output power DefaultTXPower int // ImplementsCFlist defines if the band implements the optional channel // frequency list. ImplementsCFlist bool // RX2Frequency defines the fixed frequency for the RX2 receive window RX2Frequency int // RX2DataRate defines the fixed data-rate for the RX2 receive window RX2DataRate int // MaxFcntGap defines the MAC_FCNT_GAP default value. MaxFCntGap uint32 // ADRACKLimit defines the ADR_ACK_LIMIT default value. ADRACKLimit int // ADRACKDelay defines the ADR_ACK_DELAY default value. ADRACKDelay int // ReceiveDelay1 defines the RECEIVE_DELAY1 default value. ReceiveDelay1 time.Duration // ReceiveDelay2 defines the RECEIVE_DELAY2 default value. ReceiveDelay2 time.Duration // JoinAcceptDelay1 defines the JOIN_ACCEPT_DELAY1 default value. JoinAcceptDelay1 time.Duration // JoinAcceptDelay2 defines the JOIN_ACCEPT_DELAY2 default value. JoinAcceptDelay2 time.Duration // ACKTimeoutMin defines the ACK_TIMEOUT min. default value. ACKTimeoutMin time.Duration // ACKTimeoutMax defines the ACK_TIMEOUT max. default value. ACKTimeoutMax time.Duration // DataRates defines the available data rates. DataRates []DataRate // MaxPayloadSize defines the maximum payload size, per data-rate. MaxPayloadSize []MaxPayloadSize // TXPower defines the TX power configuration. TXPower []int // UplinkChannels defines the list of (default) configured uplink channels. UplinkChannels []Channel // DownlinkChannels defines the list of (default) configured downlink // channels. DownlinkChannels []Channel // contains filtered or unexported fields }
Band defines an region specific ISM band implementation for LoRa.
func GetConfig ¶
GetConfig returns the band configuration for the given band. Please refer to the LoRaWAN specification for more details about the effect of the repeater and dwell time arguments.
func (*Band) AddChannel ¶
AddChannel adds an extra (user-configured) channel to the channels. The DataRates wil be set to DR 0-5. Note: this is only allowed when the band supports a CFList.
func (*Band) DisableUplinkChannel ¶
DisableUplinkChannel disables the given uplink channel.
func (*Band) EnableUplinkChannel ¶
EnableUplinkChannel enables the given uplink channel.
func (*Band) GetCFList ¶
GetCFList returns the CFList used for OTAA activation, or returns nil if the band does not implement the CFList or when there are no extra channels. Note that this only returns the first 5 extra channels.
func (*Band) GetDataRate ¶
GetDataRate returns the index of the given DataRate.
func (*Band) GetDisabledUplinkChannels ¶
GetDisabledUplinkChannels returns the disabled uplink channels.
func (*Band) GetEnabledChannelsForLinkADRReqPayloads ¶
func (b *Band) GetEnabledChannelsForLinkADRReqPayloads(nodeChannels []int, pls []lorawan.LinkADRReqPayload) ([]int, error)
GetEnabledChannelsForLinkADRReqPaylaods returns the enabled after which the given LinkADRReqPayloads have been applied to the given node channels.
func (*Band) GetEnabledUplinkChannels ¶
GetEnabledUplinkChannels returns the enabled uplink channels.
func (*Band) GetLinkADRReqPayloadsForEnabledChannels ¶
func (b *Band) GetLinkADRReqPayloadsForEnabledChannels(nodeChannels []int) []lorawan.LinkADRReqPayload
GetLinkADRReqPayloadsForEnabledChannels returns the LinkADRReqPayloads to reconfigure the node to the current active channels. Note that in case of activation, user-defined channels (e.g. CFList) will be ignored as it is unknown if the node is aware about these extra frequencies.
func (*Band) GetRX1Channel ¶
GetRX1Channel returns the channel to use for RX1 given the channel used for uplink.
func (*Band) GetRX1DataRate ¶
GetRX1DataRate returns the RX1 data-rate given the uplink data-rate and RX1 data-rate offset.
func (*Band) GetRX1Frequency ¶
GetRX1Frequency returns the frequency to use for RX1 given the uplink frequency.
func (*Band) GetUplinkChannelNumber ¶
GetUplinkChannelNumber returns the channel number given a frequency.
func (*Band) GetUplinkChannels ¶
GetUplinkChannels returns all available uplink channels.
type Channel ¶
type Channel struct { Frequency int // frequency in Hz DataRates []int // each int mapping to an index in DataRateConfiguration // contains filtered or unexported fields }
Channel defines the channel structure
type DataRate ¶
type DataRate struct { Modulation Modulation `json:"modulation"` SpreadFactor int `json:"spreadFactor,omitempty"` // used for LoRa Bandwidth int `json:"bandwidth,omitempty"` // in kHz, used for LoRa BitRate int `json:"bitRate,omitempty"` // bits per second, used for FSK }
DataRate defines a data rate
type MaxPayloadSize ¶
type MaxPayloadSize struct { M int // The maximum MACPayload size length N int // The maximum application payload length in the absence of the optional FOpt control field }
MaxPayloadSize defines the max payload size
type Modulation ¶
type Modulation string
Modulation defines the modulation type.
const ( LoRaModulation Modulation = "LORA" FSKModulation Modulation = "FSK" )
Possible modulation types.
type Name ¶
type Name string
Name defines the band-name type.
const ( AS_923 Name = "AS_923" AU_915_928 Name = "AU_915_928" CN_470_510 Name = "CN_470_510" CN_779_787 Name = "CN_779_787" EU_433 Name = "EU_433" EU_863_870 Name = "EU_863_870" IN_865_867 Name = "IN_865_867" KR_920_923 Name = "KR_920_923" RU_864_870 Name = "RU_864_870" US_902_928 Name = "US_902_928" )
Available ISM bands.