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