| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- /*!
- * \file LoRaMacMessageTypes.h
- *
- * \brief LoRa MAC layer message type definitions
- *
- * \copyright Revised BSD License, see section \ref LICENSE.
- *
- * \code
- * ______ _
- * / _____) _ | |
- * ( (____ _____ ____ _| |_ _____ ____| |__
- * \____ \| ___ | (_ _) ___ |/ ___) _ \
- * _____) ) ____| | | || |_| ____( (___| | | |
- * (______/|_____)_|_|_| \__)_____)\____)_| |_|
- * (C)2013 Semtech
- *
- * ___ _____ _ ___ _ _____ ___ ___ ___ ___
- * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
- * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
- * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
- * embedded.connectivity.solutions===============
- *
- * \endcode
- *
- * \author Miguel Luis ( Semtech )
- *
- * \author Gregory Cristian ( Semtech )
- *
- * \author Daniel Jaeckle ( STACKFORCE )
- *
- * \author Johannes Bruder ( STACKFORCE )
- *
- * addtogroup LORAMAC
- * \{
- *
- */
- #ifndef __LORAMAC_MESSAGE_TYPES_H__
- #define __LORAMAC_MESSAGE_TYPES_H__
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- #include <stdint.h>
- #include "LoRaMacHeaderTypes.h"
- /*! MAC header field size */
- #define LORAMAC_MHDR_FIELD_SIZE 1
- /*! Join EUI field size */
- #define LORAMAC_JOIN_EUI_FIELD_SIZE 8
- /*! Device EUI field size */
- #define LORAMAC_DEV_EUI_FIELD_SIZE 8
- /*! Join-server nonce field size */
- #define LORAMAC_JOIN_NONCE_FIELD_SIZE 3
- /*! Network ID field size */
- #define LORAMAC_NET_ID_FIELD_SIZE 3
- /*! Port field size */
- #define LORAMAC_F_PORT_FIELD_SIZE 1
- /*! CFList field size */
- #define LORAMAC_C_FLIST_FIELD_SIZE 16
- /*! MIC field size */
- #define LORAMAC_MIC_FIELD_SIZE 4
- /*! Join-request message size */
- #define LORAMAC_JOIN_REQ_MSG_SIZE 23
- /*! ReJoin-request type 1 message size */
- #define LORAMAC_RE_JOIN_1_MSG_SIZE 24
- /*! ReJoin-request type 0 or 2 message size */
- #define LORAMAC_RE_JOIN_0_2_MSG_SIZE 19
- /*!
- * LoRaMac type for Join-request message
- */
- typedef struct sLoRaMacMessageJoinRequest
- {
- /*!
- * Serialized message buffer
- */
- uint8_t* Buffer;
- /*!
- * Size of serialized message buffer
- */
- uint8_t BufSize;
- /*!
- * MAC header
- */
- LoRaMacHeader_t MHDR;
- /*!
- * Join EUI
- */
- uint8_t JoinEUI[LORAMAC_JOIN_EUI_FIELD_SIZE];
- /*!
- * Device EUI
- */
- uint8_t DevEUI[LORAMAC_DEV_EUI_FIELD_SIZE];
- /*!
- * Device Nonce
- */
- uint16_t DevNonce;
- /*!
- * Message integrity code (MIC)
- */
- uint32_t MIC;
- }LoRaMacMessageJoinRequest_t;
- /*!
- * LoRaMac type for rejoin-request type 1 message
- */
- typedef struct sLoRaMacMessageReJoinType1
- {
- /*!
- * Serialized message buffer
- */
- uint8_t* Buffer;
- /*!
- * Size of serialized message buffer
- */
- uint8_t BufSize;
- /*!
- * MAC header
- */
- LoRaMacHeader_t MHDR;
- /*!
- * Rejoin-request type ( 1 )
- */
- uint8_t ReJoinType;
- /*!
- * Join EUI
- */
- uint8_t JoinEUI[LORAMAC_JOIN_EUI_FIELD_SIZE];
- /*!
- * Device EUI
- */
- uint8_t DevEUI[LORAMAC_DEV_EUI_FIELD_SIZE];
- /*!
- * ReJoin Type 1 counter
- */
- uint16_t RJcount1;
- /*!
- * Message integrity code (MIC)
- */
- uint32_t MIC;
- }LoRaMacMessageReJoinType1_t;
- /*!
- * LoRaMac type for rejoin-request type 0 or 2 message
- */
- typedef struct sLoRaMacMessageReJoinType0or2
- {
- /*!
- * Serialized message buffer
- */
- uint8_t* Buffer;
- /*!
- * Size of serialized message buffer
- */
- uint8_t BufSize;
- /*!
- * MAC header
- */
- LoRaMacHeader_t MHDR;
- /*!
- * Rejoin-request type ( 0 or 2 )
- */
- uint8_t ReJoinType;
- /*!
- * Network ID ( 3 bytes )
- */
- uint8_t NetID[LORAMAC_NET_ID_FIELD_SIZE];
- /*!
- * Device EUI
- */
- uint8_t DevEUI[LORAMAC_DEV_EUI_FIELD_SIZE];
- /*!
- * ReJoin Type 0 and 2 frame counter
- */
- uint16_t RJcount0;
- /*!
- * Message integrity code (MIC)
- */
- uint32_t MIC;
- }LoRaMacMessageReJoinType0or2_t;
- /*!
- * LoRaMac type for Join-accept message
- */
- typedef struct sLoRaMacMessageJoinAccept
- {
- /*!
- * Serialized message buffer
- */
- uint8_t* Buffer;
- /*!
- * Size of serialized message buffer
- */
- uint8_t BufSize;
- /*!
- * MAC header
- */
- LoRaMacHeader_t MHDR;
- /*!
- * Server Nonce ( 3 bytes )
- */
- uint8_t JoinNonce[LORAMAC_JOIN_NONCE_FIELD_SIZE];
- /*!
- * Network ID ( 3 bytes )
- */
- uint8_t NetID[LORAMAC_NET_ID_FIELD_SIZE];
- /*!
- * Device address
- */
- uint32_t DevAddr;
- /*!
- * Device address
- */
- LoRaMacDLSettings_t DLSettings;
- /*!
- * Delay between TX and RX
- */
- uint8_t RxDelay;
- /*!
- * List of channel frequencies (opt.)
- */
- uint8_t CFList[16];
- /*!
- * Message integrity code (MIC)
- */
- uint32_t MIC;
- }LoRaMacMessageJoinAccept_t;
- /*!
- * LoRaMac type for Data MAC messages
- * (Unconfirmed Data Up, Confirmed Data Up, Unconfirmed Data Down, Confirmed Data Down)
- */
- typedef struct sLoRaMacMessageData
- {
- /*!
- * Serialized message buffer
- */
- uint8_t* Buffer;
- /*!
- * Size of serialized message buffer
- */
- uint8_t BufSize;
- /*!
- * MAC header
- */
- LoRaMacHeader_t MHDR;
- /*!
- * Frame header (FHDR)
- */
- LoRaMacFrameHeader_t FHDR;
- /*!
- * Port field (opt.)
- */
- uint8_t FPort;
- /*!
- * Frame payload may contain MAC commands or data (opt.)
- */
- uint8_t* FRMPayload;
- /*!
- * Size of frame payload (not included in LoRaMac messages)
- */
- uint8_t FRMPayloadSize;
- /*!
- * Message integrity code (MIC)
- */
- uint32_t MIC;
- }LoRaMacMessageData_t;
- /*!
- * LoRaMac message type enumerator
- */
- typedef enum eLoRaMacMessageType
- {
- /*!
- * Join-request message
- */
- LORAMAC_MSG_TYPE_JOIN_REQUEST,
- /*!
- * Rejoin-request type 1 message
- */
- LORAMAC_MSG_TYPE_RE_JOIN_1,
- /*!
- * Rejoin-request type 1 message
- */
- LORAMAC_MSG_TYPE_RE_JOIN_0_2,
- /*!
- * Join-accept message
- */
- LORAMAC_MSG_TYPE_JOIN_ACCEPT,
- /*!
- * Data MAC messages
- */
- LORAMAC_MSG_TYPE_DATA,
- /*!
- * Undefined message type
- */
- LORAMAC_MSG_TYPE_UNDEF,
- }LoRaMacMessageType_t;
- /*!
- * LoRaMac general message type
- */
- typedef struct sLoRaMacMessage
- {
- LoRaMacMessageType_t Type;
- union uMessage
- {
- LoRaMacMessageJoinRequest_t JoinReq;
- LoRaMacMessageReJoinType1_t ReJoin1;
- LoRaMacMessageReJoinType0or2_t ReJoin0or2;
- LoRaMacMessageJoinAccept_t JoinAccept;
- LoRaMacMessageData_t Data;
- }Message;
- }LoRaMacMessage_t;
- /*! \} addtogroup LORAMAC */
- #ifdef __cplusplus
- }
- #endif
- #endif // __LORAMAC_MESSAGE_TYPES_H__
|