ef03b13511e5e33b24ee62f3e8ba20b39cfc623b
1 /******************************************************************************
3 @file collector.h
5 @brief TIMAC 2.0 Collector Example Application Header
7 Group: WCS LPC
8 $Target Devices: Linux: AM335x, Embedded Devices: CC1310, CC1350$
10 ******************************************************************************
11 $License: BSD3 2016 $
13 Copyright (c) 2015, Texas Instruments Incorporated
14 All rights reserved.
16 Redistribution and use in source and binary forms, with or without
17 modification, are permitted provided that the following conditions
18 are met:
20 * Redistributions of source code must retain the above copyright
21 notice, this list of conditions and the following disclaimer.
23 * Redistributions in binary form must reproduce the above copyright
24 notice, this list of conditions and the following disclaimer in the
25 documentation and/or other materials provided with the distribution.
27 * Neither the name of Texas Instruments Incorporated nor the names of
28 its contributors may be used to endorse or promote products derived
29 from this software without specific prior written permission.
31 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
33 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
35 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
36 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
37 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
38 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
41 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 ******************************************************************************
43 $Release Name: TI-15.4Stack Linux x64 SDK$
44 $Release Date: July 14, 2016 (2.00.00.30)$
45 *****************************************************************************/
46 #ifndef COLLECTOR_H
47 #define COLLECTOR_H
49 /******************************************************************************
50 Includes
51 *****************************************************************************/
53 #include <stdbool.h>
54 #include <stdint.h>
56 #include "api_mac.h"
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
63 /******************************************************************************
64 Constants and definitions
65 *****************************************************************************/
67 /*! Event ID - Start the device in the network */
68 #define COLLECTOR_START_EVT 0x0001
69 /*! Event ID - Tracking Timeout Event */
70 #define COLLECTOR_TRACKING_TIMEOUT_EVT 0x0002
71 /*! Event ID - Generate Configs Event */
72 #define COLLECTOR_CONFIG_EVT 0x0004
74 /*! Collector Status Values */
75 typedef enum
76 {
77 /*! Success */
78 Collector_status_success = 0,
79 /*! Device Not Found */
80 Collector_status_deviceNotFound = 1,
81 /*! Collector isn't in the correct state to send a message */
82 Collector_status_invalid_state = 2
83 } Collector_status_t;
85 /******************************************************************************
86 Structures
87 *****************************************************************************/
89 /*! Collector Statistics */
90 typedef struct
91 {
92 /*!
93 Total number of tracking request messages attempted
94 */
95 uint32_t trackingRequestAttempts;
96 /*!
97 Total number of tracking request messages sent
98 */
99 uint32_t trackingReqRequestSent;
100 /*!
101 Total number of tracking response messages received
102 */
103 uint32_t trackingResponseReceived;
104 /*!
105 Total number of config request messages attempted
106 */
107 uint32_t configRequestAttempts;
108 /*!
109 Total number of config request messages sent
110 */
111 uint32_t configReqRequestSent;
112 /*!
113 Total number of config response messages received
114 */
115 uint32_t configResponseReceived;
116 /*!
117 Total number of sensor messages received
118 */
119 uint32_t sensorMessagesReceived;
120 /*!
121 Total number of failed messages because of channel access failure
122 */
123 uint32_t channelAccessFailures;
124 /*!
125 Total number of failed messages because of ACKs not received
126 */
127 uint32_t ackFailures;
128 /*!
129 Total number of failed transmit messages that are not channel access
130 failure and not ACK failures
131 */
132 uint32_t otherTxFailures;
133 /*! Total number of RX Decrypt failures. */
134 uint32_t rxDecryptFailures;
135 /*! Total number of TX Encrypt failures. */
136 uint32_t txEncryptFailures;
137 /* Total Transaction Expired Count */
138 uint32_t txTransactionExpired;
139 /* Total transaction Overflow error */
140 uint32_t txTransactionOverflow;
141 } Collector_statistics_t;
143 /******************************************************************************
144 Global Variables
145 *****************************************************************************/
147 /*! Collector events flags */
148 extern uint16_t Collector_events;
150 /*! Collector statistics */
151 extern Collector_statistics_t Collector_statistics;
153 extern ApiMac_callbacks_t Collector_macCallbacks;
155 /******************************************************************************
156 Function Prototypes
157 *****************************************************************************/
159 /*!
160 * @brief Initialize this application.
161 */
162 extern void Collector_init(void);
164 /*!
165 * @brief Application task processing.
166 */
167 extern void Collector_process(void);
169 /*!
170 * @brief Build and send the configuration message to a device.
171 *
172 * @param pDstAddr - destination address of the device to send the message
173 * @param frameControl - configure what to the device is to report back.
174 * Ref. Smsgs_dataFields_t.
175 * @param reportingInterval - in milliseconds- how often to report, 0
176 * means to turn off automated reporting, but will
177 * force the sensor device to send the Sensor Data
178 * message once.
179 * @param pollingInterval - in milliseconds- how often to the device is to
180 * poll its parent for data (for sleeping devices
181 * only.
182 *
183 * @return Collector_status_success, Collector_status_invalid_state
184 * or Collector_status_deviceNotFound
185 */
186 extern Collector_status_t Collector_sendConfigRequest(ApiMac_sAddr_t *pDstAddr,
187 uint16_t frameControl,
188 uint32_t reportingInterval,
189 uint32_t pollingInterval);
191 /*!
192 * @brief Update the collector statistics
193 */
194 extern void Collector_updateStats( void );
196 /*!
197 * @brief Build and send the toggle led message to a device.
198 *
199 * @param pDstAddr - destination address of the device to send the message
200 *
201 * @return Collector_status_success, Collector_status_invalid_state
202 * or Collector_status_deviceNotFound
203 */
204 extern Collector_status_t Collector_sendToggleLedRequest(
205 ApiMac_sAddr_t *pDstAddr);
207 #ifdef __cplusplus
208 }
209 #endif
211 #endif /* COLLECTOR_H */
213 /*
214 * ========================================
215 * Texas Instruments Micro Controller Style
216 * ========================================
217 * Local Variables:
218 * mode: c
219 * c-file-style: "bsd"
220 * tab-width: 4
221 * c-basic-offset: 4
222 * indent-tabs-mode: nil
223 * End:
224 * vim:set filetype=c tabstop=4 shiftwidth=4 expandtab=true
225 */