Documentation ¶
Overview ¶
Package band defines the frequency bands used by the LoRaWAN package.
Currently only the EU868 and US915 bands are defined.
Index ¶
- type Configuration
- type DownlinkParameters
- type EU868
- func (b EU868) Configuration() *Configuration
- func (b EU868) Encoding(dataRate uint8) (Encoding, error)
- func (b EU868) GetDataRate(configuration string) (uint8, error)
- func (b EU868) GetRX1Parameters(channel uint8, upstreamFrequency float32, upstreamDataRate uint8, ...) (DownlinkParameters, error)
- func (b EU868) GetRX2Parameters() DownlinkParameters
- func (b EU868) MaximumPayload(dataRate string) (MaximumPayloadSize, error)
- func (b EU868) Name() string
- func (b EU868) TxPower(power uint8) (int8, error)
- type Encoding
- type FrequencyBandType
- type FrequencyPlan
- type MaximumPayloadSize
- type ModulationType
- type RXWindowType
- type US902
- func (b US902) Configuration() *Configuration
- func (b US902) Encoding(dataRate uint8) (Encoding, error)
- func (b US902) GetDataRate(configuration string) (uint8, error)
- func (b US902) GetRX1Parameters(channel uint8, upstreamFrequency float32, upstreamDataRate uint8, ...) (DownlinkParameters, error)
- func (b US902) GetRX2Parameters() DownlinkParameters
- func (b US902) MaximumPayload(dataRate string) (MaximumPayloadSize, error)
- func (b US902) Name() string
- func (b US902) TxPower(power uint8) (int8, error)
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { // ReceiveDelay1 is the delay (in seconds) before the first receive window opens after an uplink transmission [3.3.1]. ReceiveDelay1 uint8 // ReceiveDelay1 is the delay (in seconds) before the second receive window opens after an uplink transmission [3.3.2]. ReceiveDelay2 uint8 // JoinAccepDelay1 is the delay (in seconds) before the first window that the server can respond to a join-request message // with a join-accept message [6.2.5]. JoinAccepDelay1 uint8 // JoinAccepDelay2 is the delay (in seconds) before the first window that the server can respond to a join-request message // with a join-accept message [6.2.5]. JoinAccepDelay2 uint8 // MaxFCntGap is compared to FCnt. If the difference i greater than MaxFCntGap, then too many frames ha been lost, // and subsequent frames will be discarded [4.3.1.5]. MaxFCntGap uint32 // AdrAckLimit is used by the device to validate that the network still received uplink frames [4.3.3.1]. AdrAckLimit uint32 // AdrAckLimit is used by the device to validate that the network still received uplink frames [4.3.3.1]. AdrAckDelay uint32 // DefaultTXPower is the default radiated transmit output power in dBm [[6.25, band sub-chapters in 7]]. DefaultTxPower uint8 // SupportsJoinAcceptCFList indicates if the band support the optional list of channel freequencies for // the network the end-device is joining [Band sub-chapters in 7]. SupportsJoinAcceptCFList bool // RX2Frequency is the default band frequency for the second receive window [Band sub-chapters in 7]. RX2Frequency float32 // RX2DataRate is the default data rate for the second receive window [Band sub-chapters in 7]. RX2DataRate uint8 MandatoryEndDeviceChannels []float32 JoinReqChannels []float32 DownLinkFrequencies []float32 }
Configuration represents frequency band specific LoRa parameters.
func (*Configuration) AckTimeout ¶
func (c *Configuration) AckTimeout() int
AckTimeout is the max delay limit (in seconds after the second receive window) for when then the network can send a frame with the ACK bit set in response to a ConfirmedData message [18.1].
type DownlinkParameters ¶
type DownlinkParameters struct { // DataRate used for downlink DataRate uint8 // Frequency used for downlink Frequency float32 }
DownlinkParameters contains datarate and frequency
type EU868 ¶
type EU868 struct { DownstreamDataRates [][]uint8 // contains filtered or unexported fields }
EU868 represents configuration and frequency plan for the EU 863-870MHz ISM Band.
func (EU868) Configuration ¶
func (b EU868) Configuration() *Configuration
Configuration returns parameters for the EU 863-870MHz ISM Band.
func (EU868) Encoding ¶
Encoding returns a description of modulation, spread factor and bit rate for the EU 863-870MHz ISM Band, given a data rate. [7.1.3]
func (EU868) GetDataRate ¶
GetDataRate returns data rate, given gateway representation of configuration
func (EU868) GetRX1Parameters ¶
func (b EU868) GetRX1Parameters(channel uint8, upstreamFrequency float32, upstreamDataRate uint8, RX1DROffset uint8) (DownlinkParameters, error)
GetRX1Parameters returns datarate and frequency for downlink in receive window 1, given upstream data rate and RX1DROffset
func (EU868) GetRX2Parameters ¶
func (b EU868) GetRX2Parameters() DownlinkParameters
GetRX2Parameters returns datarate and frequency for downlink in receive window 2.
func (EU868) MaximumPayload ¶
func (b EU868) MaximumPayload(dataRate string) (MaximumPayloadSize, error)
MaximumPayload return a maximum payload size, given a data rate. This implementation uses the repeater compatible definition in the LoRaWAN specification. [7.1.6]
type Encoding ¶
type Encoding struct { // Modulation is LoRa or FSK Modulation ModulationType // Spread factor (imho not described very well in the LoRa specification.) SpreadFactor uint8 // BitRate is in bit/s BitRate uint32 // Bandwidth applies to LoRa modulation only Bandwidth uint32 }
Encoding holds the data rate specific spread factor, frequency and bit rate parameters
type FrequencyBandType ¶
type FrequencyBandType uint8
FrequencyBandType is the frequency band type
const ( // EU868Band is the EU 863-870MHz ISM Band EU868Band FrequencyBandType = iota // US915Band is the US 902-928MHz ISM Band US915Band // CN780Band is the China 779-787MHz ISM Band CN780Band // EU433Band is the EU 433MHz ISM Band EU433Band )
type FrequencyPlan ¶
type FrequencyPlan interface { // Configuration returns band frequency parameters Configuration() *Configuration // Encoding returns band frequency encoding parameters Encoding(dataRate uint8) (Encoding, error) // MaximumPayload return a maximum payload size, given a data rate. // This implementation uses the repeater compatible definition in the LoRaWAN specification. MaximumPayload(dataRate string) (MaximumPayloadSize, error) // TxPower returns power in dBm for theb and, given a TXPower key TxPower(power uint8) (int8, error) // GetRX1Parameters returns datarate and frequency for downlink in receive window 1, given upstream data rate and RX1DROffset GetRX1Parameters(channel uint8, upstreamFrequency float32, upstreamDataRate uint8, RX1DROffset uint8) (DownlinkParameters, error) // GetRX2Parameters returns datarate and frequency for downlink in receive window 2. GetRX2Parameters() DownlinkParameters // GetDataRate returns data rate, given gateway representation of configuration GetDataRate(configuration string) (uint8, error) // Name returns frequencey band name. Name() string }
FrequencyPlan is the interface for band specific parameters
func NewBand ¶
func NewBand(band FrequencyBandType) (FrequencyPlan, error)
NewBand creates a new band configuration
type MaximumPayloadSize ¶
type MaximumPayloadSize struct { // M is max payload length if FOpts is present. M uint8 // N is max payload length if FOpts is not present. N uint8 }
MaximumPayloadSize defines max payload size
func (*MaximumPayloadSize) WithFOpts ¶
func (m *MaximumPayloadSize) WithFOpts() uint8
WithFOpts return max payload if FOpts is present.
func (*MaximumPayloadSize) WithoutFOpts ¶
func (m *MaximumPayloadSize) WithoutFOpts() uint8
WithoutFOpts return max payload if FOpts is not present.
type ModulationType ¶
type ModulationType uint8
ModulationType is the message type
const ( // LoRa is LoRa modulation LoRa ModulationType = 0 // FSK is FSK modulation FSK ModulationType = 1 )
type RXWindowType ¶
type RXWindowType uint8
RXWindowType is the RX window type
const ( // RX1 is receive window 1 RX1 RXWindowType = 0 // RX2 is receive window 2 RX2 RXWindowType = 1 )
type US902 ¶
type US902 struct { DownstreamDataRates [][]uint8 DownstreamChannels []float32 // contains filtered or unexported fields }
US902 represents configuration and frequency plan for the US 902-928MHz ISM Band.
func (US902) Configuration ¶
func (b US902) Configuration() *Configuration
Configuration returns parameters for the US 902-928MHz ISM Band.
func (US902) Encoding ¶
Encoding returns a description of modulation, spread factor and bit rate for the US 902-928MHz ISM Band, given a data rate. [7.2.3]
func (US902) GetDataRate ¶
GetDataRate returns data rate, given gateway representation of configuration (DR4 is identical to DR12. Defaulting to DR4)
func (US902) GetRX1Parameters ¶
func (b US902) GetRX1Parameters(channel uint8, upstreamFrequency float32, upstreamDataRate uint8, RX1DROffset uint8) (DownlinkParameters, error)
GetRX1Parameters returns datarate and frequency for downlink in receive window 1, given upstream data rate and RX1DROffset
func (US902) GetRX2Parameters ¶
func (b US902) GetRX2Parameters() DownlinkParameters
GetRX2Parameters returns datarate and frequency for downlink in receive window 2.
func (US902) MaximumPayload ¶
func (b US902) MaximumPayload(dataRate string) (MaximumPayloadSize, error)
MaximumPayload return a maximum payload size, given a data rate. This implementation uses the repeater compatible definition in the LoRaWAN specification. [7.2.6]
Notes ¶
Bugs ¶
No LinkAdrReq support yet.
No CFList support yet.
No NewChannelReq support yet.