Semtech stack for ELMO - ver. 4.1.0.

Dependencies:   SX1272lib mbed

Fork of LoRaWAN_Semtech_stack_v4.1 by Michal Leksinski

Committer:
mleksio
Date:
Fri Apr 22 07:37:04 2016 +0000
Revision:
5:cbb921e2a03b
Parent:
1:2be292bd43f9
Removed unused files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mleksio 1:2be292bd43f9 1 /*!
mleksio 1:2be292bd43f9 2 * \file LoRaMac-api-v3.h
mleksio 1:2be292bd43f9 3 *
mleksio 1:2be292bd43f9 4 * \brief LoRa MAC wrapper layer implementation
mleksio 1:2be292bd43f9 5 *
mleksio 1:2be292bd43f9 6 * \copyright Revised BSD License, see section \ref LICENSE.
mleksio 1:2be292bd43f9 7 *
mleksio 1:2be292bd43f9 8 * \code
mleksio 1:2be292bd43f9 9 * ______ _
mleksio 1:2be292bd43f9 10 * / _____) _ | |
mleksio 1:2be292bd43f9 11 * ( (____ _____ ____ _| |_ _____ ____| |__
mleksio 1:2be292bd43f9 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \
mleksio 1:2be292bd43f9 13 * _____) ) ____| | | || |_| ____( (___| | | |
mleksio 1:2be292bd43f9 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_|
mleksio 1:2be292bd43f9 15 * (C)2013 Semtech
mleksio 1:2be292bd43f9 16 *
mleksio 1:2be292bd43f9 17 * ___ _____ _ ___ _ _____ ___ ___ ___ ___
mleksio 1:2be292bd43f9 18 * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
mleksio 1:2be292bd43f9 19 * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
mleksio 1:2be292bd43f9 20 * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
mleksio 1:2be292bd43f9 21 * embedded.connectivity.solutions===============
mleksio 1:2be292bd43f9 22 *
mleksio 1:2be292bd43f9 23 * \endcode
mleksio 1:2be292bd43f9 24 *
mleksio 1:2be292bd43f9 25 * \author Miguel Luis ( Semtech )
mleksio 1:2be292bd43f9 26 *
mleksio 1:2be292bd43f9 27 * \author Gregory Cristian ( Semtech )
mleksio 1:2be292bd43f9 28 *
mleksio 1:2be292bd43f9 29 * \author Daniel Jäckle ( STACKFORCE )
mleksio 1:2be292bd43f9 30 */
mleksio 1:2be292bd43f9 31 #ifndef __LORAMAC_API_V3_H__
mleksio 1:2be292bd43f9 32 #define __LORAMAC_API_V3_H__
mleksio 1:2be292bd43f9 33
mleksio 1:2be292bd43f9 34 // Includes board dependent definitions such as channels frequencies
mleksio 1:2be292bd43f9 35 #include "LoRaMac.h"
mleksio 1:2be292bd43f9 36 #include "LoRaMac-board.h"
mleksio 1:2be292bd43f9 37
mleksio 1:2be292bd43f9 38 /*!
mleksio 1:2be292bd43f9 39 * Beacon interval in us
mleksio 1:2be292bd43f9 40 */
mleksio 1:2be292bd43f9 41 #define BEACON_INTERVAL 128000000
mleksio 1:2be292bd43f9 42
mleksio 1:2be292bd43f9 43 /*!
mleksio 1:2be292bd43f9 44 * Class A&B receive delay in us
mleksio 1:2be292bd43f9 45 */
mleksio 1:2be292bd43f9 46 #define RECEIVE_DELAY1 1000000
mleksio 1:2be292bd43f9 47 #define RECEIVE_DELAY2 2000000
mleksio 1:2be292bd43f9 48
mleksio 1:2be292bd43f9 49 /*!
mleksio 1:2be292bd43f9 50 * Join accept receive delay in us
mleksio 1:2be292bd43f9 51 */
mleksio 1:2be292bd43f9 52 #define JOIN_ACCEPT_DELAY1 5000000
mleksio 1:2be292bd43f9 53 #define JOIN_ACCEPT_DELAY2 6000000
mleksio 1:2be292bd43f9 54
mleksio 1:2be292bd43f9 55 /*!
mleksio 1:2be292bd43f9 56 * Class A&B maximum receive window delay in us
mleksio 1:2be292bd43f9 57 */
mleksio 1:2be292bd43f9 58 #define MAX_RX_WINDOW 3000000
mleksio 1:2be292bd43f9 59
mleksio 1:2be292bd43f9 60 /*!
mleksio 1:2be292bd43f9 61 * Maximum allowed gap for the FCNT field
mleksio 1:2be292bd43f9 62 */
mleksio 1:2be292bd43f9 63 #define MAX_FCNT_GAP 16384
mleksio 1:2be292bd43f9 64
mleksio 1:2be292bd43f9 65 /*!
mleksio 1:2be292bd43f9 66 * ADR acknowledgement counter limit
mleksio 1:2be292bd43f9 67 */
mleksio 1:2be292bd43f9 68 #define ADR_ACK_LIMIT 64
mleksio 1:2be292bd43f9 69
mleksio 1:2be292bd43f9 70 /*!
mleksio 1:2be292bd43f9 71 * Number of ADR acknowledgement requests before returning to default datarate
mleksio 1:2be292bd43f9 72 */
mleksio 1:2be292bd43f9 73 #define ADR_ACK_DELAY 32
mleksio 1:2be292bd43f9 74
mleksio 1:2be292bd43f9 75 /*!
mleksio 1:2be292bd43f9 76 * Number of seconds after the start of the second reception window without
mleksio 1:2be292bd43f9 77 * receiving an acknowledge.
mleksio 1:2be292bd43f9 78 * AckTimeout = ACK_TIMEOUT + Random( -ACK_TIMEOUT_RND, ACK_TIMEOUT_RND )
mleksio 1:2be292bd43f9 79 */
mleksio 1:2be292bd43f9 80 #define ACK_TIMEOUT 2000000
mleksio 1:2be292bd43f9 81
mleksio 1:2be292bd43f9 82 /*!
mleksio 1:2be292bd43f9 83 * Random number of seconds after the start of the second reception window without
mleksio 1:2be292bd43f9 84 * receiving an acknowledge
mleksio 1:2be292bd43f9 85 * AckTimeout = ACK_TIMEOUT + Random( -ACK_TIMEOUT_RND, ACK_TIMEOUT_RND )
mleksio 1:2be292bd43f9 86 */
mleksio 1:2be292bd43f9 87 #define ACK_TIMEOUT_RND 1000000
mleksio 1:2be292bd43f9 88
mleksio 1:2be292bd43f9 89 /*!
mleksio 1:2be292bd43f9 90 * Check the Mac layer state every MAC_STATE_CHECK_TIMEOUT
mleksio 1:2be292bd43f9 91 */
mleksio 1:2be292bd43f9 92 #define MAC_STATE_CHECK_TIMEOUT 1000000
mleksio 1:2be292bd43f9 93
mleksio 1:2be292bd43f9 94 /*!
mleksio 1:2be292bd43f9 95 * Maximum number of times the MAC layer tries to get an acknowledge.
mleksio 1:2be292bd43f9 96 */
mleksio 1:2be292bd43f9 97 #define MAX_ACK_RETRIES 8
mleksio 1:2be292bd43f9 98
mleksio 1:2be292bd43f9 99 /*!
mleksio 1:2be292bd43f9 100 * RSSI free threshold
mleksio 1:2be292bd43f9 101 */
mleksio 1:2be292bd43f9 102 #define RSSI_FREE_TH ( int8_t )( -90 ) // [dBm]
mleksio 1:2be292bd43f9 103
mleksio 1:2be292bd43f9 104 /*!
mleksio 1:2be292bd43f9 105 * Frame direction definition
mleksio 1:2be292bd43f9 106 */
mleksio 1:2be292bd43f9 107 #define UP_LINK 0
mleksio 1:2be292bd43f9 108 #define DOWN_LINK 1
mleksio 1:2be292bd43f9 109
mleksio 1:2be292bd43f9 110 /*!
mleksio 1:2be292bd43f9 111 * Sets the length of the LoRaMAC footer field.
mleksio 1:2be292bd43f9 112 * Mainly indicates the MIC field length
mleksio 1:2be292bd43f9 113 */
mleksio 1:2be292bd43f9 114 #define LORAMAC_MFR_LEN 4
mleksio 1:2be292bd43f9 115
mleksio 1:2be292bd43f9 116 /*!
mleksio 1:2be292bd43f9 117 * Syncword for Private LoRa networks
mleksio 1:2be292bd43f9 118 */
mleksio 1:2be292bd43f9 119 #define LORA_MAC_PRIVATE_SYNCWORD 0x12
mleksio 1:2be292bd43f9 120
mleksio 1:2be292bd43f9 121 /*!
mleksio 1:2be292bd43f9 122 * Syncword for Public LoRa networks
mleksio 1:2be292bd43f9 123 */
mleksio 1:2be292bd43f9 124 #define LORA_MAC_PUBLIC_SYNCWORD 0x34
mleksio 1:2be292bd43f9 125
mleksio 1:2be292bd43f9 126 /*!
mleksio 1:2be292bd43f9 127 * LoRaMAC event flags
mleksio 1:2be292bd43f9 128 */
mleksio 1:2be292bd43f9 129 typedef union
mleksio 1:2be292bd43f9 130 {
mleksio 1:2be292bd43f9 131 uint8_t Value;
mleksio 1:2be292bd43f9 132 struct
mleksio 1:2be292bd43f9 133 {
mleksio 1:2be292bd43f9 134 uint8_t Tx : 1;
mleksio 1:2be292bd43f9 135 uint8_t Rx : 1;
mleksio 1:2be292bd43f9 136 uint8_t RxData : 1;
mleksio 1:2be292bd43f9 137 uint8_t Multicast : 1;
mleksio 1:2be292bd43f9 138 uint8_t RxSlot : 2;
mleksio 1:2be292bd43f9 139 uint8_t LinkCheck : 1;
mleksio 1:2be292bd43f9 140 uint8_t JoinAccept : 1;
mleksio 1:2be292bd43f9 141 }Bits;
mleksio 1:2be292bd43f9 142 }LoRaMacEventFlags_t;
mleksio 1:2be292bd43f9 143
mleksio 1:2be292bd43f9 144 /*!
mleksio 1:2be292bd43f9 145 * LoRaMAC event information
mleksio 1:2be292bd43f9 146 */
mleksio 1:2be292bd43f9 147 typedef struct
mleksio 1:2be292bd43f9 148 {
mleksio 1:2be292bd43f9 149 LoRaMacEventInfoStatus_t Status;
mleksio 1:2be292bd43f9 150 bool TxAckReceived;
mleksio 1:2be292bd43f9 151 uint8_t TxNbRetries;
mleksio 1:2be292bd43f9 152 uint8_t TxDatarate;
mleksio 1:2be292bd43f9 153 uint8_t RxPort;
mleksio 1:2be292bd43f9 154 uint8_t *RxBuffer;
mleksio 1:2be292bd43f9 155 uint8_t RxBufferSize;
mleksio 1:2be292bd43f9 156 int16_t RxRssi;
mleksio 1:2be292bd43f9 157 uint8_t RxSnr;
mleksio 1:2be292bd43f9 158 uint16_t Energy;
mleksio 1:2be292bd43f9 159 uint8_t DemodMargin;
mleksio 1:2be292bd43f9 160 uint8_t NbGateways;
mleksio 1:2be292bd43f9 161 }LoRaMacEventInfo_t;
mleksio 1:2be292bd43f9 162
mleksio 1:2be292bd43f9 163 /*!
mleksio 1:2be292bd43f9 164 * LoRaMAC events structure
mleksio 1:2be292bd43f9 165 * Used to notify upper layers of MAC events
mleksio 1:2be292bd43f9 166 */
mleksio 1:2be292bd43f9 167 typedef struct sLoRaMacCallbacks
mleksio 1:2be292bd43f9 168 {
mleksio 1:2be292bd43f9 169 /*!
mleksio 1:2be292bd43f9 170 * MAC layer event callback prototype.
mleksio 1:2be292bd43f9 171 *
mleksio 1:2be292bd43f9 172 * \param [IN] flags Bit field indicating the MAC events occurred
mleksio 1:2be292bd43f9 173 * \param [IN] info Details about MAC events occurred
mleksio 1:2be292bd43f9 174 */
mleksio 1:2be292bd43f9 175 void ( *MacEvent )( LoRaMacEventFlags_t *flags, LoRaMacEventInfo_t *info );
mleksio 1:2be292bd43f9 176 /*!
mleksio 1:2be292bd43f9 177 * Function callback to get the current battery level
mleksio 1:2be292bd43f9 178 *
mleksio 1:2be292bd43f9 179 * \retval batteryLevel Current battery level
mleksio 1:2be292bd43f9 180 */
mleksio 1:2be292bd43f9 181 uint8_t ( *GetBatteryLevel )( void );
mleksio 1:2be292bd43f9 182 }LoRaMacCallbacks_t;
mleksio 1:2be292bd43f9 183
mleksio 1:2be292bd43f9 184 /*!
mleksio 1:2be292bd43f9 185 * LoRaMAC layer initialization
mleksio 1:2be292bd43f9 186 *
mleksio 1:2be292bd43f9 187 * \param [IN] callbacks Pointer to a structure defining the LoRaMAC
mleksio 1:2be292bd43f9 188 * callback functions.
mleksio 1:2be292bd43f9 189 */
mleksio 1:2be292bd43f9 190 void LoRaMacInit( LoRaMacCallbacks_t *callbacks );
mleksio 1:2be292bd43f9 191
mleksio 1:2be292bd43f9 192 /*!
mleksio 1:2be292bd43f9 193 * Enables/Disables the ADR (Adaptive Data Rate)
mleksio 1:2be292bd43f9 194 *
mleksio 1:2be292bd43f9 195 * \param [IN] enable [true: ADR ON, false: ADR OFF]
mleksio 1:2be292bd43f9 196 */
mleksio 1:2be292bd43f9 197 void LoRaMacSetAdrOn( bool enable );
mleksio 1:2be292bd43f9 198
mleksio 1:2be292bd43f9 199 /*!
mleksio 1:2be292bd43f9 200 * Initializes the network IDs. Device address,
mleksio 1:2be292bd43f9 201 * network session AES128 key and application session AES128 key.
mleksio 1:2be292bd43f9 202 *
mleksio 1:2be292bd43f9 203 * \remark To be only used when Over-the-Air activation isn't used.
mleksio 1:2be292bd43f9 204 *
mleksio 1:2be292bd43f9 205 * \param [IN] netID 24 bits network identifier
mleksio 1:2be292bd43f9 206 * ( provided by network operator )
mleksio 1:2be292bd43f9 207 * \param [IN] devAddr 32 bits device address on the network
mleksio 1:2be292bd43f9 208 * (must be unique to the network)
mleksio 1:2be292bd43f9 209 * \param [IN] nwkSKey Pointer to the network session AES128 key array
mleksio 1:2be292bd43f9 210 * ( 16 bytes )
mleksio 1:2be292bd43f9 211 * \param [IN] appSKey Pointer to the application session AES128 key array
mleksio 1:2be292bd43f9 212 * ( 16 bytes )
mleksio 1:2be292bd43f9 213 */
mleksio 1:2be292bd43f9 214 void LoRaMacInitNwkIds( uint32_t netID, uint32_t devAddr, uint8_t *nwkSKey, uint8_t *appSKey );
mleksio 1:2be292bd43f9 215
mleksio 1:2be292bd43f9 216 /*
mleksio 1:2be292bd43f9 217 * Wrapper function which calls \ref LoRaMacMulticastChannelLink.
mleksio 1:2be292bd43f9 218 */
mleksio 1:2be292bd43f9 219 void LoRaMacMulticastChannelAdd( MulticastParams_t *channelParam );
mleksio 1:2be292bd43f9 220
mleksio 1:2be292bd43f9 221 /*
mleksio 1:2be292bd43f9 222 * Wrapper function which calls \ref LoRaMacMulticastChannelUnlink.
mleksio 1:2be292bd43f9 223 */
mleksio 1:2be292bd43f9 224 void LoRaMacMulticastChannelRemove( MulticastParams_t *channelParam );
mleksio 1:2be292bd43f9 225
mleksio 1:2be292bd43f9 226 /*!
mleksio 1:2be292bd43f9 227 * Initiates the Over-the-Air activation
mleksio 1:2be292bd43f9 228 *
mleksio 1:2be292bd43f9 229 * \param [IN] devEui Pointer to the device EUI array ( 8 bytes )
mleksio 1:2be292bd43f9 230 * \param [IN] appEui Pointer to the application EUI array ( 8 bytes )
mleksio 1:2be292bd43f9 231 * \param [IN] appKey Pointer to the application AES128 key array ( 16 bytes )
mleksio 1:2be292bd43f9 232 *
mleksio 1:2be292bd43f9 233 * \retval status [0: OK, 1: Tx error, 2: Already joined a network]
mleksio 1:2be292bd43f9 234 */
mleksio 1:2be292bd43f9 235 uint8_t LoRaMacJoinReq( uint8_t *devEui, uint8_t *appEui, uint8_t *appKey );
mleksio 1:2be292bd43f9 236
mleksio 1:2be292bd43f9 237 /*!
mleksio 1:2be292bd43f9 238 * Sends a LinkCheckReq MAC command on the next uplink frame
mleksio 1:2be292bd43f9 239 *
mleksio 1:2be292bd43f9 240 * \retval status Function status [0: OK, 1: Busy]
mleksio 1:2be292bd43f9 241 */
mleksio 1:2be292bd43f9 242 uint8_t LoRaMacLinkCheckReq( void );
mleksio 1:2be292bd43f9 243
mleksio 1:2be292bd43f9 244 /*!
mleksio 1:2be292bd43f9 245 * LoRaMAC layer send frame
mleksio 1:2be292bd43f9 246 *
mleksio 1:2be292bd43f9 247 * \param [IN] fPort MAC payload port (must be > 0)
mleksio 1:2be292bd43f9 248 * \param [IN] fBuffer MAC data buffer to be sent
mleksio 1:2be292bd43f9 249 * \param [IN] fBufferSize MAC data buffer size
mleksio 1:2be292bd43f9 250 *
mleksio 1:2be292bd43f9 251 * \retval status [0: OK, 1: Busy, 2: No network joined,
mleksio 1:2be292bd43f9 252 * 3: Length or port error, 4: Unknown MAC command
mleksio 1:2be292bd43f9 253 * 5: Unable to find a free channel
mleksio 1:2be292bd43f9 254 * 6: Device switched off]
mleksio 1:2be292bd43f9 255 */
mleksio 1:2be292bd43f9 256 uint8_t LoRaMacSendFrame( uint8_t fPort, void *fBuffer, uint16_t fBufferSize );
mleksio 1:2be292bd43f9 257
mleksio 1:2be292bd43f9 258 /*!
mleksio 1:2be292bd43f9 259 * LoRaMAC layer send frame
mleksio 1:2be292bd43f9 260 *
mleksio 1:2be292bd43f9 261 * \param [IN] fPort MAC payload port (must be > 0)
mleksio 1:2be292bd43f9 262 * \param [IN] fBuffer MAC data buffer to be sent
mleksio 1:2be292bd43f9 263 * \param [IN] fBufferSize MAC data buffer size
mleksio 1:2be292bd43f9 264 * \param [IN] fBufferSize MAC data buffer size
mleksio 1:2be292bd43f9 265 * \param [IN] nbRetries Number of retries to receive the acknowledgement
mleksio 1:2be292bd43f9 266 *
mleksio 1:2be292bd43f9 267 * \retval status [0: OK, 1: Busy, 2: No network joined,
mleksio 1:2be292bd43f9 268 * 3: Length or port error, 4: Unknown MAC command
mleksio 1:2be292bd43f9 269 * 5: Unable to find a free channel
mleksio 1:2be292bd43f9 270 * 6: Device switched off]
mleksio 1:2be292bd43f9 271 */
mleksio 1:2be292bd43f9 272 uint8_t LoRaMacSendConfirmedFrame( uint8_t fPort, void *fBuffer, uint16_t fBufferSize, uint8_t nbRetries );
mleksio 1:2be292bd43f9 273
mleksio 1:2be292bd43f9 274 /*!
mleksio 1:2be292bd43f9 275 * ============================================================================
mleksio 1:2be292bd43f9 276 * = LoRaMac test functions =
mleksio 1:2be292bd43f9 277 * ============================================================================
mleksio 1:2be292bd43f9 278 */
mleksio 1:2be292bd43f9 279
mleksio 1:2be292bd43f9 280 /*!
mleksio 1:2be292bd43f9 281 * LoRaMAC layer generic send frame
mleksio 1:2be292bd43f9 282 *
mleksio 1:2be292bd43f9 283 * \param [IN] macHdr MAC header field
mleksio 1:2be292bd43f9 284 * \param [IN] fOpts MAC commands buffer
mleksio 1:2be292bd43f9 285 * \param [IN] fPort MAC payload port
mleksio 1:2be292bd43f9 286 * \param [IN] fBuffer MAC data buffer to be sent
mleksio 1:2be292bd43f9 287 * \param [IN] fBufferSize MAC data buffer size
mleksio 1:2be292bd43f9 288 * \retval status [0: OK, 1: Busy, 2: No network joined,
mleksio 1:2be292bd43f9 289 * 3: Length or port error, 4: Unknown MAC command
mleksio 1:2be292bd43f9 290 * 5: Unable to find a free channel
mleksio 1:2be292bd43f9 291 * 6: Device switched off]
mleksio 1:2be292bd43f9 292 */
mleksio 1:2be292bd43f9 293 uint8_t LoRaMacSend( LoRaMacHeader_t *macHdr, uint8_t *fOpts, uint8_t fPort, void *fBuffer, uint16_t fBufferSize );
mleksio 1:2be292bd43f9 294
mleksio 1:2be292bd43f9 295 /*!
mleksio 1:2be292bd43f9 296 * LoRaMAC layer frame buffer initialization.
mleksio 1:2be292bd43f9 297 *
mleksio 1:2be292bd43f9 298 * \param [IN] channel Channel parameters
mleksio 1:2be292bd43f9 299 * \param [IN] macHdr MAC header field
mleksio 1:2be292bd43f9 300 * \param [IN] fCtrl MAC frame control field
mleksio 1:2be292bd43f9 301 * \param [IN] fOpts MAC commands buffer
mleksio 1:2be292bd43f9 302 * \param [IN] fPort MAC payload port
mleksio 1:2be292bd43f9 303 * \param [IN] fBuffer MAC data buffer to be sent
mleksio 1:2be292bd43f9 304 * \param [IN] fBufferSize MAC data buffer size
mleksio 1:2be292bd43f9 305 * \retval status [0: OK, 1: N/A, 2: No network joined,
mleksio 1:2be292bd43f9 306 * 3: Length or port error, 4: Unknown MAC command]
mleksio 1:2be292bd43f9 307 */
mleksio 1:2be292bd43f9 308 uint8_t LoRaMacPrepareFrame( ChannelParams_t channel,LoRaMacHeader_t *macHdr, LoRaMacFrameCtrl_t *fCtrl, uint8_t *fOpts, uint8_t fPort, void *fBuffer, uint16_t fBufferSize );
mleksio 1:2be292bd43f9 309
mleksio 1:2be292bd43f9 310 /*!
mleksio 1:2be292bd43f9 311 * LoRaMAC layer prepared frame buffer transmission with channel specification
mleksio 1:2be292bd43f9 312 *
mleksio 1:2be292bd43f9 313 * \remark LoRaMacPrepareFrame must be called at least once before calling this
mleksio 1:2be292bd43f9 314 * function.
mleksio 1:2be292bd43f9 315 *
mleksio 1:2be292bd43f9 316 * \param [IN] channel Channel parameters
mleksio 1:2be292bd43f9 317 * \retval status [0: OK, 1: Busy]
mleksio 1:2be292bd43f9 318 */
mleksio 1:2be292bd43f9 319 uint8_t LoRaMacSendFrameOnChannel( ChannelParams_t channel );
mleksio 1:2be292bd43f9 320
mleksio 1:2be292bd43f9 321 /*!
mleksio 1:2be292bd43f9 322 * LoRaMAC layer generic send frame with channel specification
mleksio 1:2be292bd43f9 323 *
mleksio 1:2be292bd43f9 324 * \param [IN] channel Channel parameters
mleksio 1:2be292bd43f9 325 * \param [IN] macHdr MAC header field
mleksio 1:2be292bd43f9 326 * \param [IN] fCtrl MAC frame control field
mleksio 1:2be292bd43f9 327 * \param [IN] fOpts MAC commands buffer
mleksio 1:2be292bd43f9 328 * \param [IN] fPort MAC payload port
mleksio 1:2be292bd43f9 329 * \param [IN] fBuffer MAC data buffer to be sent
mleksio 1:2be292bd43f9 330 * \param [IN] fBufferSize MAC data buffer size
mleksio 1:2be292bd43f9 331 * \retval status [0: OK, 1: Busy, 2: No network joined,
mleksio 1:2be292bd43f9 332 * 3: Length or port error, 4: Unknown MAC command]
mleksio 1:2be292bd43f9 333 */
mleksio 1:2be292bd43f9 334 uint8_t LoRaMacSendOnChannel( ChannelParams_t channel, LoRaMacHeader_t *macHdr, LoRaMacFrameCtrl_t *fCtrl, uint8_t *fOpts, uint8_t fPort, void *fBuffer, uint16_t fBufferSize );
mleksio 1:2be292bd43f9 335
mleksio 1:2be292bd43f9 336 /*!
mleksio 1:2be292bd43f9 337 * ============================================================================
mleksio 1:2be292bd43f9 338 * = LoRaMac setup functions =
mleksio 1:2be292bd43f9 339 * ============================================================================
mleksio 1:2be292bd43f9 340 */
mleksio 1:2be292bd43f9 341
mleksio 1:2be292bd43f9 342 /*
mleksio 1:2be292bd43f9 343 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 344 * set the LoRaWan device class.
mleksio 1:2be292bd43f9 345 */
mleksio 1:2be292bd43f9 346 void LoRaMacSetDeviceClass( DeviceClass_t deviceClass );
mleksio 1:2be292bd43f9 347
mleksio 1:2be292bd43f9 348 /*
mleksio 1:2be292bd43f9 349 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 350 * set the network type to public or private.
mleksio 1:2be292bd43f9 351 */
mleksio 1:2be292bd43f9 352 void LoRaMacSetPublicNetwork( bool enable );
mleksio 1:2be292bd43f9 353
mleksio 1:2be292bd43f9 354 /*
mleksio 1:2be292bd43f9 355 * Wrapper function which calls \ref LoRaMacChannelAdd.
mleksio 1:2be292bd43f9 356 */
mleksio 1:2be292bd43f9 357 void LoRaMacSetChannel( uint8_t id, ChannelParams_t params );
mleksio 1:2be292bd43f9 358
mleksio 1:2be292bd43f9 359 /*
mleksio 1:2be292bd43f9 360 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 361 * set the receive window 2 channel.
mleksio 1:2be292bd43f9 362 */
mleksio 1:2be292bd43f9 363 void LoRaMacSetRx2Channel( Rx2ChannelParams_t param );
mleksio 1:2be292bd43f9 364
mleksio 1:2be292bd43f9 365 /*!
mleksio 1:2be292bd43f9 366 * Sets channels tx output power
mleksio 1:2be292bd43f9 367 *
mleksio 1:2be292bd43f9 368 * \param [IN] txPower [TX_POWER_20_DBM, TX_POWER_14_DBM,
mleksio 1:2be292bd43f9 369 TX_POWER_11_DBM, TX_POWER_08_DBM,
mleksio 1:2be292bd43f9 370 TX_POWER_05_DBM, TX_POWER_02_DBM]
mleksio 1:2be292bd43f9 371 */
mleksio 1:2be292bd43f9 372 void LoRaMacSetChannelsTxPower( int8_t txPower );
mleksio 1:2be292bd43f9 373
mleksio 1:2be292bd43f9 374 /*!
mleksio 1:2be292bd43f9 375 * Sets channels datarate
mleksio 1:2be292bd43f9 376 *
mleksio 1:2be292bd43f9 377 * \param [IN] datarate eu868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
mleksio 1:2be292bd43f9 378 * us915 - [DR_0, DR_1, DR_2, DR_3, DR_4]
mleksio 1:2be292bd43f9 379 */
mleksio 1:2be292bd43f9 380 void LoRaMacSetChannelsDatarate( int8_t datarate );
mleksio 1:2be292bd43f9 381
mleksio 1:2be292bd43f9 382 /*
mleksio 1:2be292bd43f9 383 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 384 * set the channels mask.
mleksio 1:2be292bd43f9 385 */
mleksio 1:2be292bd43f9 386 void LoRaMacSetChannelsMask( uint16_t *mask );
mleksio 1:2be292bd43f9 387
mleksio 1:2be292bd43f9 388 /*
mleksio 1:2be292bd43f9 389 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 390 * set the number of repetitions on a channel.
mleksio 1:2be292bd43f9 391 */
mleksio 1:2be292bd43f9 392 void LoRaMacSetChannelsNbRep( uint8_t nbRep );
mleksio 1:2be292bd43f9 393
mleksio 1:2be292bd43f9 394 /*
mleksio 1:2be292bd43f9 395 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 396 * set the maximum receive window duration in [us].
mleksio 1:2be292bd43f9 397 */
mleksio 1:2be292bd43f9 398 void LoRaMacSetMaxRxWindow( uint32_t delay );
mleksio 1:2be292bd43f9 399
mleksio 1:2be292bd43f9 400 /*
mleksio 1:2be292bd43f9 401 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 402 * set the receive delay 1 in [us].
mleksio 1:2be292bd43f9 403 */
mleksio 1:2be292bd43f9 404 void LoRaMacSetReceiveDelay1( uint32_t delay );
mleksio 1:2be292bd43f9 405
mleksio 1:2be292bd43f9 406 /*
mleksio 1:2be292bd43f9 407 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 408 * set the receive delay 2 in [us].
mleksio 1:2be292bd43f9 409 */
mleksio 1:2be292bd43f9 410 void LoRaMacSetReceiveDelay2( uint32_t delay );
mleksio 1:2be292bd43f9 411
mleksio 1:2be292bd43f9 412 /*
mleksio 1:2be292bd43f9 413 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 414 * set the join accept delay 1 in [us].
mleksio 1:2be292bd43f9 415 */
mleksio 1:2be292bd43f9 416 void LoRaMacSetJoinAcceptDelay1( uint32_t delay );
mleksio 1:2be292bd43f9 417
mleksio 1:2be292bd43f9 418 /*
mleksio 1:2be292bd43f9 419 * Wrapper function which calls \ref LoRaMacMibSetRequestConfirm to
mleksio 1:2be292bd43f9 420 * set the join accept delay 2 in [us].
mleksio 1:2be292bd43f9 421 */
mleksio 1:2be292bd43f9 422 void LoRaMacSetJoinAcceptDelay2( uint32_t delay );
mleksio 1:2be292bd43f9 423
mleksio 1:2be292bd43f9 424 /*
mleksio 1:2be292bd43f9 425 * Wrapper function which calls \ref LoRaMacMibGetRequestConfirm to
mleksio 1:2be292bd43f9 426 * get the up-link counter.
mleksio 1:2be292bd43f9 427 */
mleksio 1:2be292bd43f9 428 uint32_t LoRaMacGetUpLinkCounter( void );
mleksio 1:2be292bd43f9 429
mleksio 1:2be292bd43f9 430 /*
mleksio 1:2be292bd43f9 431 * Wrapper function which calls \ref LoRaMacMibGetRequestConfirm to
mleksio 1:2be292bd43f9 432 * get the down-link counter.
mleksio 1:2be292bd43f9 433 */
mleksio 1:2be292bd43f9 434 uint32_t LoRaMacGetDownLinkCounter( void );
mleksio 1:2be292bd43f9 435
mleksio 1:2be292bd43f9 436 /*
mleksio 1:2be292bd43f9 437 * ============================================================================
mleksio 1:2be292bd43f9 438 * = LoRaMac test functions =
mleksio 1:2be292bd43f9 439 * ============================================================================
mleksio 1:2be292bd43f9 440 */
mleksio 1:2be292bd43f9 441
mleksio 1:2be292bd43f9 442 /*!
mleksio 1:2be292bd43f9 443 * Disables/Enables the duty cycle enforcement (EU868)
mleksio 1:2be292bd43f9 444 *
mleksio 1:2be292bd43f9 445 * \param [IN] enable - Enabled or disables the duty cycle
mleksio 1:2be292bd43f9 446 */
mleksio 1:2be292bd43f9 447 void LoRaMacTestSetDutyCycleOn( bool enable );
mleksio 1:2be292bd43f9 448
mleksio 1:2be292bd43f9 449 /*!
mleksio 1:2be292bd43f9 450 * Disables/Enables the reception windows opening
mleksio 1:2be292bd43f9 451 *
mleksio 1:2be292bd43f9 452 * \param [IN] enable [true: enable, false: disable]
mleksio 1:2be292bd43f9 453 */
mleksio 1:2be292bd43f9 454 void LoRaMacTestRxWindowsOn( bool enable );
mleksio 1:2be292bd43f9 455
mleksio 1:2be292bd43f9 456 /*!
mleksio 1:2be292bd43f9 457 * Enables the MIC field test
mleksio 1:2be292bd43f9 458 *
mleksio 1:2be292bd43f9 459 * \param [IN] upLinkCounter Fixed Tx packet counter value
mleksio 1:2be292bd43f9 460 */
mleksio 1:2be292bd43f9 461 void LoRaMacTestSetMic( uint16_t upLinkCounter );
mleksio 1:2be292bd43f9 462
mleksio 1:2be292bd43f9 463 #endif /* __LORAMAC_API_V3_H__ */