@@ -31,20 +31,20 @@ class LoRaWANBase {
31
31
*
32
32
* @param queue A pointer to EventQueue provided by the application.
33
33
*
34
- * @return LORA_MAC_STATUS_OK on success, a negative error code on
34
+ * @return LORAWAN_STATUS_OK on success, a negative error code on
35
35
* failure.
36
36
*/
37
- virtual lora_mac_status_t initialize (events::EventQueue *queue) = 0;
37
+ virtual lorawan_status_t initialize (events::EventQueue *queue) = 0;
38
38
39
39
/* * Connect OTAA or ABP by setup.
40
40
*
41
41
* Connect by Over The Air Activation or Activation By Personalization.
42
42
* The connection type is selected at the setup.
43
43
*
44
- * @return LORA_MAC_STATUS_OK on success, a negative error code on
44
+ * @return LORAWAN_STATUS_OK on success, a negative error code on
45
45
* failure.
46
46
*/
47
- virtual lora_mac_status_t connect () = 0;
47
+ virtual lorawan_status_t connect () = 0;
48
48
49
49
/* * Connect OTAA or ABP by parameters
50
50
*
@@ -53,46 +53,78 @@ class LoRaWANBase {
53
53
* You need to define the parameters in the main application.
54
54
*
55
55
* @param connect Options how end-device will connect to gateway
56
- * @return LORA_MAC_STATUS_OK on success, negative error code
56
+ * @return LORAWAN_STATUS_OK on success, negative error code
57
57
* on failure
58
58
*/
59
- virtual lora_mac_status_t connect (const lorawan_connect_t &connect) = 0;
59
+ virtual lorawan_status_t connect (const lorawan_connect_t &connect) = 0;
60
60
61
61
/* * Disconnects the current session.
62
62
*
63
- * @return LORA_MAC_STATUS_OK on success, a negative error code on failure.
63
+ * @return LORAWAN_STATUS_OK on success, a negative error code on failure.
64
64
*/
65
- virtual lora_mac_status_t disconnect () = 0;
65
+ virtual lorawan_status_t disconnect () = 0;
66
+
67
+ /* * Validate the connectivity with the network.
68
+ *
69
+ * Application may use this API to submit a request to the stack for
70
+ * validation of its connectivity to a Network Server. Under the hood, this
71
+ * API schedules a Link Check Request command (LinkCheckReq) for the network
72
+ * server and once the response, i.e., LinkCheckAns MAC command is received
73
+ * from the Network Server, user provided method is called.
74
+ *
75
+ * This API is usable only when the link check response is callback set by
76
+ * the application. See add_lora_app_callbacks API. If the above mentioned
77
+ * callback is not set, a LORAWAN_STATUS_PARAMETER_INVALID error is thrown.
78
+ *
79
+ * First parameter to callback function is the demodulation margin and
80
+ * the second parameter is the number of gateways that successfully received
81
+ * the last request.
82
+ *
83
+ * A 'Link Check Request' MAC command remains set for every subsequent
84
+ * transmission, until/unless application explicitly turns it off using
85
+ * remove_link_check_request() API.
86
+ *
87
+ * @return LORAWAN_STATUS_OK on successfully queuing a request, or
88
+ * a negative error code on failure.
89
+ *
90
+ */
91
+ virtual lorawan_status_t add_link_check_request () = 0;
92
+
93
+ /* * Detaches Link Request MAC command.
94
+ *
95
+ * Removes sticky MAC command for link check request.
96
+ */
97
+ virtual void remove_link_check_request () = 0;
66
98
67
99
/* * Sets up a particular data rate of choice
68
100
*
69
101
* @param data_rate Intended data rate e.g., DR_0, DR_1 etc.
70
102
* Caution is advised as the macro DR_* can mean different
71
103
* things while being in a different region.
72
- * @return LORA_MAC_STATUS_OK if everything goes well, otherwise
104
+ * @return LORAWAN_STATUS_OK if everything goes well, otherwise
73
105
* a negative error code.
74
106
*/
75
- virtual lora_mac_status_t set_datarate (uint8_t data_rate) = 0;
107
+ virtual lorawan_status_t set_datarate (uint8_t data_rate) = 0;
76
108
77
109
/* * Enables adaptive data rate (ADR)
78
110
*
79
111
* Underlying LoRaPHY and LoRaMac layers handle the data rate automatically
80
112
* for the user based upon radio conditions (network congestion).
81
113
*
82
- * @return LORA_MAC_STATUS_OK on success, negative error code
114
+ * @return LORAWAN_STATUS_OK on success, negative error code
83
115
* on failure.
84
116
*/
85
- virtual lora_mac_status_t enable_adaptive_datarate () = 0;
117
+ virtual lorawan_status_t enable_adaptive_datarate () = 0;
86
118
87
119
/* * Disables adaptive data rate
88
120
*
89
121
* When adaptive data rate (ADR) is disabled, user can either set a certain
90
122
* data rate or the Mac layer will choose a default value.
91
123
*
92
- * @return LORA_MAC_STATUS_OK on success, negative error code
124
+ * @return LORAWAN_STATUS_OK on success, negative error code
93
125
* on failure.
94
126
*/
95
- virtual lora_mac_status_t disable_adaptive_datarate () = 0;
127
+ virtual lorawan_status_t disable_adaptive_datarate () = 0;
96
128
97
129
/* * Sets up retry counter for confirmed messages
98
130
*
@@ -108,36 +140,36 @@ class LoRaWANBase {
108
140
*
109
141
* @param count number of retries for confirmed messages
110
142
*
111
- * @return LORA_MAC_STATUS_OK or a negative error code
143
+ * @return LORAWAN_STATUS_OK or a negative error code
112
144
*/
113
- virtual lora_mac_status_t set_confirmed_msg_retries (uint8_t count) = 0;
145
+ virtual lorawan_status_t set_confirmed_msg_retries (uint8_t count) = 0;
114
146
115
147
/* * Sets channel plan
116
148
*
117
149
* @param channel_plan The defined channel plans to be set.
118
150
* @return 0 on success, a negative error code on failure.
119
151
*/
120
- virtual lora_mac_status_t set_channel_plan (const lora_channelplan_t &channel_plan) = 0;
152
+ virtual lorawan_status_t set_channel_plan (const lorawan_channelplan_t &channel_plan) = 0;
121
153
122
154
/* * Gets the current channel plan.
123
155
*
124
156
* @param channel_plan The current channel information.
125
157
*
126
- * @return LORA_MAC_STATUS_OK on success, a negative error
158
+ * @return LORAWAN_STATUS_OK on success, a negative error
127
159
* code on failure.
128
160
*/
129
- virtual lora_mac_status_t get_channel_plan (lora_channelplan_t &channel_plan) = 0;
161
+ virtual lorawan_status_t get_channel_plan (lorawan_channelplan_t &channel_plan) = 0;
130
162
131
163
/* * Removes currently active channel plan
132
164
*
133
165
* Default channels (channels where Base Stations are listening) are not
134
166
* allowed to be removed. So when a plan is abolished, only non-default
135
167
* channels are removed.
136
168
*
137
- * @return LORA_MAC_STATUS_OK on success, negative error
169
+ * @return LORAWAN_STATUS_OK on success, negative error
138
170
* code on failure
139
171
*/
140
- virtual lora_mac_status_t remove_channel_plan () = 0;
172
+ virtual lorawan_status_t remove_channel_plan () = 0;
141
173
142
174
/* * Removes a given single channel
143
175
*
@@ -146,10 +178,10 @@ class LoRaWANBase {
146
178
*
147
179
* @param index The channel index
148
180
*
149
- * @return LORA_MAC_STATUS_OK on success, negative error
181
+ * @return LORAWAN_STATUS_OK on success, negative error
150
182
* code on failure
151
183
*/
152
- virtual lora_mac_status_t remove_channel (uint8_t index) = 0;
184
+ virtual lorawan_status_t remove_channel (uint8_t index) = 0;
153
185
154
186
/* * Send message to gateway
155
187
*
@@ -182,7 +214,7 @@ class LoRaWANBase {
182
214
*
183
215
*
184
216
* @return The number of bytes sent, or
185
- * LORA_MAC_STATUS_WOULD_BLOCK if another TX is
217
+ * LORAWAN_STATUS_WOULD_BLOCK if another TX is
186
218
* ongoing, or a negative error code on failure.
187
219
*/
188
220
virtual int16_t send (uint8_t port, const uint8_t * data,
@@ -223,7 +255,7 @@ class LoRaWANBase {
223
255
* @return It could be one of these:
224
256
* i) 0 if there is nothing else to read.
225
257
* ii) Number of bytes written to user buffer.
226
- * iii) LORA_MAC_STATUS_WOULD_BLOCK if there is
258
+ * iii) LORAWAN_STATUS_WOULD_BLOCK if there is
227
259
* nothing available to read at the moment.
228
260
* iv) A negative error code on failure.
229
261
*/
@@ -298,7 +330,7 @@ class LoRaWANBase {
298
330
* @param callbacks A pointer to the structure containing application
299
331
* callbacks.
300
332
*/
301
- virtual lora_mac_status_t add_app_callbacks (lorawan_app_callbacks_t *callbacks) = 0;
333
+ virtual lorawan_status_t add_app_callbacks (lorawan_app_callbacks_t *callbacks) = 0;
302
334
};
303
335
304
336
#endif /* LORAWAN_BASE_H_ */
0 commit comments