1 /*!
2  * \file      LoRaMacSerializer.h
3  *
4  * \brief     LoRa MAC layer message serializer functionality implementation
5  *
6  * \copyright Revised BSD License, see section \ref LICENSE.
7  *
8  * \code
9  *                ______                              _
10  *               / _____)             _              | |
11  *              ( (____  _____ ____ _| |_ _____  ____| |__
12  *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
13  *               _____) ) ____| | | || |_| ____( (___| | | |
14  *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
15  *              (C)2013 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  * addtogroup LORAMAC
34  * \{
35  *
36  */
37 #ifndef __LORAMAC_SERIALIZER_H__
38 #define __LORAMAC_SERIALIZER_H__
39 
40 #ifdef __cplusplus
41 extern "C"
42 {
43 #endif
44 #include <stdint.h>
45 #include "LoRaMacMessageTypes.h"
46 
47 
48 /*!
49  * LoRaMac Serializer Status
50  */
51 typedef enum eLoRaMacSerializerStatus
52 {
53     /*!
54      * No error occurred
55      */
56     LORAMAC_SERIALIZER_SUCCESS = 0,
57     /*!
58      * Null pointer exception
59      */
60     LORAMAC_SERIALIZER_ERROR_NPE,
61     /*!
62      * Incompatible buffer size
63      */
64     LORAMAC_SERIALIZER_ERROR_BUF_SIZE,
65     /*!
66      * Undefined Error occurred
67      */
68     LORAMAC_SERIALIZER_ERROR,
69 }LoRaMacSerializerStatus_t;
70 
71 /*!
72  * Creates serialized MAC message of structured object.
73  *
74  * \param[IN/OUT] macMsg        - Join-request message object
75  * \retval                      - Status of the operation
76  */
77 LoRaMacSerializerStatus_t LoRaMacSerializerJoinRequest( LoRaMacMessageJoinRequest_t* macMsg );
78 
79 /*!
80  * Creates serialized MAC message of structured object.
81  *
82  * \param[IN/OUT] macMsg        - Join-request message object
83  * \retval                      - Status of the operation
84  */
85 LoRaMacSerializerStatus_t LoRaMacSerializerReJoinType1( LoRaMacMessageReJoinType1_t* macMsg );
86 
87 /*!
88  * Creates serialized MAC message of structured object.
89  *
90  * \param[IN/OUT] macMsg        - Join-request message object
91  * \retval                      - Status of the operation
92  */
93 LoRaMacSerializerStatus_t LoRaMacSerializerReJoinType0or2( LoRaMacMessageReJoinType0or2_t* macMsg );
94 
95 /*!
96  * Creates serialized MAC message of structured object.
97  *
98  * \param[IN/OUT] macMsg        - Data message object
99  * \retval                      - Status of the operation
100  */
101 LoRaMacSerializerStatus_t LoRaMacSerializerData( LoRaMacMessageData_t* macMsg );
102 
103 /*! \} addtogroup LORAMAC */
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif // __LORAMAC_SERIALIZER_H__
110 
111