1 /*! 2 * \file LoRaMac.h 3 * 4 * \brief LoRa MAC layer implementation 5 * 6 * \copyright Revised BSD License, see section \ref LICENSE. 7 * 8 * \code 9 * ______ _ 10 * / _____) _ | | 11 * ( (____ _____ ____ _| |_ _____ ____| |__ 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \ 13 * _____) ) ____| | | || |_| ____( (___| | | | 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_| 15 * (C)2013-2017 Semtech 16 * 17 * ___ _____ _ ___ _ _____ ___ ___ ___ ___ 18 * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| 19 * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| 20 * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| 21 * embedded.connectivity.solutions=============== 22 * 23 * \endcode 24 * 25 * \author Miguel Luis ( Semtech ) 26 * 27 * \author Gregory Cristian ( Semtech ) 28 * 29 * \author Daniel Jaeckle ( STACKFORCE ) 30 * 31 * \author Johannes Bruder ( STACKFORCE ) 32 * 33 * \defgroup LORAMAC LoRa MAC layer implementation 34 * This module specifies the API implementation of the LoRaMAC layer. 35 * This is a placeholder for a detailed description of the LoRaMac 36 * layer and the supported features. 37 * \{ 38 * 39 * \example periodic-uplink-lpp/B-L072Z-LRWAN1/main.c 40 * LoRaWAN class A/B/C application example for the B-L072Z-LRWAN1. 41 * 42 * \example periodic-uplink-lpp/NAMote72/main.c 43 * LoRaWAN class A/B/C application example for the NAMote72. 44 * 45 * \example periodic-uplink-lpp/NucleoL073/main.c 46 * LoRaWAN class A/B/C application example for the NucleoL073. 47 * 48 * \example periodic-uplink-lpp/NucleoL152/main.c 49 * LoRaWAN class A/B/C application example for the NucleoL152. 50 * 51 * \example periodic-uplink-lpp/NucleoL476/main.c 52 * LoRaWAN class A/B/C application example for the NucleoL476. 53 * 54 * \example periodic-uplink-lpp/SAMR34/main.c 55 * LoRaWAN class A/B/C application example for the SAMR34. 56 * 57 * \example periodic-uplink-lpp/SKiM880B/main.c 58 * LoRaWAN class A/B/C application example for the SKiM880B. 59 * 60 * \example periodic-uplink-lpp/SKiM881AXL/main.c 61 * LoRaWAN class A/B/C application example for the SKiM881AXL. 62 * 63 * \example periodic-uplink-lpp/SKiM980A/main.c 64 * LoRaWAN class A/B/C application example for the SKiM980A. 65 */ 66 #ifndef __LORAMAC_H__ 67 #define __LORAMAC_H__ 68 69 #ifdef __cplusplus 70 extern "C" 71 { 72 #endif 73 74 #include <stdint.h> 75 #include <stdbool.h> 76 77 #include "timer.h" 78 #include "systime.h" 79 #include "LoRaMacTypes.h" 80 81 #include "RegionNvm.h" 82 #include "LoRaMacCryptoNvm.h" 83 #include "secure-element-nvm.h" 84 #include "LoRaMacClassBNvm.h" 85 86 /*! 87 * Maximum number of times the MAC layer tries to get an acknowledge. 88 */ 89 #define MAX_ACK_RETRIES 8 90 91 /*! 92 * Frame direction definition for up-link communications 93 */ 94 #define UP_LINK 0 95 96 /*! 97 * Frame direction definition for down-link communications 98 */ 99 #define DOWN_LINK 1 100 101 /*! 102 * LoRaMac MLME-Confirm queue length 103 */ 104 #define LORA_MAC_MLME_CONFIRM_QUEUE_LEN 5 105 106 /*! 107 * Start value for multicast keys enumeration 108 */ 109 #define LORAMAC_CRYPTO_MULTICAST_KEYS 127 110 111 /*! 112 * Maximum MAC commands buffer size 113 */ 114 #define LORA_MAC_COMMAND_MAX_LENGTH 128 115 116 117 /*! 118 * Bitmap value 119 */ 120 #define LORAMAC_NVM_NOTIFY_FLAG_NONE 0x00 121 122 /*! 123 * Bitmap value for the NVM group crypto. 124 */ 125 #define LORAMAC_NVM_NOTIFY_FLAG_CRYPTO 0x01 126 127 /*! 128 * Bitmap value for the NVM group MAC 1. 129 */ 130 #define LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP1 0x02 131 132 /*! 133 * Bitmap value for the NVM group MAC 2. 134 */ 135 #define LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP2 0x04 136 137 /*! 138 * Bitmap value for the NVM group secure element. 139 */ 140 #define LORAMAC_NVM_NOTIFY_FLAG_SECURE_ELEMENT 0x08 141 142 /*! 143 * Bitmap value for the NVM group 1 region. 144 */ 145 #define LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP1 0x10 146 147 /*! 148 * Bitmap value for the NVM group 2 region. 149 */ 150 #define LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP2 0x20 151 152 /*! 153 * Bitmap value for the NVM group class b. 154 */ 155 #define LORAMAC_NVM_NOTIFY_FLAG_CLASS_B 0x40 156 157 /*! 158 * LoRaWAN compliance certification protocol port number. 159 * 160 * LoRaWAN Specification V1.x.x, chapter 4.3.2 161 */ 162 #define LORAMAC_CERT_FPORT 224 163 164 /*! 165 * End-Device activation type 166 */ 167 typedef enum eActivationType 168 { 169 /*! 170 * None 171 */ 172 ACTIVATION_TYPE_NONE = 0, 173 /*! 174 * Activation By Personalization (ACTIVATION_TYPE_ABP) 175 */ 176 ACTIVATION_TYPE_ABP = 1, 177 /*! 178 * Over-The-Air Activation (ACTIVATION_TYPE_OTAA) 179 */ 180 ACTIVATION_TYPE_OTAA = 2, 181 }ActivationType_t; 182 183 /*! 184 * LoRaMAC receive window channel parameters 185 */ 186 typedef struct sRxChannelParams 187 { 188 /*! 189 * Frequency in Hz 190 */ 191 uint32_t Frequency; 192 /*! 193 * Data rate 194 * 195 * LoRaWAN Regional Parameters V1.0.2rB 196 * 197 * The allowed ranges are region specific. Please refer to \ref DR_0 to \ref DR_15 for details. 198 */ 199 uint8_t Datarate; 200 }RxChannelParams_t; 201 202 /*! 203 * LoRaMAC receive window enumeration 204 */ 205 typedef enum eLoRaMacRxSlot 206 { 207 /*! 208 * LoRaMAC receive window 1 209 */ 210 RX_SLOT_WIN_1, 211 /*! 212 * LoRaMAC receive window 2 213 */ 214 RX_SLOT_WIN_2, 215 /*! 216 * LoRaMAC receive window 2 for class c - continuous listening 217 */ 218 RX_SLOT_WIN_CLASS_C, 219 /*! 220 * LoRaMAC class c multicast downlink 221 */ 222 RX_SLOT_WIN_CLASS_C_MULTICAST, 223 /*! 224 * LoRaMAC class b ping slot window 225 */ 226 RX_SLOT_WIN_CLASS_B_PING_SLOT, 227 /*! 228 * LoRaMAC class b multicast slot window 229 */ 230 RX_SLOT_WIN_CLASS_B_MULTICAST_SLOT, 231 /*! 232 * LoRaMAC no active receive window 233 */ 234 RX_SLOT_NONE, 235 }LoRaMacRxSlot_t; 236 237 /*! 238 * Global MAC layer parameters 239 */ 240 typedef struct sLoRaMacParams 241 { 242 /*! 243 * System overall timing error in milliseconds. 244 * [-SystemMaxRxError : +SystemMaxRxError] 245 * Default: +/-10 ms 246 */ 247 uint32_t SystemMaxRxError; 248 /*! 249 * Minimum required number of symbols to detect an Rx frame 250 * Default: 6 symbols 251 */ 252 uint8_t MinRxSymbols; 253 /*! 254 * LoRaMac maximum time a reception window stays open 255 */ 256 uint32_t MaxRxWindow; 257 /*! 258 * Receive delay 1 259 */ 260 uint32_t ReceiveDelay1; 261 /*! 262 * Receive delay 2 263 */ 264 uint32_t ReceiveDelay2; 265 /*! 266 * Join accept delay 1 267 */ 268 uint32_t JoinAcceptDelay1; 269 /*! 270 * Join accept delay 1 271 */ 272 uint32_t JoinAcceptDelay2; 273 /*! 274 * Number of uplink messages repetitions [1:15] 275 */ 276 uint8_t ChannelsNbTrans; 277 /*! 278 * Datarate offset between uplink and downlink on first window 279 */ 280 uint8_t Rx1DrOffset; 281 /*! 282 * LoRaMAC 2nd reception window settings 283 */ 284 RxChannelParams_t Rx2Channel; 285 /*! 286 * LoRaMAC continuous reception window settings 287 */ 288 RxChannelParams_t RxCChannel; 289 /*! 290 * Uplink dwell time configuration. 0: No limit, 1: 400ms 291 */ 292 uint8_t UplinkDwellTime; 293 /*! 294 * Downlink dwell time configuration. 0: No limit, 1: 400ms 295 */ 296 uint8_t DownlinkDwellTime; 297 /*! 298 * Maximum possible EIRP 299 */ 300 float MaxEirp; 301 /*! 302 * Antenna gain of the node 303 */ 304 float AntennaGain; 305 }LoRaMacParams_t; 306 307 /*! 308 * LoRaMAC data structure for a PingSlotInfoReq \ref MLME_PING_SLOT_INFO 309 * 310 * LoRaWAN Specification 311 */ 312 typedef union uPingSlotInfo 313 { 314 /*! 315 * Parameter for byte access 316 */ 317 uint8_t Value; 318 /*! 319 * Structure containing the parameters for the PingSlotInfoReq 320 */ 321 struct sInfoFields 322 { 323 /*! 324 * Periodicity = 0: ping slot every second 325 * Periodicity = 7: ping slot every 128 seconds 326 */ 327 uint8_t Periodicity : 3; 328 /*! 329 * RFU 330 */ 331 uint8_t RFU : 5; 332 }Fields; 333 }PingSlotInfo_t; 334 335 /*! 336 * LoRaMAC data structure for the \ref MLME_BEACON MLME-Indication 337 * 338 * LoRaWAN Specification 339 */ 340 typedef struct sBeaconInfo 341 { 342 /*! 343 * Timestamp in seconds since 00:00:00, Sunday 6th of January 1980 344 * (start of the GPS epoch) modulo 2^32 345 */ 346 SysTime_t Time; 347 /*! 348 * Frequency 349 */ 350 uint32_t Frequency; 351 /*! 352 * Datarate 353 */ 354 uint8_t Datarate; 355 /*! 356 * RSSI 357 */ 358 int16_t Rssi; 359 /*! 360 * SNR 361 */ 362 int8_t Snr; 363 /*! 364 * Param 365 * | Bits | 7:2 | 1:0 | 366 * |-------|-----|------| 367 * | Param | RFU | Prec | 368 * 369 * Prec field is used to interpret the precision of beacon's transmit time 370 * as 10^(-6+prec) and the default value is 0. 371 * RFU will be set to Zero and Prec can take values between 0:3. 372 */ 373 uint8_t Param; 374 /*! 375 * Data structure for the gateway specific part. The 376 * content of the values may differ for each gateway 377 */ 378 struct sGwSpecific 379 { 380 /*! 381 * Info descriptor - can differ for each gateway 382 */ 383 uint8_t InfoDesc; 384 /*! 385 * Info - can differ for each gateway 386 */ 387 uint8_t Info[6]; 388 }GwSpecific; 389 }BeaconInfo_t; 390 391 /*! 392 * Enumeration containing the status of the operation of a MAC service 393 */ 394 typedef enum eLoRaMacEventInfoStatus 395 { 396 /*! 397 * Service performed successfully 398 */ 399 LORAMAC_EVENT_INFO_STATUS_OK = 0, 400 /*! 401 * An error occurred during the execution of the service 402 */ 403 LORAMAC_EVENT_INFO_STATUS_ERROR, 404 /*! 405 * A Tx timeout occurred 406 */ 407 LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT, 408 /*! 409 * An Rx timeout occurred on receive window 1 410 */ 411 LORAMAC_EVENT_INFO_STATUS_RX1_TIMEOUT, 412 /*! 413 * An Rx timeout occurred on receive window 2 414 */ 415 LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT, 416 /*! 417 * An Rx error occurred on receive window 1 418 */ 419 LORAMAC_EVENT_INFO_STATUS_RX1_ERROR, 420 /*! 421 * An Rx error occurred on receive window 2 422 */ 423 LORAMAC_EVENT_INFO_STATUS_RX2_ERROR, 424 /*! 425 * An error occurred in the join procedure 426 */ 427 LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL, 428 /*! 429 * A frame with an invalid downlink counter was received. The 430 * downlink counter of the frame was equal to the local copy 431 * of the downlink counter of the node. 432 */ 433 LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED, 434 /*! 435 * The MAC could not retransmit a frame since the MAC decreased the datarate. The 436 * payload size is not applicable for the datarate. 437 */ 438 LORAMAC_EVENT_INFO_STATUS_TX_DR_PAYLOAD_SIZE_ERROR, 439 /*! 440 * An address error occurred 441 */ 442 LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL, 443 /*! 444 * Message integrity check failure 445 */ 446 LORAMAC_EVENT_INFO_STATUS_MIC_FAIL, 447 /*! 448 * ToDo 449 */ 450 LORAMAC_EVENT_INFO_STATUS_MULTICAST_FAIL, 451 /*! 452 * ToDo 453 */ 454 LORAMAC_EVENT_INFO_STATUS_BEACON_LOCKED, 455 /*! 456 * ToDo 457 */ 458 LORAMAC_EVENT_INFO_STATUS_BEACON_LOST, 459 /*! 460 * ToDo 461 */ 462 LORAMAC_EVENT_INFO_STATUS_BEACON_NOT_FOUND, 463 }LoRaMacEventInfoStatus_t; 464 465 /*! 466 * LoRaMac tx/rx operation state 467 */ 468 typedef union eLoRaMacFlags_t 469 { 470 /*! 471 * Byte-access to the bits 472 */ 473 uint8_t Value; 474 /*! 475 * Structure containing single access to bits 476 */ 477 struct sMacFlagBits 478 { 479 /*! 480 * MCPS-Req pending 481 */ 482 uint8_t McpsReq : 1; 483 /*! 484 * MCPS-Ind pending 485 */ 486 uint8_t McpsInd : 1; 487 /*! 488 * MLME-Req pending 489 */ 490 uint8_t MlmeReq : 1; 491 /*! 492 * MLME-Ind pending 493 */ 494 uint8_t MlmeInd : 1; 495 /*! 496 * MAC cycle done 497 */ 498 uint8_t MacDone : 1; 499 /*! 500 * Indicate if a NVM handling is required 501 */ 502 uint8_t NvmHandle : 1; 503 }Bits; 504 }LoRaMacFlags_t; 505 506 /*! 507 * LoRaMAC region enumeration 508 */ 509 typedef enum eLoRaMacRegion 510 { 511 /*! 512 * AS band on 923MHz 513 */ 514 LORAMAC_REGION_AS923, 515 /*! 516 * Australian band on 915MHz 517 */ 518 LORAMAC_REGION_AU915, 519 /*! 520 * Chinese band on 470MHz 521 */ 522 LORAMAC_REGION_CN470, 523 /*! 524 * Chinese band on 779MHz 525 */ 526 LORAMAC_REGION_CN779, 527 /*! 528 * European band on 433MHz 529 */ 530 LORAMAC_REGION_EU433, 531 /*! 532 * European band on 868MHz 533 */ 534 LORAMAC_REGION_EU868, 535 /*! 536 * South korean band on 920MHz 537 */ 538 LORAMAC_REGION_KR920, 539 /*! 540 * India band on 865MHz 541 */ 542 LORAMAC_REGION_IN865, 543 /*! 544 * North american band on 915MHz 545 */ 546 LORAMAC_REGION_US915, 547 /*! 548 * Russia band on 864MHz 549 */ 550 LORAMAC_REGION_RU864, 551 }LoRaMacRegion_t; 552 553 typedef struct sLoRaMacNvmDataGroup1 554 { 555 /*! 556 * Counts the number of missed ADR acknowledgements 557 */ 558 uint32_t AdrAckCounter; 559 /*! 560 * Last transmission time. 561 */ 562 TimerTime_t LastTxDoneTime; 563 /*! 564 * Aggregated time off. 565 */ 566 TimerTime_t AggregatedTimeOff; 567 /*! 568 * Last received Message integrity Code (MIC) 569 */ 570 uint32_t LastRxMic; 571 /*! 572 * Channels TX power 573 */ 574 int8_t ChannelsTxPower; 575 /*! 576 * Channels data rate 577 */ 578 int8_t ChannelsDatarate; 579 /*! 580 * If the server has sent a FRAME_TYPE_DATA_CONFIRMED_DOWN this variable indicates 581 * if the ACK bit must be set for the next transmission 582 */ 583 bool SrvAckRequested; 584 /*! 585 * Counts the number if uplinks to know when the next Rejoin request type 0 is required. 586 * ( If requested by the server through RejoinParamSetupReq MAC command ) 587 */ 588 uint32_t Rejoin0UplinksCounter; 589 /*! 590 * Counter of Rejoin Request of retries. 591 * ( If requested by the server through ForceRejoinReq MAC command ) 592 */ 593 uint8_t ForceRejoinRetriesCounter; 594 /*! 595 * Counts the number of uplinks containing a RekeyInd MAC command to know 596 * when the end device should reverted to join state because it didn't 597 * received a RekeyConf. 598 */ 599 uint16_t RekeyIndUplinksCounter; 600 /*! 601 * CRC32 value of the MacGroup1 data structure. 602 */ 603 uint32_t Crc32; 604 }LoRaMacNvmDataGroup1_t; 605 606 typedef struct sLoRaMacNvmDataGroup2 607 { 608 /* 609 * LoRaMac region. 610 */ 611 LoRaMacRegion_t Region; 612 /* 613 * LoRaMac parameters 614 */ 615 LoRaMacParams_t MacParams; 616 /* 617 * LoRaMac default parameters 618 */ 619 LoRaMacParams_t MacParamsDefaults; 620 /*! 621 * Channels TX power 622 */ 623 int8_t ChannelsTxPowerDefault; 624 /*! 625 * Channels data rate 626 */ 627 int8_t ChannelsDatarateDefault; 628 /* 629 * Network ID ( 3 bytes ) 630 */ 631 uint32_t NetID; 632 /* 633 * Mote Address 634 */ 635 uint32_t DevAddr; 636 /*! 637 * Multicast channel list 638 */ 639 MulticastCtx_t MulticastChannelList[LORAMAC_MAX_MC_CTX]; 640 /* 641 * Actual device class 642 */ 643 DeviceClass_t DeviceClass; 644 /* 645 * Indicates if the node is connected to 646 * a private or public network 647 */ 648 bool PublicNetwork; 649 /* 650 * LoRaMac ADR control status 651 */ 652 bool AdrCtrlOn; 653 /* 654 * Maximum duty cycle 655 * \remark Possibility to shutdown the device. 656 */ 657 uint8_t MaxDCycle; 658 /* 659 * Enables/Disables duty cycle management (Test only) 660 */ 661 bool DutyCycleOn; 662 /* 663 * Set to true, if the datarate was increased 664 * with a link adr request. 665 */ 666 bool ChannelsDatarateChangedLinkAdrReq; 667 /* 668 * The stack will set this variable to true, if a downlink has been received. 669 */ 670 bool DownlinkReceived; 671 /* 672 * Enables/disable FPort 224 processing (certification port) 673 */ 674 bool IsCertPortOn; 675 /* 676 * Aggregated duty cycle management 677 */ 678 uint16_t AggregatedDCycle; 679 /* 680 * Stores the time at LoRaMac initialization. 681 * 682 * \remark Used for the BACKOFF_DC computation. 683 */ 684 SysTime_t InitializationTime; 685 /* 686 * Current LoRaWAN Version 687 */ 688 Version_t Version; 689 /* 690 * End-Device network activation 691 */ 692 ActivationType_t NetworkActivation; 693 /*! 694 * Number of uplinks without Rejoin request type 0. 695 * ( If requested by the server through RejoinParamSetupReq MAC command ) 696 * When it's set to 0, Rejoin0UplinksCounter won't be incremented 697 */ 698 uint32_t Rejoin0UplinksLimit; 699 /*! 700 * The total number of times the device will retry the Rejoin Request. 701 * ( If requested by the server through ForceRejoinReq MAC command ) 702 */ 703 uint8_t ForceRejoinMaxRetries; 704 /*! 705 * Rejoin Request Type 706 * ( If requested by the server through ForceRejoinReq MAC command ) 707 */ 708 uint8_t ForceRejoinType; 709 /*! 710 * Time in seconds between cyclic transmission of Type 0 Rejoin requests. 711 */ 712 uint32_t Rejoin0CycleInSec; 713 /*! 714 * Time in seconds between cyclic transmission of Type 1 Rejoin requests. 715 */ 716 uint32_t Rejoin1CycleInSec; 717 /*! 718 * Time in seconds between cyclic transmission of Type 2 Rejoin requests. 719 */ 720 uint32_t Rejoin2CycleInSec; 721 /*! 722 * Indicates if a Rejoin request was sent and no join-accept or any downlink 723 * has been received yet. 724 */ 725 bool IsRejoinAcceptPending; 726 /*! 727 * CRC32 value of the MacGroup2 data structure. 728 */ 729 uint32_t Crc32; 730 }LoRaMacNvmDataGroup2_t; 731 732 /*! 733 * LoRaMAC data structure for non-volatile memory (NVM). 734 * This structure contains data which must be stored in NVM. 735 */ 736 typedef struct sLoRaMacNvmData 737 { 738 /*! 739 * Parameters related to the crypto layer. Change with every TX/RX 740 * procedure. 741 */ 742 LoRaMacCryptoNvmData_t Crypto; 743 /*! 744 * Parameters related to the MAC which change with high probability after 745 * every TX/RX procedure. 746 */ 747 LoRaMacNvmDataGroup1_t MacGroup1; 748 /*! 749 * Parameters related to the MAC which do not change very likely with every 750 * TX/RX procedure. 751 */ 752 LoRaMacNvmDataGroup2_t MacGroup2; 753 /*! 754 * Parameters related to the secure-element. 755 */ 756 SecureElementNvmData_t SecureElement; 757 /*! 758 * Parameters related to the regional implementation which change with high 759 * probability after every TX/RX procedure. 760 */ 761 RegionNvmDataGroup1_t RegionGroup1; 762 /*! 763 * Parameters related to the regional implementation which do not change 764 * very likely with every TX/RX procedure. 765 */ 766 RegionNvmDataGroup2_t RegionGroup2; 767 /*! 768 * Parameters related to class b. 769 */ 770 LoRaMacClassBNvmData_t ClassB; 771 }LoRaMacNvmData_t; 772 773 /*! 774 * 775 * \brief LoRaMAC data services 776 * 777 * \details The following table list the primitives which are supported by the 778 * specific MAC data service: 779 * 780 * Name | Request | Indication | Response | Confirm 781 * --------------------- | :-----: | :--------: | :------: | :-----: 782 * \ref MCPS_UNCONFIRMED | YES | YES | NO | YES 783 * \ref MCPS_CONFIRMED | YES | YES | NO | YES 784 * \ref MCPS_MULTICAST | NO | YES | NO | NO 785 * \ref MCPS_PROPRIETARY | YES | YES | NO | YES 786 * 787 * The following table provides links to the function implementations of the 788 * related MCPS primitives: 789 * 790 * Primitive | Function 791 * ---------------- | :---------------------: 792 * MCPS-Request | \ref LoRaMacMlmeRequest 793 * MCPS-Confirm | MacMcpsConfirm in \ref LoRaMacPrimitives_t 794 * MCPS-Indication | MacMcpsIndication in \ref LoRaMacPrimitives_t 795 */ 796 typedef enum eMcps 797 { 798 /*! 799 * Unconfirmed LoRaMAC frame 800 */ 801 MCPS_UNCONFIRMED, 802 /*! 803 * Confirmed LoRaMAC frame 804 */ 805 MCPS_CONFIRMED, 806 /*! 807 * Multicast LoRaMAC frame 808 */ 809 MCPS_MULTICAST, 810 /*! 811 * Proprietary frame 812 */ 813 MCPS_PROPRIETARY, 814 }Mcps_t; 815 816 /*! 817 * Structure which defines return parameters for requests. 818 */ 819 typedef struct sRequestReturnParam 820 { 821 /*! 822 * This value reports the time in milliseconds which 823 * an application must wait before its possible to send 824 * the next uplink. 825 */ 826 TimerTime_t DutyCycleWaitTime; 827 }RequestReturnParam_t; 828 829 /*! 830 * LoRaMAC MCPS-Request for an unconfirmed frame 831 */ 832 typedef struct sMcpsReqUnconfirmed 833 { 834 /*! 835 * Frame port field. Must be set if the payload is not empty. Use the 836 * application specific frame port values: [1...223] 837 * 838 * LoRaWAN Specification V1.0.2, chapter 4.3.2 839 */ 840 uint8_t fPort; 841 /*! 842 * Pointer to the buffer of the frame payload 843 */ 844 void* fBuffer; 845 /*! 846 * Size of the frame payload 847 */ 848 uint16_t fBufferSize; 849 /*! 850 * Uplink datarate, if ADR is off 851 */ 852 int8_t Datarate; 853 }McpsReqUnconfirmed_t; 854 855 /*! 856 * LoRaMAC MCPS-Request for a confirmed frame 857 */ 858 typedef struct sMcpsReqConfirmed 859 { 860 /*! 861 * Frame port field. Must be set if the payload is not empty. Use the 862 * application specific frame port values: [1...223] 863 * 864 * LoRaWAN Specification V1.0.2, chapter 4.3.2 865 */ 866 uint8_t fPort; 867 /*! 868 * Pointer to the buffer of the frame payload 869 */ 870 void* fBuffer; 871 /*! 872 * Size of the frame payload 873 */ 874 uint16_t fBufferSize; 875 /*! 876 * Uplink datarate, if ADR is off 877 */ 878 int8_t Datarate; 879 }McpsReqConfirmed_t; 880 881 /*! 882 * LoRaMAC MCPS-Request for a proprietary frame 883 */ 884 typedef struct sMcpsReqProprietary 885 { 886 /*! 887 * Pointer to the buffer of the frame payload 888 */ 889 void* fBuffer; 890 /*! 891 * Size of the frame payload 892 */ 893 uint16_t fBufferSize; 894 /*! 895 * Uplink datarate, if ADR is off 896 */ 897 int8_t Datarate; 898 }McpsReqProprietary_t; 899 900 /*! 901 * LoRaMAC MCPS-Request structure 902 */ 903 typedef struct sMcpsReq 904 { 905 /*! 906 * MCPS-Request type 907 */ 908 Mcps_t Type; 909 910 /*! 911 * MCPS-Request parameters 912 */ 913 union uMcpsParam 914 { 915 /*! 916 * MCPS-Request parameters for an unconfirmed frame 917 */ 918 McpsReqUnconfirmed_t Unconfirmed; 919 /*! 920 * MCPS-Request parameters for a confirmed frame 921 */ 922 McpsReqConfirmed_t Confirmed; 923 /*! 924 * MCPS-Request parameters for a proprietary frame 925 */ 926 McpsReqProprietary_t Proprietary; 927 }Req; 928 929 /*! 930 * MCPS-Request return parameters 931 */ 932 RequestReturnParam_t ReqReturn; 933 }McpsReq_t; 934 935 /*! 936 * LoRaMAC MCPS-Confirm 937 */ 938 typedef struct sMcpsConfirm 939 { 940 /*! 941 * Holds the previously performed MCPS-Request 942 */ 943 Mcps_t McpsRequest; 944 /*! 945 * Status of the operation 946 */ 947 LoRaMacEventInfoStatus_t Status; 948 /*! 949 * Uplink datarate 950 */ 951 uint8_t Datarate; 952 /*! 953 * Transmission power 954 */ 955 int8_t TxPower; 956 /*! 957 * Set if an acknowledgement was received 958 */ 959 bool AckReceived; 960 /*! 961 * Provides the number of retransmissions 962 */ 963 uint8_t NbTrans; 964 /*! 965 * The transmission time on air of the frame 966 */ 967 TimerTime_t TxTimeOnAir; 968 /*! 969 * The uplink counter value related to the frame 970 */ 971 uint32_t UpLinkCounter; 972 /*! 973 * The uplink channel related to the frame 974 */ 975 uint32_t Channel; 976 }McpsConfirm_t; 977 978 /*! 979 * LoRaMAC MCPS-Indication primitive 980 */ 981 typedef struct sMcpsIndication 982 { 983 /*! 984 * MCPS-Indication type 985 */ 986 Mcps_t McpsIndication; 987 /*! 988 * Status of the operation 989 */ 990 LoRaMacEventInfoStatus_t Status; 991 /*! 992 * Multicast 993 */ 994 uint8_t Multicast; 995 /*! 996 * Application port 997 */ 998 uint8_t Port; 999 /*! 1000 * Downlink datarate 1001 */ 1002 uint8_t RxDatarate; 1003 /*! 1004 * Frame pending status 1005 */ 1006 uint8_t IsUplinkTxPending; 1007 /*! 1008 * Pointer to the received data stream 1009 */ 1010 uint8_t* Buffer; 1011 /*! 1012 * Size of the received data stream 1013 */ 1014 uint8_t BufferSize; 1015 /*! 1016 * Indicates, if data is available 1017 */ 1018 bool RxData; 1019 /*! 1020 * Rssi of the received packet 1021 */ 1022 int16_t Rssi; 1023 /*! 1024 * Snr of the received packet 1025 */ 1026 int8_t Snr; 1027 /*! 1028 * Receive window 1029 */ 1030 LoRaMacRxSlot_t RxSlot; 1031 /*! 1032 * Set if an acknowledgement was received 1033 */ 1034 bool AckReceived; 1035 /*! 1036 * The downlink counter value for the received frame 1037 */ 1038 uint32_t DownLinkCounter; 1039 /*! 1040 * The device address of the frame 1041 */ 1042 uint32_t DevAddress; 1043 /*! 1044 * Set if a DeviceTimeAns MAC command was received. 1045 */ 1046 bool DeviceTimeAnsReceived; 1047 /*! 1048 * Response timeout for a class b or c device when a 1049 * confirmed downlink has been received. In all other 1050 * cases this variable is 0. 1051 */ 1052 TimerTime_t ResponseTimeout; 1053 }McpsIndication_t; 1054 1055 /*! 1056 * \brief LoRaMAC management services 1057 * 1058 * \details The following table list the primitives which are supported by the 1059 * specific MAC management service: 1060 * 1061 * Name | Request | Indication | Response | Confirm 1062 * ---------------------------- | :-----: | :--------: | :------: | :-----: 1063 * \ref MLME_JOIN | YES | NO | NO | YES 1064 * \ref MLME_REJOIN_0 | YES | NO | NO | YES 1065 * \ref MLME_REJOIN_1 | YES | NO | NO | YES 1066 * \ref MLME_LINK_CHECK | YES | NO | NO | YES 1067 * \ref MLME_TXCW | YES | NO | NO | YES 1068 * \ref MLME_DERIVE_MC_KE_KEY | YES | NO | NO | YES 1069 * \ref MLME_DERIVE_MC_KEY_PAIR | YES | NO | NO | YES 1070 * \ref MLME_REVERT_JOIN | NO | YES | NO | NO 1071 * 1072 * The following table provides links to the function implementations of the 1073 * related MLME primitives. 1074 * 1075 * Primitive | Function 1076 * ---------------- | :---------------------: 1077 * MLME-Request | \ref LoRaMacMlmeRequest 1078 * MLME-Confirm | MacMlmeConfirm in \ref LoRaMacPrimitives_t 1079 * MLME-Indication | MacMlmeIndication in \ref LoRaMacPrimitives_t 1080 */ 1081 typedef enum eMlme 1082 { 1083 /*! 1084 * An unknown MLME service 1085 */ 1086 MLME_UNKNOWN, 1087 /*! 1088 * Initiates the Over-the-Air activation 1089 * 1090 * LoRaWAN Specification V1.0.2, chapter 6.2 1091 */ 1092 MLME_JOIN, 1093 /*! 1094 * Initiates sending a ReJoin-request type 0 1095 * 1096 * LoRaWAN Specification V1.1.0, chapter 6.2.4.1 1097 */ 1098 MLME_REJOIN_0, 1099 /*! 1100 * Initiates sending a ReJoin-request type 1 1101 * 1102 * LoRaWAN Specification V1.1.0, chapter 6.2.4.2 1103 */ 1104 MLME_REJOIN_1, 1105 /*! 1106 * LinkCheckReq - Connectivity validation 1107 * 1108 * LoRaWAN Specification V1.0.2, chapter 5, table 4 1109 */ 1110 MLME_LINK_CHECK, 1111 /*! 1112 * Sets Tx continuous wave mode 1113 * 1114 * LoRaWAN end-device certification 1115 */ 1116 MLME_TXCW, 1117 /*! 1118 * Derives the McKEKey from the AppKey or NwkKey. 1119 */ 1120 MLME_DERIVE_MC_KE_KEY, 1121 /*! 1122 * Derives a Multicast group key pair ( McAppSKey, McNwkSKey ) from McKey 1123 */ 1124 MLME_DERIVE_MC_KEY_PAIR, 1125 /*! 1126 * Initiates a DeviceTimeReq 1127 * 1128 * LoRaWAN end-device certification 1129 */ 1130 MLME_DEVICE_TIME, 1131 /*! 1132 * The MAC uses this MLME primitive to indicate a beacon reception 1133 * status. 1134 * 1135 * LoRaWAN end-device certification 1136 */ 1137 MLME_BEACON, 1138 /*! 1139 * Initiate a beacon acquisition. The MAC will search for a beacon. 1140 * It will search for XX_BEACON_INTERVAL milliseconds. 1141 * 1142 * LoRaWAN end-device certification 1143 */ 1144 MLME_BEACON_ACQUISITION, 1145 /*! 1146 * Initiates a PingSlotInfoReq 1147 * 1148 * LoRaWAN end-device certification 1149 */ 1150 MLME_PING_SLOT_INFO, 1151 /*! 1152 * Initiates a BeaconTimingReq 1153 * 1154 * LoRaWAN end-device certification 1155 */ 1156 MLME_BEACON_TIMING, 1157 /*! 1158 * Primitive which indicates that the beacon has been lost 1159 * 1160 * \remark The upper layer is required to switch the device class to ClassA 1161 * 1162 * LoRaWAN end-device certification 1163 */ 1164 MLME_BEACON_LOST, 1165 /*! 1166 * 1167 * Indicates that the device hasn't received a RekeyConf and it reverts to the join state. 1168 * 1169 * \remark The upper layer is required to trigger the Join process again. 1170 */ 1171 MLME_REVERT_JOIN, 1172 }Mlme_t; 1173 1174 /*! 1175 * LoRaMAC MLME-Request for the join service 1176 */ 1177 typedef struct sMlmeReqJoin 1178 { 1179 /*! 1180 * LoRaWAN Network End-Device Activation ( ACTIVATION_TYPE_NONE, ACTIVATION_TYPE_ABP or OTTA ) 1181 * 1182 * Related MIB type: \ref MIB_NETWORK_ACTIVATION 1183 */ 1184 ActivationType_t NetworkActivation; 1185 /*! 1186 * Datarate used for join request. 1187 */ 1188 uint8_t Datarate; 1189 }MlmeReqJoin_t; 1190 1191 /*! 1192 * LoRaMAC MLME-Request for Tx continuous wave mode 1193 */ 1194 typedef struct sMlmeReqTxCw 1195 { 1196 /*! 1197 * Time in seconds while the radio is kept in continuous wave mode 1198 */ 1199 uint16_t Timeout; 1200 /*! 1201 * RF frequency to set (Only used with new way) 1202 */ 1203 uint32_t Frequency; 1204 /*! 1205 * RF output power to set (Only used with new way) 1206 */ 1207 int8_t Power; 1208 }MlmeReqTxCw_t; 1209 1210 /*! 1211 * LoRaMAC MLME-Request for the ping slot info service 1212 */ 1213 typedef struct sMlmeReqPingSlotInfo 1214 { 1215 PingSlotInfo_t PingSlot; 1216 }MlmeReqPingSlotInfo_t; 1217 1218 /*! 1219 * LoRaMAC MLME-Request to derive the McKEKey from the AppKey or NwkKey 1220 */ 1221 typedef struct sMlmeReqDeriveMcKEKey 1222 { 1223 /*! 1224 * Key identifier of the root key to use to perform the derivation ( NwkKey or AppKey ) 1225 */ 1226 KeyIdentifier_t KeyID; 1227 /*! 1228 * Nonce value ( nonce <= 15) 1229 */ 1230 uint16_t Nonce; 1231 /*! 1232 * DevEUI Value 1233 */ 1234 uint8_t* DevEUI; 1235 }MlmeReqDeriveMcKEKey_t; 1236 1237 /*! 1238 * LoRaMAC MLME-Request to derive a Multicast group key pair ( McAppSKey, McNwkSKey ) from McKey 1239 */ 1240 typedef struct sMlmeReqDeriveMcSessionKeyPair 1241 { 1242 /*! 1243 * Address identifier to select the multicast group 1244 */ 1245 AddressIdentifier_t GroupID; 1246 }MlmeReqDeriveMcSessionKeyPair_t; 1247 1248 /*! 1249 * LoRaMAC MLME-Request structure 1250 */ 1251 typedef struct sMlmeReq 1252 { 1253 /*! 1254 * MLME-Request type 1255 */ 1256 Mlme_t Type; 1257 1258 /*! 1259 * MLME-Request parameters 1260 */ 1261 union uMlmeParam 1262 { 1263 /*! 1264 * MLME-Request parameters for a join request 1265 */ 1266 MlmeReqJoin_t Join; 1267 /*! 1268 * MLME-Request parameters for Tx continuous mode request 1269 */ 1270 MlmeReqTxCw_t TxCw; 1271 /*! 1272 * MLME-Request parameters for a ping slot info request 1273 */ 1274 MlmeReqPingSlotInfo_t PingSlotInfo; 1275 /*! 1276 * MLME-Request to derive the McKEKey from the AppKey or NwkKey 1277 */ 1278 MlmeReqDeriveMcKEKey_t DeriveMcKEKey; 1279 /*! 1280 * MLME-Request to derive a Multicast group key pair ( McAppSKey, McNwkSKey ) from McKey 1281 */ 1282 MlmeReqDeriveMcSessionKeyPair_t DeriveMcSessionKeyPair; 1283 }Req; 1284 1285 /*! 1286 * MLME-Request return parameters 1287 */ 1288 RequestReturnParam_t ReqReturn; 1289 }MlmeReq_t; 1290 1291 /*! 1292 * LoRaMAC MLME-Confirm primitive 1293 */ 1294 typedef struct sMlmeConfirm 1295 { 1296 /*! 1297 * Holds the previously performed MLME-Request 1298 */ 1299 Mlme_t MlmeRequest; 1300 /*! 1301 * Status of the operation 1302 */ 1303 LoRaMacEventInfoStatus_t Status; 1304 /*! 1305 * The transmission time on air of the frame 1306 */ 1307 TimerTime_t TxTimeOnAir; 1308 /*! 1309 * Demodulation margin. Contains the link margin [dB] of the last 1310 * successfully received LinkCheckReq 1311 */ 1312 uint8_t DemodMargin; 1313 /*! 1314 * Number of gateways which received the last LinkCheckReq 1315 */ 1316 uint8_t NbGateways; 1317 /*! 1318 * Provides the number of retransmissions 1319 */ 1320 uint8_t NbRetries; 1321 /*! 1322 * The delay which we have received through the 1323 * BeaconTimingAns 1324 */ 1325 TimerTime_t BeaconTimingDelay; 1326 /*! 1327 * The channel of the next beacon 1328 */ 1329 uint8_t BeaconTimingChannel; 1330 }MlmeConfirm_t; 1331 1332 /*! 1333 * LoRaMAC MLME-Indication primitive 1334 */ 1335 typedef struct sMlmeIndication 1336 { 1337 /*! 1338 * MLME-Indication type 1339 */ 1340 Mlme_t MlmeIndication; 1341 /*! 1342 * Status of the operation 1343 */ 1344 LoRaMacEventInfoStatus_t Status; 1345 /*! 1346 * Beacon information. Only valid for \ref MLME_BEACON, 1347 * status \ref LORAMAC_EVENT_INFO_STATUS_BEACON_LOCKED 1348 */ 1349 BeaconInfo_t BeaconInfo; 1350 }MlmeIndication_t; 1351 1352 /*! 1353 * LoRa Mac Information Base (MIB) 1354 * 1355 * The following table lists the MIB parameters and the related attributes: 1356 * 1357 * Attribute | Get | Set 1358 * ----------------------------------------------| :-: | :-: 1359 * \ref MIB_DEVICE_CLASS | YES | YES 1360 * \ref MIB_NETWORK_ACTIVATION | YES | YES 1361 * \ref MIB_DEV_EUI | YES | YES 1362 * \ref MIB_JOIN_EUI | YES | YES 1363 * \ref MIB_SE_PIN | YES | YES 1364 * \ref MIB_ADR | YES | YES 1365 * \ref MIB_NET_ID | YES | YES 1366 * \ref MIB_DEV_ADDR | YES | YES 1367 * \ref MIB_APP_KEY | NO | YES 1368 * \ref MIB_NWK_KEY | NO | YES 1369 * \ref MIB_J_S_INT_KEY | NO | YES 1370 * \ref MIB_J_S_ENC_KEY | NO | YES 1371 * \ref MIB_F_NWK_S_INT_KEY | NO | YES 1372 * \ref MIB_S_NWK_S_INT_KEY | NO | YES 1373 * \ref MIB_NWK_S_ENC_KEY | NO | YES 1374 * \ref MIB_APP_S_KEY | NO | YES 1375 * \ref MIB_MC_KE_KEY | NO | YES 1376 * \ref MIB_MC_KEY_0 | NO | YES 1377 * \ref MIB_MC_APP_S_KEY_0 | NO | YES 1378 * \ref MIB_MC_NWK_S_KEY_0 | NO | YES 1379 * \ref MIB_MC_KEY_1 | NO | YES 1380 * \ref MIB_MC_APP_S_KEY_1 | NO | YES 1381 * \ref MIB_MC_NWK_S_KEY_1 | NO | YES 1382 * \ref MIB_MC_KEY_2 | NO | YES 1383 * \ref MIB_MC_APP_S_KEY_2 | NO | YES 1384 * \ref MIB_MC_NWK_S_KEY_2 | NO | YES 1385 * \ref MIB_MC_KEY_3 | NO | YES 1386 * \ref MIB_MC_APP_S_KEY_3 | NO | YES 1387 * \ref MIB_MC_NWK_S_KEY_3 | NO | YES 1388 * \ref MIB_PUBLIC_NETWORK | YES | YES 1389 * \ref MIB_CHANNELS | YES | NO 1390 * \ref MIB_RX2_CHANNEL | YES | YES 1391 * \ref MIB_RX2_DFAULT_CHANNEL | YES | YES 1392 * \ref MIB_RXC_CHANNEL | YES | YES 1393 * \ref MIB_RXC_DFAULT_CHANNEL | YES | YES 1394 * \ref MIB_CHANNELS_MASK | YES | YES 1395 * \ref MIB_CHANNELS_DEFAULT_MASK | YES | YES 1396 * \ref MIB_CHANNELS_NB_TRANS | YES | YES 1397 * \ref MIB_MAX_RX_WINDOW_DURATION | YES | YES 1398 * \ref MIB_RECEIVE_DELAY_1 | YES | YES 1399 * \ref MIB_RECEIVE_DELAY_2 | YES | YES 1400 * \ref MIB_JOIN_ACCEPT_DELAY_1 | YES | YES 1401 * \ref MIB_JOIN_ACCEPT_DELAY_2 | YES | YES 1402 * \ref MIB_CHANNELS_DATARATE | YES | YES 1403 * \ref MIB_CHANNELS_MIN_TX_DATARATE | YES | NO 1404 * \ref MIB_CHANNELS_DEFAULT_DATARATE | YES | YES 1405 * \ref MIB_CHANNELS_TX_POWER | YES | YES 1406 * \ref MIB_CHANNELS_DEFAULT_TX_POWER | YES | YES 1407 * \ref MIB_SYSTEM_MAX_RX_ERROR | YES | YES 1408 * \ref MIB_MIN_RX_SYMBOLS | YES | YES 1409 * \ref MIB_BEACON_INTERVAL | YES | YES 1410 * \ref MIB_BEACON_RESERVED | YES | YES 1411 * \ref MIB_BEACON_GUARD | YES | YES 1412 * \ref MIB_BEACON_WINDOW | YES | YES 1413 * \ref MIB_BEACON_WINDOW_SLOTS | YES | YES 1414 * \ref MIB_PING_SLOT_WINDOW | YES | YES 1415 * \ref MIB_BEACON_SYMBOL_TO_DEFAULT | YES | YES 1416 * \ref MIB_BEACON_SYMBOL_TO_EXPANSION_MAX | YES | YES 1417 * \ref MIB_PING_SLOT_SYMBOL_TO_EXPANSION_MAX | YES | YES 1418 * \ref MIB_BEACON_SYMBOL_TO_EXPANSION_FACTOR | YES | YES 1419 * \ref MIB_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR | YES | YES 1420 * \ref MIB_MAX_BEACON_LESS_PERIOD | YES | YES 1421 * \ref MIB_ANTENNA_GAIN | YES | YES 1422 * \ref MIB_DEFAULT_ANTENNA_GAIN | YES | YES 1423 * \ref MIB_NVM_CTXS | YES | YES 1424 * \ref MIB_ABP_LORAWAN_VERSION | NO | YES 1425 * \ref MIB_LORAWAN_VERSION | YES | NO 1426 * \ref MIB_IS_CERT_FPORT_ON | YES | YES 1427 * \ref MIB_REJOIN_0_CYCLE | YES | YES 1428 * \ref MIB_REJOIN_1_CYCLE | YES | YES 1429 * \ref MIB_REJOIN_2_CYCLE | YES | NO 1430 * 1431 * The following table provides links to the function implementations of the 1432 * related MIB primitives: 1433 * 1434 * Primitive | Function 1435 * ---------------- | :---------------------: 1436 * MIB-Set | \ref LoRaMacMibSetRequestConfirm 1437 * MIB-Get | \ref LoRaMacMibGetRequestConfirm 1438 */ 1439 typedef enum eMib 1440 { 1441 /*! 1442 * LoRaWAN device class 1443 * 1444 * LoRaWAN Specification V1.0.2 1445 */ 1446 MIB_DEVICE_CLASS, 1447 /*! 1448 * LoRaWAN Network End-Device Activation 1449 * 1450 * LoRaWAN Specification V1.0.2 1451 */ 1452 MIB_NETWORK_ACTIVATION, 1453 /*! 1454 * LoRaWAN device EUI 1455 * 1456 * LoRaWAN Specification V1.0.2 1457 */ 1458 MIB_DEV_EUI, 1459 /*! 1460 * LoRaWAN join EUI 1461 * 1462 * LoRaWAN Specification V1.0.2 1463 */ 1464 MIB_JOIN_EUI, 1465 /*! 1466 * Secure-element pin 1467 */ 1468 MIB_SE_PIN, 1469 /*! 1470 * Adaptive data rate 1471 * 1472 * LoRaWAN Specification V1.0.2, chapter 4.3.1.1 1473 * 1474 * [true: ADR enabled, false: ADR disabled] 1475 */ 1476 MIB_ADR, 1477 /*! 1478 * Network identifier 1479 * 1480 * LoRaWAN Specification V1.0.2, chapter 6.1.1 1481 */ 1482 MIB_NET_ID, 1483 /*! 1484 * End-device address 1485 * 1486 * LoRaWAN Specification V1.0.2, chapter 6.1.1 1487 */ 1488 MIB_DEV_ADDR, 1489 /*! 1490 * Application root key 1491 * 1492 * LoRaWAN Specification V1.1.0, chapter 6.1.1.3 1493 */ 1494 MIB_APP_KEY, 1495 /*! 1496 * Network root key 1497 * 1498 * LoRaWAN Specification V1.1.0, chapter 6.1.1.3 1499 */ 1500 MIB_NWK_KEY, 1501 /*! 1502 * Join session integrity key 1503 * 1504 * LoRaWAN Specification V1.1.0, chapter 6.1.1.4 1505 */ 1506 MIB_J_S_INT_KEY, 1507 /*! 1508 * Join session encryption key 1509 * 1510 * LoRaWAN Specification V1.1.0, chapter 6.1.1.4 1511 */ 1512 MIB_J_S_ENC_KEY, 1513 /*! 1514 * Forwarding Network session integrity key 1515 * 1516 * LoRaWAN Specification V1.1.0, chapter 6.1.2.2 1517 */ 1518 MIB_F_NWK_S_INT_KEY, 1519 /*! 1520 * Serving Network session integrity key 1521 * 1522 * LoRaWAN Specification V1.1.0, chapter 6.1.2.3 1523 */ 1524 MIB_S_NWK_S_INT_KEY, 1525 /*! 1526 * Network session encryption key 1527 * 1528 * LoRaWAN Specification V1.1.0, chapter 6.1.2.4 1529 */ 1530 MIB_NWK_S_ENC_KEY, 1531 /*! 1532 * Application session key 1533 * 1534 * LoRaWAN Specification V1.1.0, chapter 6.1.1.3 1535 */ 1536 MIB_APP_S_KEY, 1537 /*! 1538 * Multicast key encryption key 1539 * 1540 * LoRaWAN - Secure element specification v1 1541 */ 1542 MIB_MC_KE_KEY, 1543 /*! 1544 * Multicast root key index 0 1545 * 1546 * LoRaWAN - Secure element specification v1 1547 */ 1548 MIB_MC_KEY_0, 1549 /*! 1550 * Multicast Application session key index 0 1551 * 1552 * LoRaWAN - Secure element specification v1 1553 */ 1554 MIB_MC_APP_S_KEY_0, 1555 /*! 1556 * Multicast Network session key index 0 1557 * 1558 * LoRaWAN - Secure element specification v1 1559 */ 1560 MIB_MC_NWK_S_KEY_0, 1561 /*! 1562 * Multicast root key index 1 1563 * 1564 * LoRaWAN - Secure element specification v1 1565 */ 1566 MIB_MC_KEY_1, 1567 /*! 1568 * Multicast Application session key index 1 1569 * 1570 * LoRaWAN - Secure element specification v1 1571 */ 1572 MIB_MC_APP_S_KEY_1, 1573 /*! 1574 * Multicast Network session key index 1 1575 * 1576 * LoRaWAN - Secure element specification v1 1577 */ 1578 MIB_MC_NWK_S_KEY_1, 1579 /*! 1580 * Multicast root key index 2 1581 * 1582 * LoRaWAN - Secure element specification v1 1583 */ 1584 MIB_MC_KEY_2, 1585 /*! 1586 * Multicast Application session key index 2 1587 * 1588 * LoRaWAN - Secure element specification v1 1589 */ 1590 MIB_MC_APP_S_KEY_2, 1591 /*! 1592 * Multicast Network session key index 2 1593 * 1594 * LoRaWAN - Secure element specification v1 1595 */ 1596 MIB_MC_NWK_S_KEY_2, 1597 /*! 1598 * Multicast root key index 3 1599 * 1600 * LoRaWAN - Secure element specification v1 1601 */ 1602 MIB_MC_KEY_3, 1603 /*! 1604 * Multicast Application session key index 3 1605 * 1606 * LoRaWAN - Secure element specification v1 1607 */ 1608 MIB_MC_APP_S_KEY_3, 1609 /*! 1610 * Multicast Network session key index 3 1611 * 1612 * LoRaWAN - Secure element specification v1 1613 */ 1614 MIB_MC_NWK_S_KEY_3, 1615 /*! 1616 * Set the network type to public or private 1617 * 1618 * LoRaWAN Regional Parameters V1.0.2rB 1619 * 1620 * [true: public network, false: private network] 1621 */ 1622 MIB_PUBLIC_NETWORK, 1623 /*! 1624 * Communication channels. A get request will return a 1625 * pointer which references the first entry of the channel list. The 1626 * list is of size LORA_MAX_NB_CHANNELS 1627 * 1628 * LoRaWAN Regional Parameters V1.0.2rB 1629 */ 1630 MIB_CHANNELS, 1631 /*! 1632 * Set receive window 2 channel 1633 * 1634 * LoRaWAN Specification V1.0.2, chapter 3.3.1 1635 */ 1636 MIB_RX2_CHANNEL, 1637 /*! 1638 * Set receive window 2 channel 1639 * 1640 * LoRaWAN Specification V1.0.2, chapter 3.3.2 1641 */ 1642 MIB_RX2_DEFAULT_CHANNEL, 1643 /*! 1644 * Set receive window C channel 1645 * 1646 * LoRaWAN Specification V1.0.2, chapter 3.3.1 1647 */ 1648 MIB_RXC_CHANNEL, 1649 /*! 1650 * Set receive window C channel 1651 * 1652 * LoRaWAN Specification V1.0.2, chapter 3.3.2 1653 */ 1654 MIB_RXC_DEFAULT_CHANNEL, 1655 /*! 1656 * LoRaWAN channels mask 1657 * 1658 * LoRaWAN Regional Parameters V1.0.2rB 1659 */ 1660 MIB_CHANNELS_MASK, 1661 /*! 1662 * LoRaWAN default channels mask 1663 * 1664 * LoRaWAN Regional Parameters V1.0.2rB 1665 */ 1666 MIB_CHANNELS_DEFAULT_MASK, 1667 /*! 1668 * Set the number of repetitions on a channel 1669 * 1670 * LoRaWAN Specification V1.0.2, chapter 5.2, V1.1.0, chapter 5.3 1671 */ 1672 MIB_CHANNELS_NB_TRANS, 1673 /*! 1674 * Maximum receive window duration in [ms] 1675 * 1676 * LoRaWAN Specification V1.0.2, chapter 3.3.3 1677 */ 1678 MIB_MAX_RX_WINDOW_DURATION, 1679 /*! 1680 * Receive delay 1 in [ms] 1681 * 1682 * LoRaWAN Regional Parameters V1.0.2rB 1683 */ 1684 MIB_RECEIVE_DELAY_1, 1685 /*! 1686 * Receive delay 2 in [ms] 1687 * 1688 * LoRaWAN Regional Parameters V1.0.2rB 1689 */ 1690 MIB_RECEIVE_DELAY_2, 1691 /*! 1692 * Join accept delay 1 in [ms] 1693 * 1694 * LoRaWAN Regional Parameters V1.0.2rB 1695 */ 1696 MIB_JOIN_ACCEPT_DELAY_1, 1697 /*! 1698 * Join accept delay 2 in [ms] 1699 * 1700 * LoRaWAN Regional Parameters V1.0.2rB 1701 */ 1702 MIB_JOIN_ACCEPT_DELAY_2, 1703 /*! 1704 * Minimum Data rate of a channel 1705 * 1706 * LoRaWAN Regional Parameters V1.0.2rB 1707 * 1708 * The possible values are region specific. Please refer to \ref DR_0 to \ref DR_15 for details. 1709 */ 1710 MIB_CHANNELS_MIN_TX_DATARATE, 1711 /*! 1712 * Default Data rate of a channel 1713 * 1714 * LoRaWAN Regional Parameters V1.0.2rB 1715 * 1716 * The allowed ranges are region specific. Please refer to \ref DR_0 to \ref DR_15 for details. 1717 */ 1718 MIB_CHANNELS_DEFAULT_DATARATE, 1719 /*! 1720 * Data rate of a channel 1721 * 1722 * LoRaWAN Regional Parameters V1.0.2rB 1723 * 1724 * The allowed ranges are region specific. Please refer to \ref DR_0 to \ref DR_15 for details. 1725 */ 1726 MIB_CHANNELS_DATARATE, 1727 /*! 1728 * Transmission power of a channel 1729 * 1730 * LoRaWAN Regional Parameters V1.0.2rB 1731 * 1732 * The allowed ranges are region specific. Please refer to \ref TX_POWER_0 to \ref TX_POWER_15 for details. 1733 */ 1734 MIB_CHANNELS_TX_POWER, 1735 /*! 1736 * Transmission power of a channel 1737 * 1738 * LoRaWAN Regional Parameters V1.0.2rB 1739 * 1740 * The allowed ranges are region specific. Please refer to \ref TX_POWER_0 to \ref TX_POWER_15 for details. 1741 */ 1742 MIB_CHANNELS_DEFAULT_TX_POWER, 1743 /*! 1744 * System overall timing error in milliseconds. 1745 * [-SystemMaxRxError : +SystemMaxRxError] 1746 * Default: +/-10 ms 1747 */ 1748 MIB_SYSTEM_MAX_RX_ERROR, 1749 /*! 1750 * Minimum required number of symbols to detect an Rx frame 1751 * Default: 6 symbols 1752 */ 1753 MIB_MIN_RX_SYMBOLS, 1754 /*! 1755 * Antenna gain of the node. Default value is region specific. 1756 * The antenna gain is used to calculate the TX power of the node. 1757 * The formula is: 1758 * radioTxPower = ( int8_t )floor( maxEirp - antennaGain ) 1759 * 1760 * \remark The antenna gain value is referenced to the isotropic antenna. 1761 * The value is in dBi. 1762 * MIB_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15 1763 */ 1764 MIB_ANTENNA_GAIN, 1765 /*! 1766 * Default antenna gain of the node. Default value is region specific. 1767 * The antenna gain is used to calculate the TX power of the node. 1768 * The formula is: 1769 * radioTxPower = ( int8_t )floor( maxEirp - antennaGain ) 1770 * 1771 * \remark The antenna gain value is referenced to the isotropic antenna. 1772 * The value is in dBi. 1773 * MIB_DEFAULT_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15 1774 */ 1775 MIB_DEFAULT_ANTENNA_GAIN, 1776 /*! 1777 * Structure holding pointers to internal contexts and its size 1778 */ 1779 MIB_NVM_CTXS, 1780 /*! 1781 * LoRaWAN MAC layer operating version when activated by ABP. 1782 */ 1783 MIB_ABP_LORAWAN_VERSION, 1784 /*! 1785 * LoRaWAN MAC and regional parameter version. 1786 */ 1787 MIB_LORAWAN_VERSION, 1788 /*! 1789 * Time between periodic transmission of a Type 0 Rejoin request. 1790 */ 1791 MIB_REJOIN_0_CYCLE, 1792 /*! 1793 * Time between periodic transmission of a Type 1 Rejoin request. 1794 */ 1795 MIB_REJOIN_1_CYCLE, 1796 /*! 1797 * Time between periodic transmission of a Type 2 Rejoin request. 1798 */ 1799 MIB_REJOIN_2_CYCLE, 1800 /*! 1801 * Beacon interval in ms 1802 */ 1803 MIB_BEACON_INTERVAL, 1804 /*! 1805 * Beacon reserved time in ms 1806 */ 1807 MIB_BEACON_RESERVED, 1808 /*! 1809 * Beacon guard time in ms 1810 */ 1811 MIB_BEACON_GUARD, 1812 /*! 1813 * Beacon window time in ms 1814 */ 1815 MIB_BEACON_WINDOW, 1816 /*! 1817 * Beacon window time in number of slots 1818 */ 1819 MIB_BEACON_WINDOW_SLOTS, 1820 /*! 1821 * Ping slot length time in ms 1822 */ 1823 MIB_PING_SLOT_WINDOW, 1824 /*! 1825 * Default symbol timeout for beacons and ping slot windows 1826 */ 1827 MIB_BEACON_SYMBOL_TO_DEFAULT, 1828 /*! 1829 * Maximum symbol timeout for beacons 1830 */ 1831 MIB_BEACON_SYMBOL_TO_EXPANSION_MAX, 1832 /*! 1833 * Maximum symbol timeout for ping slots 1834 */ 1835 MIB_PING_SLOT_SYMBOL_TO_EXPANSION_MAX, 1836 /*! 1837 * Symbol expansion value for beacon windows in case of beacon 1838 * loss in symbols 1839 */ 1840 MIB_BEACON_SYMBOL_TO_EXPANSION_FACTOR, 1841 /*! 1842 * Symbol expansion value for ping slot windows in case of beacon 1843 * loss in symbols 1844 */ 1845 MIB_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR, 1846 /*! 1847 * Maximum allowed beacon less time in ms 1848 */ 1849 MIB_MAX_BEACON_LESS_PERIOD, 1850 /*! 1851 * Ping slot data rate 1852 * 1853 * LoRaWAN Regional Parameters V1.0.2rB 1854 * 1855 * The allowed ranges are region specific. Please refer to \ref DR_0 to \ref DR_15 for details. 1856 */ 1857 MIB_PING_SLOT_DATARATE, 1858 /*! 1859 * LoRaWAN certification FPort handling state (ON/OFF) 1860 */ 1861 MIB_IS_CERT_FPORT_ON, 1862 }Mib_t; 1863 1864 /*! 1865 * LoRaMAC MIB parameters 1866 */ 1867 typedef union uMibParam 1868 { 1869 /*! 1870 * LoRaWAN device class 1871 * 1872 * Related MIB type: \ref MIB_DEVICE_CLASS 1873 */ 1874 DeviceClass_t Class; 1875 /*! 1876 * LoRaWAN Network End-Device Activation ( ACTIVATION_TYPE_NONE, ACTIVATION_TYPE_ABP or OTTA ) 1877 * 1878 * Related MIB type: \ref MIB_NETWORK_ACTIVATION 1879 */ 1880 ActivationType_t NetworkActivation; 1881 /*! 1882 * LoRaWAN device EUI 1883 * 1884 * Related MIB type: \ref MIB_DEV_EUI 1885 */ 1886 uint8_t* DevEui; 1887 /*! 1888 * LoRaWAN Join server EUI 1889 * 1890 * Related MIB type: \ref MIB_JOIN_EUI 1891 */ 1892 uint8_t* JoinEui; 1893 /*! 1894 * Secure-element pin 1895 * 1896 * Related MIB type: \ref MIB_SE_PIN 1897 */ 1898 uint8_t* SePin; 1899 /*! 1900 * Activation state of ADR 1901 * 1902 * Related MIB type: \ref MIB_ADR 1903 */ 1904 bool AdrEnable; 1905 /*! 1906 * Network identifier 1907 * 1908 * Related MIB type: \ref MIB_NET_ID 1909 */ 1910 uint32_t NetID; 1911 /*! 1912 * End-device address 1913 * 1914 * Related MIB type: \ref MIB_DEV_ADDR 1915 */ 1916 uint32_t DevAddr; 1917 /*! 1918 * Application root key 1919 * 1920 * Related MIB type: \ref MIB_APP_KEY 1921 */ 1922 uint8_t* AppKey; 1923 /*! 1924 * Network root key 1925 * 1926 * Related MIB type: \ref MIB_NWK_KEY 1927 */ 1928 uint8_t* NwkKey; 1929 /*! 1930 * Join session integrity key 1931 * 1932 * Related MIB type: \ref MIB_J_S_INT_KEY 1933 */ 1934 uint8_t* JSIntKey; 1935 /*! 1936 * Join session encryption key 1937 * 1938 * Related MIB type: \ref MIB_J_S_ENC_KEY 1939 */ 1940 uint8_t* JSEncKey; 1941 /*! 1942 * Forwarding Network session integrity key 1943 * 1944 * Related MIB type: \ref MIB_F_NWK_S_INT_KEY 1945 */ 1946 uint8_t* FNwkSIntKey; 1947 /*! 1948 * Serving Network session integrity key 1949 * 1950 * Related MIB type: \ref MIB_S_NWK_S_INT_KEY 1951 */ 1952 uint8_t* SNwkSIntKey; 1953 /*! 1954 * Network session encryption key 1955 * 1956 * Related MIB type: \ref MIB_NWK_S_ENC_KEY 1957 */ 1958 uint8_t* NwkSEncKey; 1959 /*! 1960 * Application session key 1961 * 1962 * Related MIB type: \ref MIB_APP_S_KEY 1963 */ 1964 uint8_t* AppSKey; 1965 /*! 1966 * Multicast key encryption key 1967 * 1968 * Related MIB type: \ref MIB_MC_KE_KEY 1969 */ 1970 uint8_t* McKEKey; 1971 /*! 1972 * Multicast root key index 0 1973 * 1974 * Related MIB type: \ref MIB_MC_KEY_0 1975 */ 1976 uint8_t* McKey0; 1977 /*! 1978 * Multicast Application session key index 0 1979 * 1980 * Related MIB type: \ref MIB_MC_APP_S_KEY_0 1981 */ 1982 uint8_t* McAppSKey0; 1983 /*! 1984 * Multicast Network session key index 0 1985 * 1986 * Related MIB type: \ref MIB_MC_NWK_S_KEY_0 1987 */ 1988 uint8_t* McNwkSKey0; 1989 /*! 1990 * Multicast root key index 0 1991 * 1992 * Related MIB type: \ref MIB_MC_KEY_0 1993 */ 1994 uint8_t* McKey1; 1995 /*! 1996 * Multicast Application session key index 1 1997 * 1998 * Related MIB type: \ref MIB_MC_APP_S_KEY_1 1999 */ 2000 uint8_t* McAppSKey1; 2001 /*! 2002 * Multicast Network session key index 1 2003 * 2004 * Related MIB type: \ref MIB_MC_NWK_S_KEY_1 2005 */ 2006 uint8_t* McNwkSKey1; 2007 /*! 2008 * Multicast root key index 2 2009 * 2010 * Related MIB type: \ref MIB_MC_KEY_2 2011 */ 2012 uint8_t* McKey2; 2013 /*! 2014 * Multicast Application session key index 2 2015 * 2016 * Related MIB type: \ref MIB_MC_APP_S_KEY_2 2017 */ 2018 uint8_t* McAppSKey2; 2019 /*! 2020 * Multicast Network session key index 2 2021 * 2022 * Related MIB type: \ref MIB_MC_NWK_S_KEY_2 2023 */ 2024 uint8_t* McNwkSKey2; 2025 /*! 2026 * Multicast root key index 2 2027 * 2028 * Related MIB type: \ref MIB_MC_KEY_2 2029 */ 2030 uint8_t* McKey3; 2031 /*! 2032 * Multicast Application session key index 2 2033 * 2034 * Related MIB type: \ref MIB_MC_APP_S_KEY_2 2035 */ 2036 uint8_t* McAppSKey3; 2037 /*! 2038 * Multicast Network session key index 2 2039 * 2040 * Related MIB type: \ref MIB_MC_NWK_S_KEY_2 2041 */ 2042 uint8_t* McNwkSKey3; 2043 /*! 2044 * Enable or disable a public network 2045 * 2046 * Related MIB type: \ref MIB_PUBLIC_NETWORK 2047 */ 2048 bool EnablePublicNetwork; 2049 /*! 2050 * LoRaWAN Channel 2051 * 2052 * Related MIB type: \ref MIB_CHANNELS 2053 */ 2054 ChannelParams_t* ChannelList; 2055 /*! 2056 * Channel for the receive window 2 2057 * 2058 * Related MIB type: \ref MIB_RX2_CHANNEL 2059 */ 2060 RxChannelParams_t Rx2Channel; 2061 /*! 2062 * Channel for the receive window 2 2063 * 2064 * Related MIB type: \ref MIB_RX2_DEFAULT_CHANNEL 2065 */ 2066 RxChannelParams_t Rx2DefaultChannel; 2067 /*! 2068 * Channel for the receive window C 2069 * 2070 * Related MIB type: \ref MIB_RXC_CHANNEL 2071 */ 2072 RxChannelParams_t RxCChannel; 2073 /*! 2074 * Channel for the receive window C 2075 * 2076 * Related MIB type: \ref MIB_RXC_DEFAULT_CHANNEL 2077 */ 2078 RxChannelParams_t RxCDefaultChannel; 2079 /*! 2080 * Channel mask 2081 * 2082 * Related MIB type: \ref MIB_CHANNELS_MASK 2083 */ 2084 uint16_t* ChannelsMask; 2085 /*! 2086 * Default channel mask 2087 * 2088 * Related MIB type: \ref MIB_CHANNELS_DEFAULT_MASK 2089 */ 2090 uint16_t* ChannelsDefaultMask; 2091 /*! 2092 * Number of frame repetitions 2093 * 2094 * Related MIB type: \ref MIB_CHANNELS_NB_TRANS 2095 */ 2096 uint8_t ChannelsNbTrans; 2097 /*! 2098 * Maximum receive window duration 2099 * 2100 * Related MIB type: \ref MIB_MAX_RX_WINDOW_DURATION 2101 */ 2102 uint32_t MaxRxWindow; 2103 /*! 2104 * Receive delay 1 2105 * 2106 * Related MIB type: \ref MIB_RECEIVE_DELAY_1 2107 */ 2108 uint32_t ReceiveDelay1; 2109 /*! 2110 * Receive delay 2 2111 * 2112 * Related MIB type: \ref MIB_RECEIVE_DELAY_2 2113 */ 2114 uint32_t ReceiveDelay2; 2115 /*! 2116 * Join accept delay 1 2117 * 2118 * Related MIB type: \ref MIB_JOIN_ACCEPT_DELAY_1 2119 */ 2120 uint32_t JoinAcceptDelay1; 2121 /*! 2122 * Join accept delay 2 2123 * 2124 * Related MIB type: \ref MIB_JOIN_ACCEPT_DELAY_2 2125 */ 2126 uint32_t JoinAcceptDelay2; 2127 /*! 2128 * Channels minimum tx data rate 2129 * 2130 * Related MIB type: \ref MIB_CHANNELS_MIN_TX_DATARATE 2131 */ 2132 int8_t ChannelsMinTxDatarate; 2133 /*! 2134 * Channels data rate 2135 * 2136 * Related MIB type: \ref MIB_CHANNELS_DEFAULT_DATARATE 2137 */ 2138 int8_t ChannelsDefaultDatarate; 2139 /*! 2140 * Channels data rate 2141 * 2142 * Related MIB type: \ref MIB_CHANNELS_DATARATE 2143 */ 2144 int8_t ChannelsDatarate; 2145 /*! 2146 * Channels TX power 2147 * 2148 * Related MIB type: \ref MIB_CHANNELS_DEFAULT_TX_POWER 2149 */ 2150 int8_t ChannelsDefaultTxPower; 2151 /*! 2152 * Channels TX power 2153 * 2154 * Related MIB type: \ref MIB_CHANNELS_TX_POWER 2155 */ 2156 int8_t ChannelsTxPower; 2157 /*! 2158 * Multicast channels 2159 * 2160 * Related MIB type: \ref MIB_MULTICAST_CHANNEL 2161 */ 2162 McChannelParams_t MulticastChannel; 2163 /*! 2164 * System overall timing error in milliseconds. 2165 * 2166 * Related MIB type: \ref MIB_SYSTEM_MAX_RX_ERROR 2167 */ 2168 uint32_t SystemMaxRxError; 2169 /*! 2170 * Minimum required number of symbols to detect an Rx frame 2171 * 2172 * Related MIB type: \ref MIB_MIN_RX_SYMBOLS 2173 */ 2174 uint8_t MinRxSymbols; 2175 /*! 2176 * Antenna gain 2177 * 2178 * Related MIB type: \ref MIB_ANTENNA_GAIN 2179 */ 2180 float AntennaGain; 2181 /*! 2182 * Default antenna gain 2183 * 2184 * Related MIB type: \ref MIB_DEFAULT_ANTENNA_GAIN 2185 */ 2186 float DefaultAntennaGain; 2187 /*! 2188 * Returns a pointer to the structure holding all data which shall be stored 2189 * in the NVM. 2190 * 2191 * Related MIB type: \ref MIB_NVM_CTXS 2192 */ 2193 LoRaMacNvmData_t* Contexts; 2194 /* 2195 * LoRaWAN MAC layer operating version when activated by ABP. 2196 * 2197 * Related MIB type: \ref MIB_ABP_LORAWAN_VERSION 2198 */ 2199 Version_t AbpLrWanVersion; 2200 /* 2201 * LoRaWAN MAC regional parameter version. 2202 * 2203 * Related MIB type: \ref MIB_LORAWAN_VERSION 2204 */ 2205 struct sLrWanVersion 2206 { 2207 Version_t LoRaWan; 2208 Version_t LoRaWanRegion; 2209 }LrWanVersion; 2210 /*! 2211 * Time in seconds between cyclic transmission of Type 0 Rejoin requests. 2212 */ 2213 uint32_t Rejoin0CycleInSec; 2214 /*! 2215 * Time in seconds between cyclic transmission of Type 1 Rejoin requests. 2216 */ 2217 uint32_t Rejoin1CycleInSec; 2218 /*! 2219 * Time in seconds between cyclic transmission of Type 2 Rejoin requests. 2220 */ 2221 uint32_t Rejoin2CycleInSec; 2222 /*! 2223 * Beacon interval in ms 2224 * 2225 * Related MIB type: \ref MIB_BEACON_INTERVAL 2226 */ 2227 uint32_t BeaconInterval; 2228 /*! 2229 * Beacon reserved time in ms 2230 * 2231 * Related MIB type: \ref MIB_BEACON_RESERVED 2232 */ 2233 uint32_t BeaconReserved; 2234 /*! 2235 * Beacon guard time in ms 2236 * 2237 * Related MIB type: \ref MIB_BEACON_GUARD 2238 */ 2239 uint32_t BeaconGuard; 2240 /*! 2241 * Beacon window time in ms 2242 * 2243 * Related MIB type: \ref MIB_BEACON_WINDOW 2244 */ 2245 uint32_t BeaconWindow; 2246 /*! 2247 * Beacon window time in number of slots 2248 * 2249 * Related MIB type: \ref MIB_BEACON_WINDOW_SLOTS 2250 */ 2251 uint32_t BeaconWindowSlots; 2252 /*! 2253 * Ping slot length time in ms 2254 * 2255 * Related MIB type: \ref MIB_PING_SLOT_WINDOW 2256 */ 2257 uint32_t PingSlotWindow; 2258 /*! 2259 * Default symbol timeout for beacons and ping slot windows 2260 * 2261 * Related MIB type: \ref MIB_BEACON_SYMBOL_TO_DEFAULT 2262 */ 2263 uint32_t BeaconSymbolToDefault; 2264 /*! 2265 * Maximum symbol timeout for beacons 2266 * 2267 * Related MIB type: \ref MIB_BEACON_SYMBOL_TO_EXPANSION_MAX 2268 */ 2269 uint32_t BeaconSymbolToExpansionMax; 2270 /*! 2271 * Maximum symbol timeout for ping slots 2272 * 2273 * Related MIB type: \ref MIB_PING_SLOT_SYMBOL_TO_EXPANSION_MAX 2274 */ 2275 uint32_t PingSlotSymbolToExpansionMax; 2276 /*! 2277 * Symbol expansion value for beacon windows in case of beacon 2278 * loss in symbols 2279 * 2280 * Related MIB type: \ref MIB_BEACON_SYMBOL_TO_EXPANSION_FACTOR 2281 */ 2282 uint32_t BeaconSymbolToExpansionFactor; 2283 /*! 2284 * Symbol expansion value for ping slot windows in case of beacon 2285 * loss in symbols 2286 * 2287 * Related MIB type: \ref MIB_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR 2288 */ 2289 uint32_t PingSlotSymbolToExpansionFactor; 2290 /*! 2291 * Maximum allowed beacon less time in ms 2292 * 2293 * Related MIB type: \ref MIB_MAX_BEACON_LESS_PERIOD 2294 */ 2295 uint32_t MaxBeaconLessPeriod; 2296 /*! 2297 * Ping slots data rate 2298 * 2299 * Related MIB type: \ref MIB_PING_SLOT_DATARATE 2300 */ 2301 int8_t PingSlotDatarate; 2302 /*! 2303 * LoRaWAN certification FPort handling state (ON/OFF) 2304 * 2305 * Related MIB type: \ref MIB_IS_CERT_FPORT_ON 2306 */ 2307 bool IsCertPortOn; 2308 }MibParam_t; 2309 2310 /*! 2311 * LoRaMAC MIB-RequestConfirm structure 2312 */ 2313 typedef struct eMibRequestConfirm 2314 { 2315 /*! 2316 * MIB-Request type 2317 */ 2318 Mib_t Type; 2319 2320 /*! 2321 * MLME-RequestConfirm parameters 2322 */ 2323 MibParam_t Param; 2324 }MibRequestConfirm_t; 2325 2326 /*! 2327 * LoRaMAC tx information 2328 */ 2329 typedef struct sLoRaMacTxInfo 2330 { 2331 /*! 2332 * Size of the application data payload which can be transmitted. 2333 */ 2334 uint8_t MaxPossibleApplicationDataSize; 2335 /*! 2336 * The current maximum possible payload size without MAC commands 2337 * which is dependent on the current datarate. 2338 */ 2339 uint8_t CurrentPossiblePayloadSize; 2340 }LoRaMacTxInfo_t; 2341 2342 /*! 2343 * LoRaMAC Status 2344 */ 2345 typedef enum eLoRaMacStatus 2346 { 2347 /*! 2348 * Service started successfully 2349 */ 2350 LORAMAC_STATUS_OK, 2351 /*! 2352 * Service not started - LoRaMAC is busy 2353 */ 2354 LORAMAC_STATUS_BUSY, 2355 /*! 2356 * Service unknown 2357 */ 2358 LORAMAC_STATUS_SERVICE_UNKNOWN, 2359 /*! 2360 * Service not started - invalid parameter 2361 */ 2362 LORAMAC_STATUS_PARAMETER_INVALID, 2363 /*! 2364 * Service not started - invalid frequency 2365 */ 2366 LORAMAC_STATUS_FREQUENCY_INVALID, 2367 /*! 2368 * Service not started - invalid datarate 2369 */ 2370 LORAMAC_STATUS_DATARATE_INVALID, 2371 /*! 2372 * Service not started - invalid frequency and datarate 2373 */ 2374 LORAMAC_STATUS_FREQ_AND_DR_INVALID, 2375 /*! 2376 * Service not started - the device is not in a LoRaWAN 2377 */ 2378 LORAMAC_STATUS_NO_NETWORK_JOINED, 2379 /*! 2380 * Service not started - payload length error 2381 */ 2382 LORAMAC_STATUS_LENGTH_ERROR, 2383 /*! 2384 * Service not started - the specified region is not supported 2385 * or not activated with preprocessor definitions. 2386 */ 2387 LORAMAC_STATUS_REGION_NOT_SUPPORTED, 2388 /*! 2389 * The application data was not transmitted 2390 * because prioritized pending MAC commands had to be sent. 2391 */ 2392 LORAMAC_STATUS_SKIPPED_APP_DATA, 2393 /*! 2394 * An MCPS or MLME request can return this status. In this case, 2395 * the MAC cannot send the frame, as the duty cycle limits all 2396 * available bands. When a request returns this value, the 2397 * variable "DutyCycleWaitTime" in "ReqReturn" of the input 2398 * parameters contains the remaining time to wait. If the 2399 * value is constant and does not change, the expected time 2400 * on air for this frame is exceeding the maximum permitted 2401 * time according to the duty cycle time period, defined 2402 * in Region.h, DUTY_CYCLE_TIME_PERIOD. By default this time 2403 * is 1 hour, and a band with 1% duty cycle is then allowed 2404 * to use an air time of 36 seconds. 2405 */ 2406 LORAMAC_STATUS_DUTYCYCLE_RESTRICTED, 2407 /*! 2408 * 2409 */ 2410 LORAMAC_STATUS_NO_CHANNEL_FOUND, 2411 /*! 2412 * 2413 */ 2414 LORAMAC_STATUS_NO_FREE_CHANNEL_FOUND, 2415 /*! 2416 * ToDo 2417 */ 2418 LORAMAC_STATUS_BUSY_BEACON_RESERVED_TIME, 2419 /*! 2420 * ToDo 2421 */ 2422 LORAMAC_STATUS_BUSY_PING_SLOT_WINDOW_TIME, 2423 /*! 2424 * ToDo 2425 */ 2426 LORAMAC_STATUS_BUSY_UPLINK_COLLISION, 2427 /*! 2428 * An error in the cryptographic module is occurred 2429 */ 2430 LORAMAC_STATUS_CRYPTO_ERROR, 2431 /*! 2432 * An error in the frame counter handler module is occurred 2433 */ 2434 LORAMAC_STATUS_FCNT_HANDLER_ERROR, 2435 /*! 2436 * An error in the MAC command module is occurred 2437 */ 2438 LORAMAC_STATUS_MAC_COMMAD_ERROR, 2439 /*! 2440 * An error in the Class B module is occurred 2441 */ 2442 LORAMAC_STATUS_CLASS_B_ERROR, 2443 /*! 2444 * An error in the Confirm Queue module is occurred 2445 */ 2446 LORAMAC_STATUS_CONFIRM_QUEUE_ERROR, 2447 /*! 2448 * The multicast group doesn't exist 2449 */ 2450 LORAMAC_STATUS_MC_GROUP_UNDEFINED, 2451 /*! 2452 * Undefined error occurred 2453 */ 2454 LORAMAC_STATUS_ERROR 2455 }LoRaMacStatus_t; 2456 2457 /*! 2458 * LoRaMAC events structure 2459 * Used to notify upper layers of MAC events 2460 */ 2461 typedef struct sLoRaMacPrimitives 2462 { 2463 /*! 2464 * \brief MCPS-Confirm primitive 2465 * 2466 * \param [OUT] MCPS-Confirm parameters 2467 */ 2468 void ( *MacMcpsConfirm )( McpsConfirm_t* McpsConfirm ); 2469 /*! 2470 * \brief MCPS-Indication primitive 2471 * 2472 * \param [OUT] MCPS-Indication parameters 2473 */ 2474 void ( *MacMcpsIndication )( McpsIndication_t* McpsIndication ); 2475 /*! 2476 * \brief MLME-Confirm primitive 2477 * 2478 * \param [OUT] MLME-Confirm parameters 2479 */ 2480 void ( *MacMlmeConfirm )( MlmeConfirm_t* MlmeConfirm ); 2481 /*! 2482 * \brief MLME-Indication primitive 2483 * 2484 * \param [OUT] MLME-Indication parameters 2485 */ 2486 void ( *MacMlmeIndication )( MlmeIndication_t* MlmeIndication ); 2487 }LoRaMacPrimitives_t; 2488 2489 /*! 2490 * LoRaMAC callback structure 2491 */ 2492 typedef struct sLoRaMacCallback 2493 { 2494 /*! 2495 * \brief Measures the battery level 2496 * 2497 * \retval Battery level [0: node is connected to an external 2498 * power source, 1..254: battery level, where 1 is the minimum 2499 * and 254 is the maximum value, 255: the node was not able 2500 * to measure the battery level] 2501 */ 2502 uint8_t ( *GetBatteryLevel )( void ); 2503 /*! 2504 * \brief Measures the temperature level 2505 * 2506 * \retval Temperature level 2507 */ 2508 float ( *GetTemperatureLevel )( void ); 2509 /*! 2510 * \brief Will be called when an attribute has changed in one of the context. 2511 * 2512 * \param notifyFlags Bitmap that contains the modules which changed. 2513 * Refer to \ref LoRaMacNvmData_t. 2514 */ 2515 void ( *NvmDataChange )( uint16_t notifyFlags ); 2516 /*! 2517 *\brief Will be called each time a Radio IRQ is handled by the MAC 2518 * layer. 2519 * 2520 *\warning Runs in a IRQ context. Should only change variables state. 2521 */ 2522 void ( *MacProcessNotify )( void ); 2523 }LoRaMacCallback_t; 2524 2525 2526 /*! 2527 * LoRaMAC Max EIRP (dBm) table 2528 */ 2529 static const uint8_t LoRaMacMaxEirpTable[] = { 8, 10, 12, 13, 14, 16, 18, 20, 21, 24, 26, 27, 29, 30, 33, 36 }; 2530 2531 /*! 2532 * \brief LoRaMAC layer initialization 2533 * 2534 * \details In addition to the initialization of the LoRaMAC layer, this 2535 * function initializes the callback primitives of the MCPS and 2536 * MLME services. Every data field of \ref LoRaMacPrimitives_t must be 2537 * set to a valid callback function. 2538 * 2539 * \param [IN] primitives - Pointer to a structure defining the LoRaMAC 2540 * event functions. Refer to \ref LoRaMacPrimitives_t. 2541 * 2542 * \param [IN] callbacks - Pointer to a structure defining the LoRaMAC 2543 * callback functions. Refer to \ref LoRaMacCallback_t. 2544 * 2545 * \param [IN] region - The region to start. 2546 * 2547 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2548 * returns are: 2549 * \ref LORAMAC_STATUS_OK, 2550 * \ref LORAMAC_STATUS_PARAMETER_INVALID, 2551 * \ref LORAMAC_STATUS_REGION_NOT_SUPPORTED. 2552 */ 2553 LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t* primitives, LoRaMacCallback_t* callbacks, LoRaMacRegion_t region ); 2554 2555 /*! 2556 * \brief Starts LoRaMAC layer 2557 * 2558 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2559 * returns are: 2560 * \ref LORAMAC_STATUS_OK, 2561 */ 2562 LoRaMacStatus_t LoRaMacStart( void ); 2563 2564 /*! 2565 * \brief Stops LoRaMAC layer 2566 * 2567 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2568 * returns are: 2569 * \ref LORAMAC_STATUS_OK, 2570 */ 2571 LoRaMacStatus_t LoRaMacStop( void ); 2572 2573 /*! 2574 * \brief Returns a value indicating if the MAC layer is busy or not. 2575 * 2576 * \retval isBusy Mac layer is busy. 2577 */ 2578 bool LoRaMacIsBusy( void ); 2579 2580 /*! 2581 * Processes the LoRaMac events. 2582 * 2583 * \remark This function must be called in the main loop. 2584 */ 2585 void LoRaMacProcess( void ); 2586 2587 /*! 2588 * \brief Queries the LoRaMAC if it is possible to send the next frame with 2589 * a given application data payload size. The LoRaMAC takes scheduled 2590 * MAC commands into account and reports, when the frame can be send or not. 2591 * 2592 * \param [IN] size - Size of application data payload to be send next 2593 * 2594 * \param [OUT] txInfo - The structure \ref LoRaMacTxInfo_t contains 2595 * information about the actual maximum payload possible 2596 * ( according to the configured datarate or the next 2597 * datarate according to ADR ), and the maximum frame 2598 * size, taking the scheduled MAC commands into account. 2599 * 2600 * \retval LoRaMacStatus_t Status of the operation. When the parameters are 2601 * not valid, the function returns \ref LORAMAC_STATUS_PARAMETER_INVALID. 2602 * In case of a length error caused by the application data payload in combination 2603 * with the MAC commands, the function returns \ref LORAMAC_STATUS_LENGTH_ERROR. 2604 * In this case its recommended to send a frame without application data to flush 2605 * the MAC commands. Otherwise the LoRaMAC will prioritize the MAC commands and 2606 * if needed it will skip the application data. Please note that if MAC commands do 2607 * not fit at all into the payload size on the related datarate, the LoRaMAC will 2608 * automatically clip the MAC commands. 2609 * In case the query is valid, and the LoRaMAC is able to send the frame, 2610 * the function returns \ref LORAMAC_STATUS_OK. 2611 */ 2612 LoRaMacStatus_t LoRaMacQueryTxPossible( uint8_t size, LoRaMacTxInfo_t* txInfo ); 2613 2614 /*! 2615 * \brief LoRaMAC channel add service 2616 * 2617 * \details Adds a new channel to the channel list and activates the id in 2618 * the channel mask. Please note that this functionality is not available 2619 * on all regions. Information about allowed ranges are available at the LoRaWAN Regional Parameters V1.0.2rB 2620 * 2621 * \param [IN] id - Id of the channel. 2622 * 2623 * \param [IN] params - Channel parameters to set. 2624 * 2625 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2626 * \ref LORAMAC_STATUS_OK, 2627 * \ref LORAMAC_STATUS_BUSY, 2628 * \ref LORAMAC_STATUS_PARAMETER_INVALID. 2629 */ 2630 LoRaMacStatus_t LoRaMacChannelAdd( uint8_t id, ChannelParams_t params ); 2631 2632 /*! 2633 * \brief LoRaMAC channel remove service 2634 * 2635 * \details Deactivates the id in the channel mask. 2636 * 2637 * \param [IN] id - Id of the channel. 2638 * 2639 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2640 * \ref LORAMAC_STATUS_OK, 2641 * \ref LORAMAC_STATUS_BUSY, 2642 * \ref LORAMAC_STATUS_PARAMETER_INVALID. 2643 */ 2644 LoRaMacStatus_t LoRaMacChannelRemove( uint8_t id ); 2645 2646 /*! 2647 * \brief LoRaMAC multicast channel setup service 2648 * 2649 * \details Sets up a multicast channel. 2650 * 2651 * \param [IN] channel - Multicast channel to set. 2652 * 2653 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2654 * \ref LORAMAC_STATUS_OK, 2655 * \ref LORAMAC_STATUS_BUSY, 2656 * \ref LORAMAC_STATUS_PARAMETER_INVALID, 2657 * \ref LORAMAC_STATUS_MC_GROUP_UNDEFINED. 2658 */ 2659 LoRaMacStatus_t LoRaMacMcChannelSetup( McChannelParams_t *channel ); 2660 2661 /*! 2662 * \brief LoRaMAC multicast channel removal service 2663 * 2664 * \details Removes/Disables a multicast channel. 2665 * 2666 * \param [IN] groupID - Multicast channel ID to be removed/disabled 2667 * 2668 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2669 * \ref LORAMAC_STATUS_OK, 2670 * \ref LORAMAC_STATUS_BUSY, 2671 * \ref LORAMAC_STATUS_MC_GROUP_UNDEFINED. 2672 */ 2673 LoRaMacStatus_t LoRaMacMcChannelDelete( AddressIdentifier_t groupID ); 2674 2675 /*! 2676 * \brief LoRaMAC multicast channel get groupId from MC address. 2677 * 2678 * \param [IN] mcAddress - Multicast address to be checked 2679 * 2680 * \retval groupID Multicast channel ID associated to the address. 2681 * Returns 0xFF if the address isn't found. 2682 */ 2683 uint8_t LoRaMacMcChannelGetGroupId( uint32_t mcAddress ); 2684 2685 /*! 2686 * \brief LoRaMAC multicast channel Rx parameters setup service 2687 * 2688 * \details Sets up a multicast channel reception parameters. 2689 * 2690 * \param [IN] groupID - Multicast channel ID 2691 * \param [IN] rxParams - Reception parameters 2692 * \param [OUT] status - Status mask [UNDEF_ID | FREQ_ERR | DR_ERR | GROUP_ID] 2693 * 2694 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2695 * \ref LORAMAC_STATUS_OK, 2696 * \ref LORAMAC_STATUS_BUSY, 2697 * \ref LORAMAC_STATUS_PARAMETER_INVALID, 2698 * \ref LORAMAC_STATUS_MC_GROUP_UNDEFINED. 2699 */ 2700 LoRaMacStatus_t LoRaMacMcChannelSetupRxParams( AddressIdentifier_t groupID, McRxParams_t *rxParams, uint8_t *status ); 2701 2702 /*! 2703 * \brief LoRaMAC MIB-Get 2704 * 2705 * \details The mac information base service to get attributes of the LoRaMac 2706 * layer. 2707 * 2708 * The following code-snippet shows how to use the API to get the 2709 * parameter AdrEnable, defined by the enumeration type 2710 * \ref MIB_ADR. 2711 * \code 2712 * MibRequestConfirm_t mibReq; 2713 * mibReq.Type = MIB_ADR; 2714 * 2715 * if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK ) 2716 * { 2717 * // LoRaMAC updated the parameter mibParam.AdrEnable 2718 * } 2719 * \endcode 2720 * 2721 * \param [IN] mibRequest - MIB-GET-Request to perform. Refer to \ref MibRequestConfirm_t. 2722 * 2723 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2724 * \ref LORAMAC_STATUS_OK, 2725 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN, 2726 * \ref LORAMAC_STATUS_PARAMETER_INVALID. 2727 */ 2728 LoRaMacStatus_t LoRaMacMibGetRequestConfirm( MibRequestConfirm_t* mibGet ); 2729 2730 /*! 2731 * \brief LoRaMAC MIB-Set 2732 * 2733 * \details The mac information base service to set attributes of the LoRaMac 2734 * layer. 2735 * 2736 * The following code-snippet shows how to use the API to set the 2737 * parameter AdrEnable, defined by the enumeration type 2738 * \ref MIB_ADR. 2739 * 2740 * \code 2741 * MibRequestConfirm_t mibReq; 2742 * mibReq.Type = MIB_ADR; 2743 * mibReq.Param.AdrEnable = true; 2744 * 2745 * if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK ) 2746 * { 2747 * // LoRaMAC updated the parameter 2748 * } 2749 * \endcode 2750 * 2751 * \param [IN] mibRequest - MIB-SET-Request to perform. Refer to \ref MibRequestConfirm_t. 2752 * 2753 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2754 * \ref LORAMAC_STATUS_OK, 2755 * \ref LORAMAC_STATUS_BUSY, 2756 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN, 2757 * \ref LORAMAC_STATUS_PARAMETER_INVALID. 2758 */ 2759 LoRaMacStatus_t LoRaMacMibSetRequestConfirm( MibRequestConfirm_t* mibSet ); 2760 2761 /*! 2762 * \brief LoRaMAC MLME-Request 2763 * 2764 * \details The Mac layer management entity handles management services. The 2765 * following code-snippet shows how to use the API to perform a 2766 * network join request. Please note that for a join request, the 2767 * DevEUI and the JoinEUI must be set previously via the MIB. Please 2768 * also refer to the sample implementations. 2769 * 2770 * \code 2771 * 2772 * MlmeReq_t mlmeReq; 2773 * mlmeReq.Type = MLME_JOIN; 2774 * mlmeReq.Req.Join.Datarate = LORAWAN_DEFAULT_DATARATE; 2775 * 2776 * if( LoRaMacMlmeRequest( &mlmeReq ) == LORAMAC_STATUS_OK ) 2777 * { 2778 * // Service started successfully. Waiting for the Mlme-Confirm event 2779 * } 2780 * \endcode 2781 * 2782 * \param [IN] mlmeRequest - MLME-Request to perform. Refer to \ref MlmeReq_t. 2783 * 2784 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2785 * \ref LORAMAC_STATUS_OK, 2786 * \ref LORAMAC_STATUS_BUSY, 2787 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN, 2788 * \ref LORAMAC_STATUS_PARAMETER_INVALID, 2789 * \ref LORAMAC_STATUS_NO_NETWORK_JOINED, 2790 * \ref LORAMAC_STATUS_LENGTH_ERROR, 2791 */ 2792 LoRaMacStatus_t LoRaMacMlmeRequest( MlmeReq_t* mlmeRequest ); 2793 2794 /*! 2795 * \brief LoRaMAC MCPS-Request 2796 * 2797 * \details The Mac Common Part Sublayer handles data services. The following 2798 * code-snippet shows how to use the API to send an unconfirmed 2799 * LoRaMAC frame. 2800 * 2801 * \code 2802 * uint8_t myBuffer[] = { 1, 2, 3 }; 2803 * 2804 * McpsReq_t mcpsReq; 2805 * mcpsReq.Type = MCPS_UNCONFIRMED; 2806 * mcpsReq.Req.Unconfirmed.fPort = 1; 2807 * mcpsReq.Req.Unconfirmed.fBuffer = myBuffer; 2808 * mcpsReq.Req.Unconfirmed.fBufferSize = sizeof( myBuffer ); 2809 * 2810 * if( LoRaMacMcpsRequest( &mcpsReq ) == LORAMAC_STATUS_OK ) 2811 * { 2812 * // Service started successfully. Waiting for the MCPS-Confirm event 2813 * } 2814 * \endcode 2815 * 2816 * \param [IN] mcpsRequest - MCPS-Request to perform. Refer to \ref McpsReq_t. 2817 * 2818 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2819 * \ref LORAMAC_STATUS_OK, 2820 * \ref LORAMAC_STATUS_BUSY, 2821 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN, 2822 * \ref LORAMAC_STATUS_PARAMETER_INVALID, 2823 * \ref LORAMAC_STATUS_NO_NETWORK_JOINED, 2824 * \ref LORAMAC_STATUS_LENGTH_ERROR, 2825 */ 2826 LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t* mcpsRequest ); 2827 2828 /*! 2829 * \brief LoRaMAC deinitialization 2830 * 2831 * \details This function stops the timers, re-initializes MAC & regional parameters to default 2832 * and sets radio into sleep state. 2833 * 2834 * \retval LoRaMacStatus_t Status of the operation. Possible returns are: 2835 * \ref LORAMAC_STATUS_OK, 2836 * \ref LORAMAC_STATUS_BUSY 2837 */ 2838 LoRaMacStatus_t LoRaMacDeInitialization( void ); 2839 2840 /*! \} defgroup LORAMAC */ 2841 2842 #ifdef __cplusplus 2843 } 2844 #endif 2845 2846 #endif // __LORAMAC_H__ 2847