forked from TheThingsArchive/ttn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
band_eu863_870.go
113 lines (96 loc) · 3.39 KB
/
band_eu863_870.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright © 2016 The Things Network
// Copyright © 2016 Orne Brocaar
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.
package eu863_870
import (
"errors"
"time"
. "github.com/LoRaWanSoFa/ttn/core/band"
)
// Name defines the name of the band
const Name = "EU 863-870"
// DataRateConfiguration defines the available data rates
var DataRateConfiguration = [...]DataRate{
{Modulation: LoRaModulation, SpreadFactor: 12, Bandwidth: 125},
{Modulation: LoRaModulation, SpreadFactor: 11, Bandwidth: 125},
{Modulation: LoRaModulation, SpreadFactor: 10, Bandwidth: 125},
{Modulation: LoRaModulation, SpreadFactor: 9, Bandwidth: 125},
{Modulation: LoRaModulation, SpreadFactor: 8, Bandwidth: 125},
{Modulation: LoRaModulation, SpreadFactor: 7, Bandwidth: 125},
{Modulation: LoRaModulation, SpreadFactor: 7, Bandwidth: 250},
{Modulation: FSKModulation, BitRate: 50000},
}
// DefaultTXPower defines the default TX power in dBm
const DefaultTXPower = 14
// CFListAllowed defines if the optional JoinAccept CFList is allowed for this band
const CFListAllowed = true
// TXPowerConfiguration defines the available TXPower settings in dBm
var TXPowerConfiguration = [...]int{
20, // if supported
14,
11,
8,
5,
2,
}
// MACPayloadSizeConfiguration defines the maximum payload size for each data rate
var MACPayloadSizeConfiguration = [...]MaxPayloadSize{
{M: 59, N: 51},
{M: 59, N: 51},
{M: 59, N: 51},
{M: 123, N: 115},
{M: 230, N: 222},
{M: 230, N: 222},
{M: 230, N: 222},
{M: 230, N: 222},
}
// RX1DROffsetConfiguration defines the available RX1DROffset configurations
// per data rate.
var RX1DROffsetConfiguration = [...][6]int{
{0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0},
{2, 1, 0, 0, 0, 0},
{3, 2, 1, 0, 0, 0},
{4, 3, 2, 1, 0, 0},
{5, 4, 3, 2, 1, 0},
{6, 5, 4, 3, 2, 1},
{7, 6, 5, 4, 3, 2},
}
// RX2Frequency defines the RX2 receive window frequency to use (in Hz)
const RX2Frequency = 869525000
// RX2DataRate defines the RX2 receive window data rate to use
const RX2DataRate = 0
// UplinkChannelConfiguration defines the (default) available uplink channels
var UplinkChannelConfiguration = [...]Channel{
{Frequency: 868100000, DataRates: []int{0, 1, 2, 3, 4, 5}},
{Frequency: 868300000, DataRates: []int{0, 1, 2, 3, 4, 5}},
{Frequency: 868500000, DataRates: []int{0, 1, 2, 3, 4, 5}},
}
// DownlinkChannelConfiguration defines the (default) available downlink channels.
var DownlinkChannelConfiguration = UplinkChannelConfiguration
// GetDataRate returns the index of the given DataRate.
func GetDataRate(dr DataRate) (int, error) {
for i, d := range DataRateConfiguration {
if d == dr {
return i, nil
}
}
return 0, errors.New("lorawan/band: the given DataRate does not exist")
}
// GetRX1Frequency returns the frequency to be used for RX1 given
// the uplink frequency and data rate.
func GetRX1Frequency(frequency, dataRate int) (int, error) {
return frequency, nil
}
// Default settings for this band
const (
ReceiveDelay1 time.Duration = time.Second
ReceiveDelay2 time.Duration = time.Second * 2
JoinAcceptDelay1 time.Duration = time.Second * 5
JoinAcceptDelay2 time.Duration = time.Second * 6
MaxFCntGap uint32 = 16384
ADRAckLimit = 64
ADRAckDelay = 32
AckTimeoutMin time.Duration = time.Second // AckTimeout = 2 +/- 1 (random value between 1 - 3)
AckTimeoutMax time.Duration = time.Second * 3
)