-
Notifications
You must be signed in to change notification settings - Fork 301
/
as_923.go
156 lines (131 loc) · 4.19 KB
/
as_923.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package band
import (
"go.thethings.network/lorawan-stack/v3/pkg/ttnpb"
)
//revive:disable:var-naming
var as_923 Band
// AS_923 is the ID of the Asian 923Mhz band
const AS_923 = "AS_923"
//revive:enable:var-naming
func init() {
defaultChannels := []Channel{
{
Frequency: 923200000,
MaxDataRate: ttnpb.DATA_RATE_5,
},
{
Frequency: 923400000,
MaxDataRate: ttnpb.DATA_RATE_5,
},
}
const beaconFrequency = 923400000
as_923 = Band{
ID: AS_923,
EnableADR: true,
MaxUplinkChannels: 16,
UplinkChannels: defaultChannels,
MaxDownlinkChannels: 16,
DownlinkChannels: defaultChannels,
SubBands: []SubBandParameters{
{
MinFrequency: 923000000,
MaxFrequency: 923500000,
DutyCycle: 0.01,
MaxEIRP: 16,
},
},
DataRates: map[ttnpb.DataRateIndex]DataRate{
ttnpb.DATA_RATE_0: makeLoRaDataRate(12, 125000, makeDwellTimeMaxMACPayloadSizeFunc(59, 0)),
ttnpb.DATA_RATE_1: makeLoRaDataRate(11, 125000, makeDwellTimeMaxMACPayloadSizeFunc(59, 0)),
ttnpb.DATA_RATE_2: makeLoRaDataRate(10, 125000, makeDwellTimeMaxMACPayloadSizeFunc(59, 19)),
ttnpb.DATA_RATE_3: makeLoRaDataRate(9, 125000, makeDwellTimeMaxMACPayloadSizeFunc(123, 61)),
ttnpb.DATA_RATE_4: makeLoRaDataRate(8, 125000, makeDwellTimeMaxMACPayloadSizeFunc(230, 133)),
ttnpb.DATA_RATE_5: makeLoRaDataRate(7, 125000, makeDwellTimeMaxMACPayloadSizeFunc(230, 250)),
ttnpb.DATA_RATE_6: makeLoRaDataRate(7, 250000, makeDwellTimeMaxMACPayloadSizeFunc(230, 250)),
ttnpb.DATA_RATE_7: makeFSKDataRate(50000, makeDwellTimeMaxMACPayloadSizeFunc(230, 250)),
},
MaxADRDataRateIndex: ttnpb.DATA_RATE_5,
ReceiveDelay1: defaultReceiveDelay1,
ReceiveDelay2: defaultReceiveDelay2,
JoinAcceptDelay1: defaultJoinAcceptDelay1,
JoinAcceptDelay2: defaultJoinAcceptDelay2,
MaxFCntGap: defaultMaxFCntGap,
ADRAckLimit: defaultADRAckLimit,
ADRAckDelay: defaultADRAckDelay,
MinAckTimeout: defaultAckTimeout - defaultAckTimeoutMargin,
MaxAckTimeout: defaultAckTimeout + defaultAckTimeoutMargin,
DefaultMaxEIRP: 16,
TxOffset: []float32{
0,
-2,
-4,
-6,
-8,
-10,
-12,
-14,
},
LoRaCodingRate: "4/5",
FreqMultiplier: 100,
ImplementsCFList: true,
CFListType: ttnpb.CFListType_FREQUENCIES,
Rx1Channel: channelIndexIdentity,
Rx1DataRate: func(idx ttnpb.DataRateIndex, offset uint32, dwellTime bool) (ttnpb.DataRateIndex, error) {
if offset > 7 {
return 0, errDataRateOffsetTooHigh.WithAttributes("max", 7)
}
so := int8(offset)
if so > 5 {
so = 5 - so
}
si := int8(idx) - so
minDR := ttnpb.DATA_RATE_0
if dwellTime {
minDR = ttnpb.DATA_RATE_2
}
switch {
case si <= int8(minDR):
return minDR, nil
case si >= 5:
return ttnpb.DATA_RATE_5, nil
}
return ttnpb.DataRateIndex(si), nil
},
GenerateChMasks: generateChMask16,
ParseChMask: parseChMask16,
DefaultRx2Parameters: Rx2Parameters{ttnpb.DATA_RATE_2, 923200000},
Beacon: Beacon{
DataRateIndex: ttnpb.DATA_RATE_3,
CodingRate: "4/5",
ComputeFrequency: func(_ float64) uint64 { return beaconFrequency },
},
PingSlotFrequency: uint64Ptr(beaconFrequency),
TxParamSetupReqSupport: true,
// No LoRaWAN Regional Parameters 1.0
// No LoRaWAN Regional Parameters 1.0.1
regionalParameters1_0_2RevA: composeSwaps(
func(b Band) Band {
b.DefaultMaxEIRP = 14
return b
},
makeSetMaxTxPowerIndexFunc(5),
),
regionalParameters1_0_2RevB: bandIdentity,
regionalParameters1_0_3RevA: bandIdentity,
regionalParameters1_1RevA: bandIdentity,
}
All[AS_923] = as_923
}