libmDot 1.0.12-hotfix

Committer:
shaunkrnelson
Date:
Sun Jul 17 00:03:03 2016 +0000
Revision:
0:5f84bdd949b8
1.0.12-hotfix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shaunkrnelson 0:5f84bdd949b8 1 /*
shaunkrnelson 0:5f84bdd949b8 2 / _____) _ | |
shaunkrnelson 0:5f84bdd949b8 3 ( (____ _____ ____ _| |_ _____ ____| |__
shaunkrnelson 0:5f84bdd949b8 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
shaunkrnelson 0:5f84bdd949b8 5 _____) ) ____| | | || |_| ____( (___| | | |
shaunkrnelson 0:5f84bdd949b8 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
shaunkrnelson 0:5f84bdd949b8 7 (C)2013 Semtech
shaunkrnelson 0:5f84bdd949b8 8
shaunkrnelson 0:5f84bdd949b8 9 Description: Generic radio driver definition
shaunkrnelson 0:5f84bdd949b8 10
shaunkrnelson 0:5f84bdd949b8 11 License: Revised BSD License, see LICENSE.TXT file include in the project
shaunkrnelson 0:5f84bdd949b8 12
shaunkrnelson 0:5f84bdd949b8 13 Maintainer: Miguel Luis and Gregory Cristian
shaunkrnelson 0:5f84bdd949b8 14 */
shaunkrnelson 0:5f84bdd949b8 15 #ifndef __LORAMACEVENT_H__
shaunkrnelson 0:5f84bdd949b8 16 #define __LORAMACEVENT_H__
shaunkrnelson 0:5f84bdd949b8 17
shaunkrnelson 0:5f84bdd949b8 18 /*!
shaunkrnelson 0:5f84bdd949b8 19 * LoRaMAC event flags
shaunkrnelson 0:5f84bdd949b8 20 */
shaunkrnelson 0:5f84bdd949b8 21 typedef union {
shaunkrnelson 0:5f84bdd949b8 22 uint8_t Value;
shaunkrnelson 0:5f84bdd949b8 23 struct {
shaunkrnelson 0:5f84bdd949b8 24 uint8_t :1;
shaunkrnelson 0:5f84bdd949b8 25 uint8_t Tx :1;
shaunkrnelson 0:5f84bdd949b8 26 uint8_t Rx :1;
shaunkrnelson 0:5f84bdd949b8 27 uint8_t RxData :1;
shaunkrnelson 0:5f84bdd949b8 28 uint8_t RxSlot :2;
shaunkrnelson 0:5f84bdd949b8 29 uint8_t LinkCheck :1;
shaunkrnelson 0:5f84bdd949b8 30 uint8_t JoinAccept :1;
shaunkrnelson 0:5f84bdd949b8 31 } Bits;
shaunkrnelson 0:5f84bdd949b8 32 } LoRaMacEventFlags;
shaunkrnelson 0:5f84bdd949b8 33
shaunkrnelson 0:5f84bdd949b8 34 typedef enum {
shaunkrnelson 0:5f84bdd949b8 35 LORAMAC_EVENT_INFO_STATUS_OK = 0,
shaunkrnelson 0:5f84bdd949b8 36 LORAMAC_EVENT_INFO_STATUS_ERROR,
shaunkrnelson 0:5f84bdd949b8 37 LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT,
shaunkrnelson 0:5f84bdd949b8 38 LORAMAC_EVENT_INFO_STATUS_RX_TIMEOUT,
shaunkrnelson 0:5f84bdd949b8 39 LORAMAC_EVENT_INFO_STATUS_RX_ERROR,
shaunkrnelson 0:5f84bdd949b8 40 LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL,
shaunkrnelson 0:5f84bdd949b8 41 LORAMAC_EVENT_INFO_STATUS_DOWNLINK_FAIL,
shaunkrnelson 0:5f84bdd949b8 42 LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL,
shaunkrnelson 0:5f84bdd949b8 43 LORAMAC_EVENT_INFO_STATUS_MIC_FAIL,
shaunkrnelson 0:5f84bdd949b8 44 } LoRaMacEventInfoStatus;
shaunkrnelson 0:5f84bdd949b8 45
shaunkrnelson 0:5f84bdd949b8 46 /*!
shaunkrnelson 0:5f84bdd949b8 47 * LoRaMAC event information
shaunkrnelson 0:5f84bdd949b8 48 */
shaunkrnelson 0:5f84bdd949b8 49 typedef struct {
shaunkrnelson 0:5f84bdd949b8 50 LoRaMacEventInfoStatus Status;
shaunkrnelson 0:5f84bdd949b8 51 bool TxAckReceived;
shaunkrnelson 0:5f84bdd949b8 52 uint8_t TxNbRetries;
shaunkrnelson 0:5f84bdd949b8 53 uint8_t TxDatarate;
shaunkrnelson 0:5f84bdd949b8 54 uint8_t RxPort;
shaunkrnelson 0:5f84bdd949b8 55 uint8_t *RxBuffer;
shaunkrnelson 0:5f84bdd949b8 56 uint8_t RxBufferSize;
shaunkrnelson 0:5f84bdd949b8 57 int16_t RxRssi;
shaunkrnelson 0:5f84bdd949b8 58 uint8_t RxSnr;
shaunkrnelson 0:5f84bdd949b8 59 uint16_t Energy;
shaunkrnelson 0:5f84bdd949b8 60 uint8_t DemodMargin;
shaunkrnelson 0:5f84bdd949b8 61 uint8_t NbGateways;
shaunkrnelson 0:5f84bdd949b8 62 } LoRaMacEventInfo;
shaunkrnelson 0:5f84bdd949b8 63
shaunkrnelson 0:5f84bdd949b8 64 /*!
shaunkrnelson 0:5f84bdd949b8 65 * LoRaMAC events structure
shaunkrnelson 0:5f84bdd949b8 66 * Used to notify upper layers of MAC events
shaunkrnelson 0:5f84bdd949b8 67 */
shaunkrnelson 0:5f84bdd949b8 68 class LoRaMacEvent {
shaunkrnelson 0:5f84bdd949b8 69 public:
shaunkrnelson 0:5f84bdd949b8 70
shaunkrnelson 0:5f84bdd949b8 71 virtual ~LoRaMacEvent() {}
shaunkrnelson 0:5f84bdd949b8 72
shaunkrnelson 0:5f84bdd949b8 73 /*!
shaunkrnelson 0:5f84bdd949b8 74 * MAC layer event callback prototype.
shaunkrnelson 0:5f84bdd949b8 75 *
shaunkrnelson 0:5f84bdd949b8 76 * \param [IN] flags Bit field indicating the MAC events occurred
shaunkrnelson 0:5f84bdd949b8 77 * \param [IN] info Details about MAC events occurred
shaunkrnelson 0:5f84bdd949b8 78 */
shaunkrnelson 0:5f84bdd949b8 79 virtual void MacEvent(LoRaMacEventFlags *flags, LoRaMacEventInfo *info) {
shaunkrnelson 0:5f84bdd949b8 80
shaunkrnelson 0:5f84bdd949b8 81 if (flags->Bits.Rx) {
shaunkrnelson 0:5f84bdd949b8 82 delete[] info->RxBuffer;
shaunkrnelson 0:5f84bdd949b8 83 }
shaunkrnelson 0:5f84bdd949b8 84 }
shaunkrnelson 0:5f84bdd949b8 85
shaunkrnelson 0:5f84bdd949b8 86 virtual uint8_t MeasureBattery(void) {
shaunkrnelson 0:5f84bdd949b8 87 return 255;
shaunkrnelson 0:5f84bdd949b8 88 }
shaunkrnelson 0:5f84bdd949b8 89 };
shaunkrnelson 0:5f84bdd949b8 90
shaunkrnelson 0:5f84bdd949b8 91 #endif // __LORAMACEVENT_H__
shaunkrnelson 0:5f84bdd949b8 92