]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/tidep0084.git/blob - tutorials/generic_sensor_tutorial/tutorial/SensorToCloud/example/collector/appsrv.h
Added Support for Generic Sensor Tutorial which provides instructions on how to add...
[apps/tidep0084.git] / tutorials / generic_sensor_tutorial / tutorial / SensorToCloud / example / collector / appsrv.h
1 /******************************************************************************
2  @file appsrv.h
4  @brief TIMAC 2.0 API Application Server API
6  Group: WCS LPC
7  $Target Devices: Linux: AM335x, Embedded Devices: CC1310, CC1350$
9  ******************************************************************************
10  $License: BSD3 2016 $
11   
12    Copyright (c) 2015, Texas Instruments Incorporated
13    All rights reserved.
14   
15    Redistribution and use in source and binary forms, with or without
16    modification, are permitted provided that the following conditions
17    are met:
18   
19    *  Redistributions of source code must retain the above copyright
20       notice, this list of conditions and the following disclaimer.
21   
22    *  Redistributions in binary form must reproduce the above copyright
23       notice, this list of conditions and the following disclaimer in the
24       documentation and/or other materials provided with the distribution.
25   
26    *  Neither the name of Texas Instruments Incorporated nor the names of
27       its contributors may be used to endorse or promote products derived
28       from this software without specific prior written permission.
29   
30    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
34    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
37    OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  ******************************************************************************
42  $Release Name: TI-15.4Stack Linux x64 SDK$
43  $Release Date: Jun 28, 2017 (2.02.00.03)$
44  *****************************************************************************/
45  #ifndef APPINTERFACE_H
46  #define APPINTERFACE_H
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 /******************************************************************************
53  Includes
54  *****************************************************************************/
55 #include <stdbool.h>
57 #include "csf.h"
58 #include "csf_linux.h"
59 #include "mt_msg.h"
60 #include "log.h"
62 #define LOG_APPSRV_CONNECTIONS  _bitN(LOG_DBG_APP_bitnum_first+0)
63 #define LOG_APPSRV_BROADCAST    _bitN(LOG_DBG_APP_bitnum_first+1)
64 #define LOG_APPSRV_MSG_CONTENT  _bitN(LOG_DBG_APP_bitnum_first+2)
66 /******************************************************************************
67  Typedefs
68  *****************************************************************************/
70 extern struct mt_msg_interface appClient_mt_interface_template;
71 extern struct socket_cfg       appClient_socket_cfg;
73 /*
74  * The API_MAC_msg_interface will point to either
75  * the *npi* or the *uart* interface.
76  */
77 extern struct mt_msg_interface npi_mt_interface;
78 extern struct socket_cfg       npi_socket_cfg;
80 extern struct mt_msg_interface uart_mt_interface;
81 extern struct uart_cfg         uart_cfg;
83 /******************************************************************************
84  Function Prototypes
85  *****************************************************************************/
87 /*
88  * Sets defaults for the application.
89  */
90 void APP_defaults(void);
92 /*
93  * Main application function.
94  */
95 void APP_main(void);
97 /*!
98  * @brief  Csf module calls this function to initialize the application server
99  *         interface
100  *
101  *
102  * @param
103  *
104  * @return
105  */
106  void appsrv_Init(void *param);
108 /*!
109  * @brief        Csf module calls this function to inform the applicaiton client
110  *                     that the application has either started/restored the network
111  *
112  * @param
113  *
114  * @return
115  */
116  void appsrv_networkUpdate(bool restored, Llc_netInfo_t *networkInfo);
118 /*!
119  * @brief        Csf module calls this function to inform the applicaiton clientr
120  *                     that a device has joined the network
121  *
122  * @param
123  *
124  * @return
125  */
126  void appsrv_deviceUpdate(Llc_deviceListItem_t *pDevInfo);
128  /*!
129  * @brief        Csf module calls this function to inform the applicaiton client
130  *                     that the device has responded to the configuration request
131  *
132  * @param
133  *
134  * @return
135  */
136  void appsrv_deviceConfigUpdate(ApiMac_sAddr_t *pSrcAddr, int8_t rssi,
137                                    Smsgs_configRspMsg_t *pMsg);
139  /*!
140  * @brief        Csf module calls this function to inform the applicaiton client
141  *                     that a device is no longer active in the network
142  *
143  * @param
144  *
145  * @return
146  */
147  void appsrv_deviceNotActiveUpdate(ApiMac_deviceDescriptor_t *pDevInfo,
148                                       bool timeout);
149   /*!
150  * @brief        Csf module calls this function to inform the applicaiton client
151                          of the reported sensor data from a network device
152  *
153  * @param
154  *
155  * @return
156  */
157  void appsrv_deviceSensorDataUpdate(ApiMac_sAddr_t *pSrcAddr, int8_t rssi,
158                                        Smsgs_sensorMsg_t *pMsg);
160 /*!
161  * @brief        TBD
162  *
163  * @param
164  *
165  * @return
166  */
167  void appsrv_stateChangeUpdate(Cllc_states_t state);
169 /*!
170  * @brief Broadcast a message to all connections
171  * @param pMsg - msg to broadcast
172  */
173 extern void appsrv_broadcast(struct mt_msg *pMsg);
175 /*!
176  * @brief Send remove device response to gateway
177  */
178 extern void appsrv_send_removeDeviceRsp(void);
180 #ifdef __cplusplus
182 #endif
184 #endif /* APPINTERFACE_H */
186 /*
187  *  ========================================
188  *  Texas Instruments Micro Controller Style
189  *  ========================================
190  *  Local Variables:
191  *  mode: c
192  *  c-file-style: "bsd"
193  *  tab-width: 4
194  *  c-basic-offset: 4
195  *  indent-tabs-mode: nil
196  *  End:
197  *  vim:set  filetype=c tabstop=4 shiftwidth=4 expandtab=true
198  */