1

Dependencies:   X_NUCLEO_IKS01A1 LoRaWAN-lib SX1276Lib mbed

Committer:
ubhat
Date:
Tue Nov 28 08:20:09 2017 +0000
Revision:
6:711a4e008afa
Parent:
0:42863a11464a
Child:
7:730764a067dc
Create project for case study using SX1276 shield

Who changed what in which revision?

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