1 /*!
2  * \file      LmHandlerTypes.h
3  *
4  * \brief     Defines the types used by LmHandler
5  *
6  * \copyright Revised BSD License, see section \ref LICENSE.
7  *
8  * \code
9  *                ______                              _
10  *               / _____)             _              | |
11  *              ( (____  _____ ____ _| |_ _____  ____| |__
12  *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
13  *               _____) ) ____| | | || |_| ____( (___| | | |
14  *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
15  *              (C)2013-2018 Semtech
16  *
17  * \endcode
18  *
19  * \author    Miguel Luis ( Semtech )
20  */
21 #ifndef __LORAMAC_HANDLER_TYPES_H__
22 #define __LORAMAC_HANDLER_TYPES_H__
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "LoRaMac.h"
29 
30 /*!
31  * If set to 1 the new API defining \ref OnSysTimeUpdate callback is used.
32  */
33 #define LMH_SYS_TIME_UPDATE_NEW_API                 1
34 
35 /*!
36  *
37  */
38 typedef enum
39 {
40     LORAMAC_HANDLER_ADR_OFF = 0,
41     LORAMAC_HANDLER_ADR_ON = !LORAMAC_HANDLER_ADR_OFF
42 }LmHandlerAdrStates_t;
43 
44 /*!
45  *
46  */
47 typedef enum
48 {
49     LORAMAC_HANDLER_RESET = 0,
50     LORAMAC_HANDLER_SET = !LORAMAC_HANDLER_RESET
51 }LmHandlerFlagStatus_t;
52 
53 /*!
54  *
55  */
56 typedef enum
57 {
58     LORAMAC_HANDLER_ERROR = -1,
59     LORAMAC_HANDLER_SUCCESS = 0
60 }LmHandlerErrorStatus_t;
61 
62 /*!
63  *
64  */
65 typedef enum
66 {
67     LORAMAC_HANDLER_UNCONFIRMED_MSG = 0,
68     LORAMAC_HANDLER_CONFIRMED_MSG = !LORAMAC_HANDLER_UNCONFIRMED_MSG
69 }LmHandlerMsgTypes_t;
70 
71 /*!
72  *
73  */
74 typedef enum
75 {
76     LORAMAC_HANDLER_FALSE = 0,
77     LORAMAC_HANDLER_TRUE = !LORAMAC_HANDLER_FALSE
78 }LmHandlerBoolean_t;
79 
80 typedef enum
81 {
82     LORAMAC_HANDLER_BEACON_ACQUIRING,
83     LORAMAC_HANDLER_BEACON_LOST,
84     LORAMAC_HANDLER_BEACON_RX,
85     LORAMAC_HANDLER_BEACON_NRX
86 }LmHandlerBeaconState_t;
87 
88 typedef enum
89 {
90     LORAMAC_HANDLER_NVM_RESTORE,
91     LORAMAC_HANDLER_NVM_STORE,
92 }LmHandlerNvmContextStates_t;
93 
94 /*!
95  * Commissioning parameters
96  */
97 typedef struct CommissioningParams_s
98 {
99     bool IsOtaaActivation;
100     uint8_t DevEui[8];
101     uint8_t JoinEui[8];
102     uint8_t SePin[4];
103     uint32_t NetworkId;
104     uint32_t DevAddr;
105 }CommissioningParams_t;
106 
107 /*!
108  * Application data structure
109  */
110 typedef struct LmHandlerAppData_s
111 {
112     uint8_t Port;
113     uint8_t BufferSize;
114     uint8_t *Buffer;
115 }LmHandlerAppData_t;
116 
117 typedef struct LmHandlerRequestParams_s
118 {
119     uint8_t IsMcpsRequest;
120     LoRaMacStatus_t Status;
121     union
122     {
123         Mcps_t Mcps;
124         Mlme_t Mlme;
125     }RequestType;
126 }LmHandlerRequestParams_t;
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif // __LORAMAC_HANDLER_TYPES_H__
133