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 #include "LoRaMac.h"
25 
26 /*!
27  * If set to 1 the new API defining \ref OnSysTimeUpdate callback is used.
28  */
29 #define LMH_SYS_TIME_UPDATE_NEW_API                 1
30 
31 /*!
32  *
33  */
34 typedef enum
35 {
36     LORAMAC_HANDLER_ADR_OFF = 0,
37     LORAMAC_HANDLER_ADR_ON = !LORAMAC_HANDLER_ADR_OFF
38 }LmHandlerAdrStates_t;
39 
40 /*!
41  *
42  */
43 typedef enum
44 {
45     LORAMAC_HANDLER_RESET = 0,
46     LORAMAC_HANDLER_SET = !LORAMAC_HANDLER_RESET
47 }LmHandlerFlagStatus_t;
48 
49 /*!
50  *
51  */
52 typedef enum
53 {
54     LORAMAC_HANDLER_ERROR = -1,
55     LORAMAC_HANDLER_SUCCESS = 0
56 }LmHandlerErrorStatus_t;
57 
58 /*!
59  *
60  */
61 typedef enum
62 {
63     LORAMAC_HANDLER_UNCONFIRMED_MSG = 0,
64     LORAMAC_HANDLER_CONFIRMED_MSG = !LORAMAC_HANDLER_UNCONFIRMED_MSG
65 }LmHandlerMsgTypes_t;
66 
67 /*!
68  *
69  */
70 typedef enum
71 {
72     LORAMAC_HANDLER_FALSE = 0,
73     LORAMAC_HANDLER_TRUE = !LORAMAC_HANDLER_FALSE
74 }LmHandlerBoolean_t;
75 
76 typedef enum
77 {
78     LORAMAC_HANDLER_BEACON_ACQUIRING,
79     LORAMAC_HANDLER_BEACON_LOST,
80     LORAMAC_HANDLER_BEACON_RX,
81     LORAMAC_HANDLER_BEACON_NRX
82 }LmHandlerBeaconState_t;
83 
84 typedef enum
85 {
86     LORAMAC_HANDLER_NVM_RESTORE,
87     LORAMAC_HANDLER_NVM_STORE,
88 }LmHandlerNvmContextStates_t;
89 
90 /*!
91  * Commissioning parameters
92  */
93 typedef struct CommissioningParams_s
94 {
95     bool IsOtaaActivation;
96     uint8_t DevEui[8];
97     uint8_t JoinEui[8];
98     uint8_t SePin[4];
99     uint32_t NetworkId;
100     uint32_t DevAddr;
101 }CommissioningParams_t;
102 
103 /*!
104  * Application data structure
105  */
106 typedef struct LmHandlerAppData_s
107 {
108     uint8_t Port;
109     uint8_t BufferSize;
110     uint8_t *Buffer;
111 }LmHandlerAppData_t;
112 
113 typedef struct LmHandlerRequestParams_s
114 {
115     uint8_t IsMcpsRequest;
116     LoRaMacStatus_t Status;
117     union
118     {
119         Mcps_t Mcps;
120         Mlme_t Mlme;
121     }RequestType;
122 }LmHandlerRequestParams_t;
123 
124 #endif // __LORAMAC_HANDLER_TYPES_H__
125