BBR 1 Ebene

Committer:
borlanic
Date:
Mon May 14 11:29:06 2018 +0000
Revision:
0:fbdae7e6d805
BBR

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:fbdae7e6d805 1 /**
borlanic 0:fbdae7e6d805 2 * Copyright (c) 2017, Arm Limited and affiliates.
borlanic 0:fbdae7e6d805 3 * SPDX-License-Identifier: Apache-2.0
borlanic 0:fbdae7e6d805 4 *
borlanic 0:fbdae7e6d805 5 * Licensed under the Apache License, Version 2.0 (the "License");
borlanic 0:fbdae7e6d805 6 * you may not use this file except in compliance with the License.
borlanic 0:fbdae7e6d805 7 * You may obtain a copy of the License at
borlanic 0:fbdae7e6d805 8 *
borlanic 0:fbdae7e6d805 9 * http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:fbdae7e6d805 10 *
borlanic 0:fbdae7e6d805 11 * Unless required by applicable law or agreed to in writing, software
borlanic 0:fbdae7e6d805 12 * distributed under the License is distributed on an "AS IS" BASIS,
borlanic 0:fbdae7e6d805 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:fbdae7e6d805 14 * See the License for the specific language governing permissions and
borlanic 0:fbdae7e6d805 15 * limitations under the License.
borlanic 0:fbdae7e6d805 16 */
borlanic 0:fbdae7e6d805 17
borlanic 0:fbdae7e6d805 18
borlanic 0:fbdae7e6d805 19 #ifndef LORAWAN_BASE_H_
borlanic 0:fbdae7e6d805 20 #define LORAWAN_BASE_H_
borlanic 0:fbdae7e6d805 21
borlanic 0:fbdae7e6d805 22 #include "events/EventQueue.h"
borlanic 0:fbdae7e6d805 23 #include "lorawan_types.h"
borlanic 0:fbdae7e6d805 24
borlanic 0:fbdae7e6d805 25 class LoRaWANBase {
borlanic 0:fbdae7e6d805 26
borlanic 0:fbdae7e6d805 27 public:
borlanic 0:fbdae7e6d805 28 /** Initialize the LoRa stack.
borlanic 0:fbdae7e6d805 29 *
borlanic 0:fbdae7e6d805 30 * You must call this before using the LoRa stack.
borlanic 0:fbdae7e6d805 31 *
borlanic 0:fbdae7e6d805 32 * @param queue A pointer to EventQueue provided by the application.
borlanic 0:fbdae7e6d805 33 *
borlanic 0:fbdae7e6d805 34 * @return LORAWAN_STATUS_OK on success, a negative error code on
borlanic 0:fbdae7e6d805 35 * failure.
borlanic 0:fbdae7e6d805 36 */
borlanic 0:fbdae7e6d805 37 virtual lorawan_status_t initialize(events::EventQueue *queue) = 0;
borlanic 0:fbdae7e6d805 38
borlanic 0:fbdae7e6d805 39 /** Connect OTAA or ABP by setup.
borlanic 0:fbdae7e6d805 40 *
borlanic 0:fbdae7e6d805 41 * Connect by Over The Air Activation or Activation By Personalization.
borlanic 0:fbdae7e6d805 42 * The connection type is selected at the setup.
borlanic 0:fbdae7e6d805 43 *
borlanic 0:fbdae7e6d805 44 * @return LORAWAN_STATUS_OK on success, a negative error code on
borlanic 0:fbdae7e6d805 45 * failure.
borlanic 0:fbdae7e6d805 46 */
borlanic 0:fbdae7e6d805 47 virtual lorawan_status_t connect() = 0;
borlanic 0:fbdae7e6d805 48
borlanic 0:fbdae7e6d805 49 /** Connect OTAA or ABP by parameters
borlanic 0:fbdae7e6d805 50 *
borlanic 0:fbdae7e6d805 51 * Connect by Over The Air Activation or Activation By Personalization.
borlanic 0:fbdae7e6d805 52 * The connection type is selected using the parameters.
borlanic 0:fbdae7e6d805 53 * You need to define the parameters in the main application.
borlanic 0:fbdae7e6d805 54 *
borlanic 0:fbdae7e6d805 55 * @param connect Options how end-device will connect to gateway
borlanic 0:fbdae7e6d805 56 * @return LORAWAN_STATUS_OK on success, negative error code
borlanic 0:fbdae7e6d805 57 * on failure
borlanic 0:fbdae7e6d805 58 */
borlanic 0:fbdae7e6d805 59 virtual lorawan_status_t connect(const lorawan_connect_t &connect) = 0;
borlanic 0:fbdae7e6d805 60
borlanic 0:fbdae7e6d805 61 /** Disconnects the current session.
borlanic 0:fbdae7e6d805 62 *
borlanic 0:fbdae7e6d805 63 * @return LORAWAN_STATUS_OK on success, a negative error code on failure.
borlanic 0:fbdae7e6d805 64 */
borlanic 0:fbdae7e6d805 65 virtual lorawan_status_t disconnect() = 0;
borlanic 0:fbdae7e6d805 66
borlanic 0:fbdae7e6d805 67 /** Validate the connectivity with the network.
borlanic 0:fbdae7e6d805 68 *
borlanic 0:fbdae7e6d805 69 * Application may use this API to submit a request to the stack for
borlanic 0:fbdae7e6d805 70 * validation of its connectivity to a Network Server. Under the hood, this
borlanic 0:fbdae7e6d805 71 * API schedules a Link Check Request command (LinkCheckReq) for the network
borlanic 0:fbdae7e6d805 72 * server and once the response, i.e., LinkCheckAns MAC command is received
borlanic 0:fbdae7e6d805 73 * from the Network Server, user provided method is called.
borlanic 0:fbdae7e6d805 74 *
borlanic 0:fbdae7e6d805 75 * This API is usable only when the link check response is callback set by
borlanic 0:fbdae7e6d805 76 * the application. See add_lora_app_callbacks API. If the above mentioned
borlanic 0:fbdae7e6d805 77 * callback is not set, a LORAWAN_STATUS_PARAMETER_INVALID error is thrown.
borlanic 0:fbdae7e6d805 78 *
borlanic 0:fbdae7e6d805 79 * First parameter to callback function is the demodulation margin and
borlanic 0:fbdae7e6d805 80 * the second parameter is the number of gateways that successfully received
borlanic 0:fbdae7e6d805 81 * the last request.
borlanic 0:fbdae7e6d805 82 *
borlanic 0:fbdae7e6d805 83 * A 'Link Check Request' MAC command remains set for every subsequent
borlanic 0:fbdae7e6d805 84 * transmission, until/unless application explicitly turns it off using
borlanic 0:fbdae7e6d805 85 * remove_link_check_request() API.
borlanic 0:fbdae7e6d805 86 *
borlanic 0:fbdae7e6d805 87 * @return LORAWAN_STATUS_OK on successfully queuing a request, or
borlanic 0:fbdae7e6d805 88 * a negative error code on failure.
borlanic 0:fbdae7e6d805 89 *
borlanic 0:fbdae7e6d805 90 */
borlanic 0:fbdae7e6d805 91 virtual lorawan_status_t add_link_check_request() = 0;
borlanic 0:fbdae7e6d805 92
borlanic 0:fbdae7e6d805 93 /** Detaches Link Request MAC command.
borlanic 0:fbdae7e6d805 94 *
borlanic 0:fbdae7e6d805 95 * Removes sticky MAC command for link check request.
borlanic 0:fbdae7e6d805 96 */
borlanic 0:fbdae7e6d805 97 virtual void remove_link_check_request() = 0;
borlanic 0:fbdae7e6d805 98
borlanic 0:fbdae7e6d805 99 /** Sets up a particular data rate of choice
borlanic 0:fbdae7e6d805 100 *
borlanic 0:fbdae7e6d805 101 * @param data_rate Intended data rate e.g., DR_0, DR_1 etc.
borlanic 0:fbdae7e6d805 102 * Caution is advised as the macro DR_* can mean different
borlanic 0:fbdae7e6d805 103 * things while being in a different region.
borlanic 0:fbdae7e6d805 104 * @return LORAWAN_STATUS_OK if everything goes well, otherwise
borlanic 0:fbdae7e6d805 105 * a negative error code.
borlanic 0:fbdae7e6d805 106 */
borlanic 0:fbdae7e6d805 107 virtual lorawan_status_t set_datarate(uint8_t data_rate) = 0;
borlanic 0:fbdae7e6d805 108
borlanic 0:fbdae7e6d805 109 /** Enables adaptive data rate (ADR)
borlanic 0:fbdae7e6d805 110 *
borlanic 0:fbdae7e6d805 111 * Underlying LoRaPHY and LoRaMac layers handle the data rate automatically
borlanic 0:fbdae7e6d805 112 * for the user based upon radio conditions (network congestion).
borlanic 0:fbdae7e6d805 113 *
borlanic 0:fbdae7e6d805 114 * @return LORAWAN_STATUS_OK on success, negative error code
borlanic 0:fbdae7e6d805 115 * on failure.
borlanic 0:fbdae7e6d805 116 */
borlanic 0:fbdae7e6d805 117 virtual lorawan_status_t enable_adaptive_datarate() = 0;
borlanic 0:fbdae7e6d805 118
borlanic 0:fbdae7e6d805 119 /** Disables adaptive data rate
borlanic 0:fbdae7e6d805 120 *
borlanic 0:fbdae7e6d805 121 * When adaptive data rate (ADR) is disabled, user can either set a certain
borlanic 0:fbdae7e6d805 122 * data rate or the Mac layer will choose a default value.
borlanic 0:fbdae7e6d805 123 *
borlanic 0:fbdae7e6d805 124 * @return LORAWAN_STATUS_OK on success, negative error code
borlanic 0:fbdae7e6d805 125 * on failure.
borlanic 0:fbdae7e6d805 126 */
borlanic 0:fbdae7e6d805 127 virtual lorawan_status_t disable_adaptive_datarate() = 0;
borlanic 0:fbdae7e6d805 128
borlanic 0:fbdae7e6d805 129 /** Sets up retry counter for confirmed messages
borlanic 0:fbdae7e6d805 130 *
borlanic 0:fbdae7e6d805 131 * Valid only for confirmed messages.
borlanic 0:fbdae7e6d805 132 *
borlanic 0:fbdae7e6d805 133 * Number of trials to transmit the frame, if the LoRaMAC layer did not
borlanic 0:fbdae7e6d805 134 * receive an acknowledgment. The MAC performs a data-rate adaptation,
borlanic 0:fbdae7e6d805 135 * according to the LoRaWAN Specification V1.0.2, chapter 18.4, according
borlanic 0:fbdae7e6d805 136 * to the table on page 64.
borlanic 0:fbdae7e6d805 137 *
borlanic 0:fbdae7e6d805 138 * Note, that if the number of trials is set to 1 or 2, the MAC will not decrease
borlanic 0:fbdae7e6d805 139 * the datarate, in case the LoRaMAC layer did not receive an acknowledgment.
borlanic 0:fbdae7e6d805 140 *
borlanic 0:fbdae7e6d805 141 * @param count number of retries for confirmed messages
borlanic 0:fbdae7e6d805 142 *
borlanic 0:fbdae7e6d805 143 * @return LORAWAN_STATUS_OK or a negative error code
borlanic 0:fbdae7e6d805 144 */
borlanic 0:fbdae7e6d805 145 virtual lorawan_status_t set_confirmed_msg_retries(uint8_t count) = 0;
borlanic 0:fbdae7e6d805 146
borlanic 0:fbdae7e6d805 147 /** Sets channel plan
borlanic 0:fbdae7e6d805 148 *
borlanic 0:fbdae7e6d805 149 * @param channel_plan The defined channel plans to be set.
borlanic 0:fbdae7e6d805 150 * @return 0 on success, a negative error code on failure.
borlanic 0:fbdae7e6d805 151 */
borlanic 0:fbdae7e6d805 152 virtual lorawan_status_t set_channel_plan(const lorawan_channelplan_t &channel_plan) = 0;
borlanic 0:fbdae7e6d805 153
borlanic 0:fbdae7e6d805 154 /** Gets the current channel plan.
borlanic 0:fbdae7e6d805 155 *
borlanic 0:fbdae7e6d805 156 * @param channel_plan The current channel information.
borlanic 0:fbdae7e6d805 157 *
borlanic 0:fbdae7e6d805 158 * @return LORAWAN_STATUS_OK on success, a negative error
borlanic 0:fbdae7e6d805 159 * code on failure.
borlanic 0:fbdae7e6d805 160 */
borlanic 0:fbdae7e6d805 161 virtual lorawan_status_t get_channel_plan(lorawan_channelplan_t &channel_plan) = 0;
borlanic 0:fbdae7e6d805 162
borlanic 0:fbdae7e6d805 163 /** Removes currently active channel plan
borlanic 0:fbdae7e6d805 164 *
borlanic 0:fbdae7e6d805 165 * Default channels (channels where Base Stations are listening) are not
borlanic 0:fbdae7e6d805 166 * allowed to be removed. So when a plan is abolished, only non-default
borlanic 0:fbdae7e6d805 167 * channels are removed.
borlanic 0:fbdae7e6d805 168 *
borlanic 0:fbdae7e6d805 169 * @return LORAWAN_STATUS_OK on success, negative error
borlanic 0:fbdae7e6d805 170 * code on failure
borlanic 0:fbdae7e6d805 171 */
borlanic 0:fbdae7e6d805 172 virtual lorawan_status_t remove_channel_plan() = 0;
borlanic 0:fbdae7e6d805 173
borlanic 0:fbdae7e6d805 174 /** Removes a given single channel
borlanic 0:fbdae7e6d805 175 *
borlanic 0:fbdae7e6d805 176 * Default channels (channels where Base Stations are listening) are not
borlanic 0:fbdae7e6d805 177 * allowed to be removed.
borlanic 0:fbdae7e6d805 178 *
borlanic 0:fbdae7e6d805 179 * @param index The channel index
borlanic 0:fbdae7e6d805 180 *
borlanic 0:fbdae7e6d805 181 * @return LORAWAN_STATUS_OK on success, negative error
borlanic 0:fbdae7e6d805 182 * code on failure
borlanic 0:fbdae7e6d805 183 */
borlanic 0:fbdae7e6d805 184 virtual lorawan_status_t remove_channel(uint8_t index) = 0;
borlanic 0:fbdae7e6d805 185
borlanic 0:fbdae7e6d805 186 /** Send message to gateway
borlanic 0:fbdae7e6d805 187 *
borlanic 0:fbdae7e6d805 188 * @param port The application port number. Port numbers 0 and 224
borlanic 0:fbdae7e6d805 189 * are reserved, whereas port numbers from 1 to 223
borlanic 0:fbdae7e6d805 190 * (0x01 to 0xDF) are valid port numbers.
borlanic 0:fbdae7e6d805 191 * Anything out of this range is illegal.
borlanic 0:fbdae7e6d805 192 *
borlanic 0:fbdae7e6d805 193 * @param data A pointer to the data being sent. The ownership of the
borlanic 0:fbdae7e6d805 194 * buffer is not transferred. The data is copied to the
borlanic 0:fbdae7e6d805 195 * internal buffers.
borlanic 0:fbdae7e6d805 196 *
borlanic 0:fbdae7e6d805 197 * @param length The size of data in bytes.
borlanic 0:fbdae7e6d805 198 *
borlanic 0:fbdae7e6d805 199 * @param flags A flag used to determine what type of
borlanic 0:fbdae7e6d805 200 * message is being sent, for example:
borlanic 0:fbdae7e6d805 201 *
borlanic 0:fbdae7e6d805 202 * MSG_UNCONFIRMED_FLAG = 0x01
borlanic 0:fbdae7e6d805 203 * MSG_CONFIRMED_FLAG = 0x02
borlanic 0:fbdae7e6d805 204 * MSG_MULTICAST_FLAG = 0x04
borlanic 0:fbdae7e6d805 205 * MSG_PROPRIETARY_FLAG = 0x08
borlanic 0:fbdae7e6d805 206 * MSG_MULTICAST_FLAG and MSG_PROPRIETARY_FLAG can be
borlanic 0:fbdae7e6d805 207 * used in conjunction with MSG_UNCONFIRMED_FLAG and
borlanic 0:fbdae7e6d805 208 * MSG_CONFIRMED_FLAG depending on the intended use.
borlanic 0:fbdae7e6d805 209 *
borlanic 0:fbdae7e6d805 210 * MSG_PROPRIETARY_FLAG|MSG_CONFIRMED_FLAG mask will set
borlanic 0:fbdae7e6d805 211 * a confirmed message flag for a proprietary message.
borlanic 0:fbdae7e6d805 212 * MSG_CONFIRMED_FLAG and MSG_UNCONFIRMED_FLAG are
borlanic 0:fbdae7e6d805 213 * mutually exclusive.
borlanic 0:fbdae7e6d805 214 *
borlanic 0:fbdae7e6d805 215 *
borlanic 0:fbdae7e6d805 216 * @return The number of bytes sent, or
borlanic 0:fbdae7e6d805 217 * LORAWAN_STATUS_WOULD_BLOCK if another TX is
borlanic 0:fbdae7e6d805 218 * ongoing, or a negative error code on failure.
borlanic 0:fbdae7e6d805 219 */
borlanic 0:fbdae7e6d805 220 virtual int16_t send(uint8_t port, const uint8_t* data,
borlanic 0:fbdae7e6d805 221 uint16_t length, int flags) = 0;
borlanic 0:fbdae7e6d805 222
borlanic 0:fbdae7e6d805 223 /** Receives a message from the Network Server on a specific port.
borlanic 0:fbdae7e6d805 224 *
borlanic 0:fbdae7e6d805 225 * @param port The application port number. Port numbers 0 and 224
borlanic 0:fbdae7e6d805 226 * are reserved, whereas port numbers from 1 to 223
borlanic 0:fbdae7e6d805 227 * (0x01 to 0xDF) are valid port numbers.
borlanic 0:fbdae7e6d805 228 * Anything out of this range is illegal.
borlanic 0:fbdae7e6d805 229 *
borlanic 0:fbdae7e6d805 230 * @param data A pointer to buffer where the received data will be
borlanic 0:fbdae7e6d805 231 * stored.
borlanic 0:fbdae7e6d805 232 *
borlanic 0:fbdae7e6d805 233 * @param length The size of data in bytes.
borlanic 0:fbdae7e6d805 234 *
borlanic 0:fbdae7e6d805 235 * @param flags A flag is used to determine what type of
borlanic 0:fbdae7e6d805 236 * message is being sent, for example:
borlanic 0:fbdae7e6d805 237 *
borlanic 0:fbdae7e6d805 238 * MSG_UNCONFIRMED_FLAG = 0x01,
borlanic 0:fbdae7e6d805 239 * MSG_CONFIRMED_FLAG = 0x02
borlanic 0:fbdae7e6d805 240 * MSG_MULTICAST_FLAG = 0x04,
borlanic 0:fbdae7e6d805 241 * MSG_PROPRIETARY_FLAG = 0x08
borlanic 0:fbdae7e6d805 242 *
borlanic 0:fbdae7e6d805 243 * MSG_MULTICAST_FLAG and MSG_PROPRIETARY_FLAG can be
borlanic 0:fbdae7e6d805 244 * used in conjunction with MSG_UNCONFIRMED_FLAG and
borlanic 0:fbdae7e6d805 245 * MSG_CONFIRMED_FLAG depending on the intended use.
borlanic 0:fbdae7e6d805 246 *
borlanic 0:fbdae7e6d805 247 * MSG_PROPRIETARY_FLAG|MSG_CONFIRMED_FLAG mask will set
borlanic 0:fbdae7e6d805 248 * a confirmed message flag for a proprietary message.
borlanic 0:fbdae7e6d805 249 *
borlanic 0:fbdae7e6d805 250 * MSG_CONFIRMED_FLAG and MSG_UNCONFIRMED_FLAG are
borlanic 0:fbdae7e6d805 251 * not mutually exclusive, i.e., the user can subscribe to
borlanic 0:fbdae7e6d805 252 * receive both CONFIRMED AND UNCONFIRMED messages at
borlanic 0:fbdae7e6d805 253 * the same time.
borlanic 0:fbdae7e6d805 254 *
borlanic 0:fbdae7e6d805 255 * @return It could be one of these:
borlanic 0:fbdae7e6d805 256 * i) 0 if there is nothing else to read.
borlanic 0:fbdae7e6d805 257 * ii) Number of bytes written to user buffer.
borlanic 0:fbdae7e6d805 258 * iii) LORAWAN_STATUS_WOULD_BLOCK if there is
borlanic 0:fbdae7e6d805 259 * nothing available to read at the moment.
borlanic 0:fbdae7e6d805 260 * iv) A negative error code on failure.
borlanic 0:fbdae7e6d805 261 */
borlanic 0:fbdae7e6d805 262 virtual int16_t receive(uint8_t port, uint8_t* data, uint16_t length, int flags) = 0;
borlanic 0:fbdae7e6d805 263
borlanic 0:fbdae7e6d805 264 /** Receives a message from the Network Server from any port.
borlanic 0:fbdae7e6d805 265 *
borlanic 0:fbdae7e6d805 266 * @param data A pointer to buffer where the received data will be
borlanic 0:fbdae7e6d805 267 * stored.
borlanic 0:fbdae7e6d805 268 *
borlanic 0:fbdae7e6d805 269 * @param length The size of data in bytes
borlanic 0:fbdae7e6d805 270 *
borlanic 0:fbdae7e6d805 271 * @param port Return the number of port to which message was received.
borlanic 0:fbdae7e6d805 272 *
borlanic 0:fbdae7e6d805 273 * @param flags Return flags to determine what type of message was received.
borlanic 0:fbdae7e6d805 274 * MSG_UNCONFIRMED_FLAG = 0x01
borlanic 0:fbdae7e6d805 275 * MSG_CONFIRMED_FLAG = 0x02
borlanic 0:fbdae7e6d805 276 * MSG_MULTICAST_FLAG = 0x04
borlanic 0:fbdae7e6d805 277 * MSG_PROPRIETARY_FLAG = 0x08
borlanic 0:fbdae7e6d805 278 *
borlanic 0:fbdae7e6d805 279 * @return It could be one of these:
borlanic 0:fbdae7e6d805 280 * i) 0 if there is nothing else to read.
borlanic 0:fbdae7e6d805 281 * ii) Number of bytes written to user buffer.
borlanic 0:fbdae7e6d805 282 * iii) LORAWAN_STATUS_WOULD_BLOCK if there is
borlanic 0:fbdae7e6d805 283 * nothing available to read at the moment.
borlanic 0:fbdae7e6d805 284 * iv) A negative error code on failure.
borlanic 0:fbdae7e6d805 285 */
borlanic 0:fbdae7e6d805 286 virtual int16_t receive(uint8_t* data, uint16_t length, uint8_t& port, int& flags) = 0;
borlanic 0:fbdae7e6d805 287
borlanic 0:fbdae7e6d805 288 /** Add application callbacks to the stack.
borlanic 0:fbdae7e6d805 289 *
borlanic 0:fbdae7e6d805 290 * An example of using this API with a latch onto 'lorawan_events' could be:
borlanic 0:fbdae7e6d805 291 *
borlanic 0:fbdae7e6d805 292 * LoRaWANInterface lorawan(radio);
borlanic 0:fbdae7e6d805 293 * lorawan_app_callbacks_t cbs;
borlanic 0:fbdae7e6d805 294 * static void my_event_handler();
borlanic 0:fbdae7e6d805 295 *
borlanic 0:fbdae7e6d805 296 * int main()
borlanic 0:fbdae7e6d805 297 * {
borlanic 0:fbdae7e6d805 298 * lorawan.initialize();
borlanic 0:fbdae7e6d805 299 * cbs.lorawan_events = mbed::callback(my_event_handler);
borlanic 0:fbdae7e6d805 300 * lorawan.add_app_callbacks(&cbs);
borlanic 0:fbdae7e6d805 301 * lorawan.connect();
borlanic 0:fbdae7e6d805 302 * }
borlanic 0:fbdae7e6d805 303 *
borlanic 0:fbdae7e6d805 304 * static void my_event_handler(lorawan_event_t event)
borlanic 0:fbdae7e6d805 305 * {
borlanic 0:fbdae7e6d805 306 * switch(event) {
borlanic 0:fbdae7e6d805 307 * case CONNECTED:
borlanic 0:fbdae7e6d805 308 * //do something
borlanic 0:fbdae7e6d805 309 * break;
borlanic 0:fbdae7e6d805 310 * case DISCONNECTED:
borlanic 0:fbdae7e6d805 311 * //do something
borlanic 0:fbdae7e6d805 312 * break;
borlanic 0:fbdae7e6d805 313 * case TX_DONE:
borlanic 0:fbdae7e6d805 314 * //do something
borlanic 0:fbdae7e6d805 315 * break;
borlanic 0:fbdae7e6d805 316 * default:
borlanic 0:fbdae7e6d805 317 * break;
borlanic 0:fbdae7e6d805 318 * }
borlanic 0:fbdae7e6d805 319 * }
borlanic 0:fbdae7e6d805 320 *
borlanic 0:fbdae7e6d805 321 * @param callbacks A pointer to the structure containing application
borlanic 0:fbdae7e6d805 322 * callbacks.
borlanic 0:fbdae7e6d805 323 *
borlanic 0:fbdae7e6d805 324 * @return LORAWAN_STATUS_OK on success, a negative error
borlanic 0:fbdae7e6d805 325 * code on failure.
borlanic 0:fbdae7e6d805 326 */
borlanic 0:fbdae7e6d805 327 virtual lorawan_status_t add_app_callbacks(lorawan_app_callbacks_t *callbacks) = 0;
borlanic 0:fbdae7e6d805 328
borlanic 0:fbdae7e6d805 329 /** Change device class
borlanic 0:fbdae7e6d805 330 *
borlanic 0:fbdae7e6d805 331 * Change current device class.
borlanic 0:fbdae7e6d805 332 *
borlanic 0:fbdae7e6d805 333 * @param device_class The device class
borlanic 0:fbdae7e6d805 334 *
borlanic 0:fbdae7e6d805 335 * @return LORAWAN_STATUS_OK on success,
borlanic 0:fbdae7e6d805 336 * LORAWAN_STATUS_UNSUPPORTED is requested class is not supported,
borlanic 0:fbdae7e6d805 337 * or other negative error code if request failed.
borlanic 0:fbdae7e6d805 338 */
borlanic 0:fbdae7e6d805 339 virtual lorawan_status_t set_device_class(device_class_t device_class) = 0;
borlanic 0:fbdae7e6d805 340 };
borlanic 0:fbdae7e6d805 341
borlanic 0:fbdae7e6d805 342 #endif /* LORAWAN_BASE_H_ */