This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
lorawan.proto
163 lines (128 loc) · 5.13 KB
/
lorawan.proto
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
157
158
159
160
161
162
163
// Copyright © 2017 The Things Network
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.
syntax = "proto3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
package lorawan;
option csharp_namespace = "TheThingsNetwork.API.LoRaWANProtocol";
option go_package = "github.com/TheThingsNetwork/api/protocol/lorawan";
option java_package = "org.thethingsnetwork.api.protocol.lorawan";
option java_outer_classname = "LoRaWANProto";
option java_multiple_files = true;
enum Modulation {
LORA = 0;
FSK = 1;
}
message Metadata {
Modulation modulation = 11;
// LoRa data rate - SF{spreadingfactor}BW{bandwidth}
string data_rate = 12;
// FSK bit rate in bit/s
uint32 bit_rate = 13;
// LoRa coding rate
string coding_rate = 14;
// Store the full 32 bit FCnt (deprecated; do not use)
uint32 f_cnt = 15;
FrequencyPlan frequency_plan = 16;
}
message TxConfiguration {
Modulation modulation = 11;
// LoRa data rate - SF{spreadingfactor}BW{bandwidth}
string data_rate = 12;
// FSK bit rate in bit/s
uint32 bit_rate = 13;
// LoRa coding rate
string coding_rate = 14;
// Store the full 32 bit FCnt (deprecated; do not use)
uint32 f_cnt = 15;
}
message ActivationMetadata {
bytes app_eui = 1 [(gogoproto.customname) = "AppEUI", (gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.AppEUI"];
bytes dev_eui = 2 [(gogoproto.customname) = "DevEUI", (gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.DevEUI"];
bytes dev_addr = 3 [(gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.DevAddr"];
bytes nwk_s_key = 4 [(gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.NwkSKey"];
uint32 rx1_dr_offset = 11 [(gogoproto.customname) = "Rx1DROffset"];
uint32 rx2_dr = 12 [(gogoproto.customname) = "Rx2DR"];
uint32 rx_delay = 13;
CFList cf_list = 14 [(gogoproto.customname) = "CFList"];
FrequencyPlan frequency_plan = 15;
}
enum FrequencyPlan {
EU_863_870 = 0;
US_902_928 = 1;
CN_779_787 = 2;
EU_433 = 3;
AU_915_928 = 4;
CN_470_510 = 5;
AS_923 = 6;
AS_920_923 = 61;
AS_923_925 = 62;
KR_920_923 = 7;
IN_865_867 = 8;
RU_864_870 = 9;
}
message Message {
MHDR m_hdr = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
bytes mic = 2 [(gogoproto.customname) = "MIC"];
oneof Payload {
MACPayload mac_payload = 3 [(gogoproto.customname) = "MACPayload"];
JoinRequestPayload join_request_payload = 4;
JoinAcceptPayload join_accept_payload = 5;
}
}
enum Major {
LORAWAN_R1 = 0;
}
enum MType {
JOIN_REQUEST = 0;
JOIN_ACCEPT = 1;
UNCONFIRMED_UP = 2;
UNCONFIRMED_DOWN = 3;
CONFIRMED_UP = 4;
CONFIRMED_DOWN = 5;
}
message MHDR {
MType m_type = 1;
Major major = 2;
}
message MACPayload {
FHDR f_hdr = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
int32 f_port = 2;
bytes frm_payload = 3 [(gogoproto.customname) = "FRMPayload"];
}
message FHDR {
bytes dev_addr = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.DevAddr"];
FCtrl f_ctrl = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 f_cnt = 3;
repeated MACCommand f_opts = 4 [(gogoproto.nullable) = false];
}
message FCtrl {
bool adr = 1 [(gogoproto.customname) = "ADR"];
bool adr_ack_req = 2 [(gogoproto.customname) = "ADRAckReq"];
bool ack = 3;
bool f_pending = 4;
}
message MACCommand {
uint32 cid = 1 [(gogoproto.customname) = "CID"];
bytes payload = 2;
}
message JoinRequestPayload {
bytes app_eui = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "AppEUI", (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.AppEUI"];
bytes dev_eui = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "DevEUI", (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.DevEUI"];
bytes dev_nonce = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.DevNonce"];
}
message JoinAcceptPayload {
bytes encrypted = 1;
bytes app_nonce = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.AppNonce"];
bytes net_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "NetID", (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.NetID"];
bytes dev_addr = 4 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/TheThingsNetwork/ttn/core/types.DevAddr"];
DLSettings dl_settings = 5 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 rx_delay = 6;
CFList cf_list = 7 [(gogoproto.customname) = "CFList"];
}
message DLSettings {
uint32 rx1_dr_offset = 1 [(gogoproto.customname) = "Rx1DROffset"];
uint32 rx2_dr = 2 [(gogoproto.customname) = "Rx2DR"];
}
message CFList {
repeated uint32 freq = 1;
}