LR Initial Publish

Dependencies:   X_NUCLEO_IKS01A2 driver_mbed_TH02 mbed LoRaWAN-lib-v1_0_1 SX1272Lib

Fork of Training-Aug2018-SX1272-X-NUCLEO-IKS01A2 by Uttam Bhat

Committer:
bootcamps
Date:
Sat Oct 06 01:43:37 2018 +0000
Revision:
12:5222f008392b
Parent:
4:d49b89361b67
Update LR

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ubhat 0:6cc76d70e2a1 1 /*
ubhat 0:6cc76d70e2a1 2 / _____) _ | |
ubhat 0:6cc76d70e2a1 3 ( (____ _____ ____ _| |_ _____ ____| |__
ubhat 0:6cc76d70e2a1 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
ubhat 0:6cc76d70e2a1 5 _____) ) ____| | | || |_| ____( (___| | | |
ubhat 0:6cc76d70e2a1 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
ubhat 0:6cc76d70e2a1 7 (C)2015 Semtech
ubhat 0:6cc76d70e2a1 8
ubhat 0:6cc76d70e2a1 9 Description: Process function calls from various Device states
ubhat 0:6cc76d70e2a1 10
ubhat 0:6cc76d70e2a1 11 License: Revised BSD License, see LICENSE.TXT file include in the project
ubhat 0:6cc76d70e2a1 12
ubhat 0:6cc76d70e2a1 13 Maintainer: Uttam Bhat
ubhat 0:6cc76d70e2a1 14 */
ubhat 0:6cc76d70e2a1 15
ubhat 0:6cc76d70e2a1 16 #include "LoRaDeviceStateProc.h"
ubhat 0:6cc76d70e2a1 17 #include "LoRaMacLayerService.h"
ubhat 0:6cc76d70e2a1 18
ubhat 0:6cc76d70e2a1 19 eDevicState DeviceState;
ubhat 0:6cc76d70e2a1 20
ubhat 0:6cc76d70e2a1 21 sLoRaMacUplinkStatus LoRaMacUplinkStatus;
ubhat 0:6cc76d70e2a1 22
ubhat 0:6cc76d70e2a1 23 sLoRaMacDownlinkStatus LoRaMacDownlinkStatus;
ubhat 0:6cc76d70e2a1 24
ubhat 0:6cc76d70e2a1 25 LoRaMacPrimitives_t LoRaPrimitives;
ubhat 0:6cc76d70e2a1 26
ubhat 0:6cc76d70e2a1 27 LoRaMacCallback_t LoRaCallbacks;
ubhat 0:6cc76d70e2a1 28
ubhat 0:6cc76d70e2a1 29 MibRequestConfirm_t LoRaMibReq;
ubhat 0:6cc76d70e2a1 30
ubhat 0:6cc76d70e2a1 31 MlmeReq_t mlmeReq;
ubhat 0:6cc76d70e2a1 32
ubhat 4:d49b89361b67 33 uint16_t ChannelMaskTemp[6] = {0};
ubhat 0:6cc76d70e2a1 34
ubhat 0:6cc76d70e2a1 35 /*!
ubhat 0:6cc76d70e2a1 36 * \brief Function executed on TxNextPacket Timeout event
ubhat 0:6cc76d70e2a1 37 */
ubhat 0:6cc76d70e2a1 38 static void OnTxNextPacketTimerEvent( void )
ubhat 0:6cc76d70e2a1 39 {
ubhat 0:6cc76d70e2a1 40 MibRequestConfirm_t mibReq;
ubhat 0:6cc76d70e2a1 41 LoRaMacStatus_t status;
ubhat 0:6cc76d70e2a1 42
ubhat 0:6cc76d70e2a1 43 TimerStop( &TxNextPacketTimer );
ubhat 0:6cc76d70e2a1 44
ubhat 0:6cc76d70e2a1 45 mibReq.Type = MIB_NETWORK_JOINED;
ubhat 0:6cc76d70e2a1 46 status = LoRaMacMibGetRequestConfirm( &mibReq );
ubhat 0:6cc76d70e2a1 47
ubhat 0:6cc76d70e2a1 48 if( status == LORAMAC_STATUS_OK )
ubhat 0:6cc76d70e2a1 49 {
ubhat 0:6cc76d70e2a1 50 if( mibReq.Param.IsNetworkJoined == true )
ubhat 0:6cc76d70e2a1 51 {
ubhat 0:6cc76d70e2a1 52 DeviceState = DEVICE_STATE_SEND;
ubhat 0:6cc76d70e2a1 53 }
ubhat 0:6cc76d70e2a1 54 else
ubhat 0:6cc76d70e2a1 55 {
ubhat 0:6cc76d70e2a1 56 DeviceState = DEVICE_STATE_JOIN;
ubhat 0:6cc76d70e2a1 57 }
ubhat 0:6cc76d70e2a1 58 NextTx = true;
ubhat 0:6cc76d70e2a1 59 }
ubhat 0:6cc76d70e2a1 60 }
ubhat 0:6cc76d70e2a1 61
ubhat 0:6cc76d70e2a1 62 void DeviceInit( void )
ubhat 0:6cc76d70e2a1 63 {
ubhat 0:6cc76d70e2a1 64 LoRaPrimitives.MacMcpsConfirm = McpsConfirm;
ubhat 0:6cc76d70e2a1 65 LoRaPrimitives.MacMcpsIndication = McpsIndication;
ubhat 0:6cc76d70e2a1 66 LoRaPrimitives.MacMlmeConfirm = MlmeConfirm;
ubhat 0:6cc76d70e2a1 67 LoRaCallbacks.GetBatteryLevel = BoardGetBatteryLevel;
ubhat 0:6cc76d70e2a1 68 LoRaMacInitialization( &LoRaPrimitives, &LoRaCallbacks );
ubhat 0:6cc76d70e2a1 69
ubhat 0:6cc76d70e2a1 70 TimerInit( &TxNextPacketTimer, OnTxNextPacketTimerEvent );
ubhat 0:6cc76d70e2a1 71
ubhat 0:6cc76d70e2a1 72 LoRaMibReq.Type = MIB_ADR;
ubhat 0:6cc76d70e2a1 73 LoRaMibReq.Param.AdrEnable = LORAWAN_ADR_ON;
ubhat 0:6cc76d70e2a1 74 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 75
ubhat 0:6cc76d70e2a1 76 LoRaMibReq.Type = MIB_PUBLIC_NETWORK;
ubhat 0:6cc76d70e2a1 77 LoRaMibReq.Param.EnablePublicNetwork = LORAWAN_PUBLIC_NETWORK;
ubhat 0:6cc76d70e2a1 78 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 79
ubhat 0:6cc76d70e2a1 80 LoRaMibReq.Type = MIB_CHANNELS_TX_POWER;
ubhat 0:6cc76d70e2a1 81 LoRaMibReq.Param.ChannelsTxPower = LORAWAN_TX_POWER;
ubhat 0:6cc76d70e2a1 82 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 4:d49b89361b67 83
ubhat 4:d49b89361b67 84 LoRaMibReq.Type = MIB_CHANNELS_MASK;
ubhat 4:d49b89361b67 85 LoRaMibReq.Param.ChannelsMask = ChannelMaskTemp;
ubhat 4:d49b89361b67 86
ubhat 4:d49b89361b67 87 #ifdef USE_BAND_915_HYBRID_BLOCK_A
ubhat 4:d49b89361b67 88
ubhat 4:d49b89361b67 89 ChannelMaskTemp[0] = 0x00FF;
ubhat 4:d49b89361b67 90 ChannelMaskTemp[1] = 0x0000;
ubhat 4:d49b89361b67 91 ChannelMaskTemp[2] = 0x0000;
ubhat 4:d49b89361b67 92 ChannelMaskTemp[3] = 0x0000;
ubhat 4:d49b89361b67 93 ChannelMaskTemp[4] = 0x0001;
ubhat 4:d49b89361b67 94
ubhat 4:d49b89361b67 95 #elif defined USE_BAND_915_HYBRID_BLOCK_B
ubhat 4:d49b89361b67 96
ubhat 4:d49b89361b67 97 ChannelMaskTemp[0] = 0xFF00;
ubhat 4:d49b89361b67 98 ChannelMaskTemp[1] = 0x0000;
ubhat 4:d49b89361b67 99 ChannelMaskTemp[2] = 0x0000;
ubhat 4:d49b89361b67 100 ChannelMaskTemp[3] = 0x0000;
ubhat 4:d49b89361b67 101 ChannelMaskTemp[4] = 0x0002;
ubhat 4:d49b89361b67 102
ubhat 4:d49b89361b67 103 #elif defined USE_BAND_915_HYBRID_BLOCK_C
ubhat 4:d49b89361b67 104
ubhat 4:d49b89361b67 105 ChannelMaskTemp[0] = 0x0000;
ubhat 4:d49b89361b67 106 ChannelMaskTemp[1] = 0x00FF;
ubhat 4:d49b89361b67 107 ChannelMaskTemp[2] = 0x0000;
ubhat 4:d49b89361b67 108 ChannelMaskTemp[3] = 0x0000;
ubhat 4:d49b89361b67 109 ChannelMaskTemp[4] = 0x0004;
ubhat 4:d49b89361b67 110
ubhat 4:d49b89361b67 111 #elif defined USE_BAND_915_HYBRID_BLOCK_D
ubhat 4:d49b89361b67 112
ubhat 4:d49b89361b67 113 ChannelMaskTemp[0] = 0x0000;
ubhat 4:d49b89361b67 114 ChannelMaskTemp[1] = 0xFF00;
ubhat 4:d49b89361b67 115 ChannelMaskTemp[2] = 0x0000;
ubhat 4:d49b89361b67 116 ChannelMaskTemp[3] = 0x0000;
ubhat 4:d49b89361b67 117 ChannelMaskTemp[4] = 0x0008;
ubhat 4:d49b89361b67 118
ubhat 4:d49b89361b67 119 #elif defined USE_BAND_915_HYBRID_BLOCK_E
ubhat 4:d49b89361b67 120
ubhat 4:d49b89361b67 121 ChannelMaskTemp[0] = 0x0000;
ubhat 4:d49b89361b67 122 ChannelMaskTemp[1] = 0x0000;
ubhat 4:d49b89361b67 123 ChannelMaskTemp[2] = 0x00FF;
ubhat 4:d49b89361b67 124 ChannelMaskTemp[3] = 0x0000;
ubhat 4:d49b89361b67 125 ChannelMaskTemp[4] = 0x0010;
ubhat 4:d49b89361b67 126
ubhat 4:d49b89361b67 127 #elif defined USE_BAND_915_HYBRID_BLOCK_F
ubhat 4:d49b89361b67 128
ubhat 4:d49b89361b67 129 ChannelMaskTemp[0] = 0x0000;
ubhat 4:d49b89361b67 130 ChannelMaskTemp[1] = 0x0000;
ubhat 4:d49b89361b67 131 ChannelMaskTemp[2] = 0xFF00;
ubhat 4:d49b89361b67 132 ChannelMaskTemp[3] = 0x0000;
ubhat 4:d49b89361b67 133 ChannelMaskTemp[4] = 0x0020;
ubhat 4:d49b89361b67 134
ubhat 4:d49b89361b67 135 #elif defined USE_BAND_915_HYBRID_BLOCK_G
ubhat 4:d49b89361b67 136
ubhat 4:d49b89361b67 137 ChannelMaskTemp[0] = 0x0000;
ubhat 4:d49b89361b67 138 ChannelMaskTemp[1] = 0x0000;
ubhat 4:d49b89361b67 139 ChannelMaskTemp[2] = 0x0000;
ubhat 4:d49b89361b67 140 ChannelMaskTemp[3] = 0x00FF;
ubhat 4:d49b89361b67 141 ChannelMaskTemp[4] = 0x0040;
ubhat 4:d49b89361b67 142
ubhat 4:d49b89361b67 143 #elif defined USE_BAND_915_HYBRID_BLOCK_H
ubhat 4:d49b89361b67 144
ubhat 4:d49b89361b67 145 ChannelMaskTemp[0] = 0x0000;
ubhat 4:d49b89361b67 146 ChannelMaskTemp[1] = 0x0000;
ubhat 4:d49b89361b67 147 ChannelMaskTemp[2] = 0x0000;
ubhat 4:d49b89361b67 148 ChannelMaskTemp[3] = 0xFF00;
ubhat 4:d49b89361b67 149 ChannelMaskTemp[4] = 0x0080;
ubhat 4:d49b89361b67 150
ubhat 4:d49b89361b67 151 #elif defined USE_BAND_915
ubhat 4:d49b89361b67 152
ubhat 4:d49b89361b67 153 ChannelMaskTemp[0] = 0xFFFF;
ubhat 4:d49b89361b67 154 ChannelMaskTemp[1] = 0xFFFF;
ubhat 4:d49b89361b67 155 ChannelMaskTemp[2] = 0xFFFF;
ubhat 4:d49b89361b67 156 ChannelMaskTemp[3] = 0xFFFF;
ubhat 4:d49b89361b67 157 ChannelMaskTemp[4] = 0x00FF;
ubhat 4:d49b89361b67 158 ChannelMaskTemp[5] = 0x0000;
ubhat 4:d49b89361b67 159
ubhat 4:d49b89361b67 160 #endif
ubhat 4:d49b89361b67 161
ubhat 4:d49b89361b67 162 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 163
ubhat 0:6cc76d70e2a1 164 LoRaMacDownlinkStatus.DownlinkCounter = 0;
ubhat 0:6cc76d70e2a1 165 }
ubhat 0:6cc76d70e2a1 166
ubhat 0:6cc76d70e2a1 167 void DeviceJoinUpdate( void )
ubhat 0:6cc76d70e2a1 168 {
ubhat 0:6cc76d70e2a1 169 LoRaMibReq.Type = MIB_NETWORK_JOINED;
ubhat 0:6cc76d70e2a1 170 LoRaMacMibGetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 171 }
ubhat 0:6cc76d70e2a1 172
ubhat 0:6cc76d70e2a1 173 void DeviceJoin( void )
ubhat 0:6cc76d70e2a1 174 {
ubhat 0:6cc76d70e2a1 175 #if( OVER_THE_AIR_ACTIVATION != 0 )
ubhat 0:6cc76d70e2a1 176
ubhat 0:6cc76d70e2a1 177 mlmeReq.Type = MLME_JOIN;
ubhat 0:6cc76d70e2a1 178
ubhat 0:6cc76d70e2a1 179 mlmeReq.Req.Join.DevEui = DevEui;
ubhat 0:6cc76d70e2a1 180 mlmeReq.Req.Join.AppEui = AppEui;
ubhat 0:6cc76d70e2a1 181 mlmeReq.Req.Join.AppKey = AppKey;
ubhat 0:6cc76d70e2a1 182
ubhat 0:6cc76d70e2a1 183 if( NextTx == true )
ubhat 0:6cc76d70e2a1 184 {
ubhat 0:6cc76d70e2a1 185 LoRaMacMlmeRequest( &mlmeReq );
ubhat 0:6cc76d70e2a1 186 }
ubhat 0:6cc76d70e2a1 187
ubhat 0:6cc76d70e2a1 188 #else
ubhat 0:6cc76d70e2a1 189 // Choose a random device address if not already defined in Config.h
ubhat 0:6cc76d70e2a1 190 if( DevAddr == 0 )
ubhat 0:6cc76d70e2a1 191 {
ubhat 0:6cc76d70e2a1 192 // Random seed initialization
ubhat 0:6cc76d70e2a1 193 srand1( BoardGetRandomSeed( ) );
ubhat 0:6cc76d70e2a1 194 DevAddr = randr( 0, 0x01FFFFFF );
ubhat 0:6cc76d70e2a1 195 }
ubhat 0:6cc76d70e2a1 196
ubhat 0:6cc76d70e2a1 197 LoRaMibReq.Type = MIB_NET_ID;
ubhat 0:6cc76d70e2a1 198 LoRaMibReq.Param.NetID = LORAWAN_NETWORK_ID;
ubhat 0:6cc76d70e2a1 199 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 200
ubhat 0:6cc76d70e2a1 201 LoRaMibReq.Type = MIB_DEV_ADDR;
ubhat 0:6cc76d70e2a1 202 LoRaMibReq.Param.DevAddr = DevAddr;
ubhat 0:6cc76d70e2a1 203 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 204
ubhat 0:6cc76d70e2a1 205 LoRaMibReq.Type = MIB_NWK_SKEY;
ubhat 0:6cc76d70e2a1 206 LoRaMibReq.Param.NwkSKey = NwkSKey;
ubhat 0:6cc76d70e2a1 207 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 208
ubhat 0:6cc76d70e2a1 209 LoRaMibReq.Type = MIB_APP_SKEY;
ubhat 0:6cc76d70e2a1 210 LoRaMibReq.Param.AppSKey = AppSKey;
ubhat 0:6cc76d70e2a1 211 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 212
ubhat 0:6cc76d70e2a1 213 LoRaMibReq.Type = MIB_NETWORK_JOINED;
ubhat 0:6cc76d70e2a1 214 LoRaMibReq.Param.IsNetworkJoined = true;
ubhat 0:6cc76d70e2a1 215 LoRaMacMibSetRequestConfirm( &LoRaMibReq );
ubhat 0:6cc76d70e2a1 216
ubhat 0:6cc76d70e2a1 217 #endif
ubhat 0:6cc76d70e2a1 218 }
ubhat 0:6cc76d70e2a1 219
ubhat 0:6cc76d70e2a1 220 /*!
ubhat 0:6cc76d70e2a1 221 * \brief Prepares the payload of the frame
ubhat 0:6cc76d70e2a1 222 */
ubhat 0:6cc76d70e2a1 223 void PrepareTxFrame( uint8_t port )
ubhat 0:6cc76d70e2a1 224 {
ubhat 0:6cc76d70e2a1 225 MibRequestConfirm_t mibReq;
ubhat 0:6cc76d70e2a1 226
ubhat 0:6cc76d70e2a1 227 if( BoardGetBatteryLevel( ) < LOW_BAT_THRESHOLD )
ubhat 0:6cc76d70e2a1 228 {
ubhat 0:6cc76d70e2a1 229 mibReq.Type = MIB_CHANNELS_TX_POWER;
ubhat 0:6cc76d70e2a1 230 LoRaMacMibGetRequestConfirm( &mibReq );
ubhat 0:6cc76d70e2a1 231 // TX_POWER_30_DBM = 0, TX_POWER_28_DBM = 1, ..., TX_POWER_20_DBM = 5, ..., TX_POWER_10_DBM = 10
ubhat 0:6cc76d70e2a1 232 // The if condition is then "less than" to check if the power is greater than 20 dBm
ubhat 0:6cc76d70e2a1 233 if( mibReq.Param.ChannelsTxPower < TX_POWER_20_DBM )
ubhat 0:6cc76d70e2a1 234 {
ubhat 0:6cc76d70e2a1 235 mibReq.Param.ChannelsTxPower = TX_POWER_20_DBM;
ubhat 0:6cc76d70e2a1 236 LoRaMacMibSetRequestConfirm( &mibReq );
ubhat 0:6cc76d70e2a1 237 }
ubhat 0:6cc76d70e2a1 238 }
ubhat 0:6cc76d70e2a1 239
ubhat 0:6cc76d70e2a1 240 if( port == 224 )
ubhat 0:6cc76d70e2a1 241 {
ubhat 0:6cc76d70e2a1 242 RunComplianceTest( );
ubhat 0:6cc76d70e2a1 243 }
ubhat 0:6cc76d70e2a1 244 else
ubhat 0:6cc76d70e2a1 245 {
ubhat 0:6cc76d70e2a1 246 PrepareLoRaFrame( port );
ubhat 0:6cc76d70e2a1 247 }
ubhat 0:6cc76d70e2a1 248 }
ubhat 0:6cc76d70e2a1 249
ubhat 0:6cc76d70e2a1 250 /*!
ubhat 0:6cc76d70e2a1 251 * \brief Prepares the payload of the frame
ubhat 0:6cc76d70e2a1 252 *
ubhat 0:6cc76d70e2a1 253 * \retval [0: frame could be send, 1: error]
ubhat 0:6cc76d70e2a1 254 */
ubhat 0:6cc76d70e2a1 255 bool SendFrame( void )
ubhat 0:6cc76d70e2a1 256 {
ubhat 0:6cc76d70e2a1 257 McpsReq_t mcpsReq;
ubhat 0:6cc76d70e2a1 258 LoRaMacTxInfo_t txInfo;
ubhat 0:6cc76d70e2a1 259
ubhat 0:6cc76d70e2a1 260 if( LoRaMacQueryTxPossible( AppDataSize, &txInfo ) != LORAMAC_STATUS_OK )
ubhat 0:6cc76d70e2a1 261 {
ubhat 0:6cc76d70e2a1 262 // Send empty frame in order to flush MAC commands
ubhat 0:6cc76d70e2a1 263 mcpsReq.Type = MCPS_UNCONFIRMED;
ubhat 0:6cc76d70e2a1 264 mcpsReq.Req.Unconfirmed.fBuffer = NULL;
ubhat 0:6cc76d70e2a1 265 mcpsReq.Req.Unconfirmed.fBufferSize = 0;
ubhat 0:6cc76d70e2a1 266 mcpsReq.Req.Unconfirmed.Datarate = LORAWAN_DEFAULT_DATARATE;
ubhat 0:6cc76d70e2a1 267
ubhat 0:6cc76d70e2a1 268 LoRaMacUplinkStatus.Acked = false;
ubhat 0:6cc76d70e2a1 269 LoRaMacUplinkStatus.Port = 0;
ubhat 0:6cc76d70e2a1 270 LoRaMacUplinkStatus.Buffer = NULL;
ubhat 0:6cc76d70e2a1 271 LoRaMacUplinkStatus.BufferSize = 0;
ubhat 0:6cc76d70e2a1 272 }
ubhat 0:6cc76d70e2a1 273 else
ubhat 0:6cc76d70e2a1 274 {
ubhat 0:6cc76d70e2a1 275 LoRaMacUplinkStatus.Acked = false;
ubhat 0:6cc76d70e2a1 276 LoRaMacUplinkStatus.Port = AppPort;
ubhat 0:6cc76d70e2a1 277 LoRaMacUplinkStatus.Buffer = AppData;
ubhat 0:6cc76d70e2a1 278 LoRaMacUplinkStatus.BufferSize = AppDataSize;
ubhat 0:6cc76d70e2a1 279
ubhat 0:6cc76d70e2a1 280 if( ( IsTxConfirmed == false ) || ( LoRaMacUplinkStatus.UplinkCounter == 0 ) )
ubhat 0:6cc76d70e2a1 281 {
ubhat 0:6cc76d70e2a1 282 mcpsReq.Type = MCPS_UNCONFIRMED;
ubhat 0:6cc76d70e2a1 283 mcpsReq.Req.Unconfirmed.fPort = AppPort;
ubhat 0:6cc76d70e2a1 284 mcpsReq.Req.Unconfirmed.fBuffer = AppData;
ubhat 0:6cc76d70e2a1 285 mcpsReq.Req.Unconfirmed.fBufferSize = AppDataSize;
ubhat 0:6cc76d70e2a1 286 mcpsReq.Req.Unconfirmed.Datarate = LORAWAN_DEFAULT_DATARATE;
ubhat 0:6cc76d70e2a1 287 }
ubhat 0:6cc76d70e2a1 288 else
ubhat 0:6cc76d70e2a1 289 {
ubhat 0:6cc76d70e2a1 290 mcpsReq.Type = MCPS_CONFIRMED;
ubhat 0:6cc76d70e2a1 291 mcpsReq.Req.Confirmed.fPort = AppPort;
ubhat 0:6cc76d70e2a1 292 mcpsReq.Req.Confirmed.fBuffer = AppData;
ubhat 0:6cc76d70e2a1 293 mcpsReq.Req.Confirmed.fBufferSize = AppDataSize;
ubhat 0:6cc76d70e2a1 294 mcpsReq.Req.Confirmed.NbTrials = 8;
ubhat 0:6cc76d70e2a1 295 mcpsReq.Req.Confirmed.Datarate = LORAWAN_DEFAULT_DATARATE;
ubhat 0:6cc76d70e2a1 296 }
ubhat 0:6cc76d70e2a1 297 }
ubhat 0:6cc76d70e2a1 298
ubhat 0:6cc76d70e2a1 299 LoRaMacUplinkStatus.Type = mcpsReq.Type;
ubhat 0:6cc76d70e2a1 300
ubhat 0:6cc76d70e2a1 301 if( LoRaMacMcpsRequest( &mcpsReq ) == LORAMAC_STATUS_OK )
ubhat 0:6cc76d70e2a1 302 {
ubhat 0:6cc76d70e2a1 303 return false;
ubhat 0:6cc76d70e2a1 304 }
ubhat 0:6cc76d70e2a1 305 return true;
ubhat 0:6cc76d70e2a1 306 }