-
Notifications
You must be signed in to change notification settings - Fork 1
/
appsrv.h
216 lines (187 loc) · 5.58 KB
/
appsrv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/******************************************************************************
@file appsrv.h
@brief TIMAC 2.0 API Application Server API
Group: WCS LPC
$Target Device: DEVICES $
******************************************************************************
$License: BSD3 2016 $
******************************************************************************
$Release Name: PACKAGE NAME $
$Release Date: PACKAGE RELEASE DATE $
*****************************************************************************/
#ifndef APPINTERFACE_H
#define APPINTERFACE_H
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
Includes
*****************************************************************************/
#include <stdbool.h>
#include "csf.h"
#include "csf_linux.h"
#include "mt_msg.h"
#include "log.h"
#define LOG_APPSRV_CONNECTIONS _bitN(LOG_DBG_APP_bitnum_first+0)
#define LOG_APPSRV_BROADCAST _bitN(LOG_DBG_APP_bitnum_first+1)
#define LOG_APPSRV_MSG_CONTENT _bitN(LOG_DBG_APP_bitnum_first+2)
/******************************************************************************
Typedefs
*****************************************************************************/
extern struct mt_msg_interface appClient_mt_interface_template;
extern struct socket_cfg appClient_socket_cfg;
/*
* The API_MAC_msg_interface will point to either
* the *npi* or the *uart* interface.
*/
extern struct mt_msg_interface npi_mt_interface;
extern struct socket_cfg npi_socket_cfg;
extern struct mt_msg_interface uart_mt_interface;
extern struct uart_cfg uart_cfg;
/******************************************************************************
Function Prototypes
*****************************************************************************/
#define APPSRV_SYS_ID_RPC 10
#define APPSRV_DEVICE_JOINED_IND 0
#define APPSRV_DEVICE_LEFT_IND 1
#define APPSRV_NWK_INFO_IND 2
#define APPSRV_GET_NWK_INFO_REQ 3
#define APPSRV_GET_NWK_INFO_RSP 4
#define APPSRV_GET_NWK_INFO_CNF 5
#define APPSRV_GET_DEVICE_ARRAY_REQ 6
#define APPSRV_GET_DEVICE_ARRAY_CNF 7
#define APPSRV_DEVICE_NOTACTIVE_UPDATE_IND 8
#define APPSRV_DEVICE_DATA_RX_IND 9
#define APPSRV_COLLECTOR_STATE_CNG_IND 10
#define APPSRV_SET_JOIN_PERMIT_REQ 11
#define APPSRV_SET_JOIN_PERMIT_CNF 12
#define APPSRV_TX_DATA_REQ 13
#define APPSRV_TX_DATA_CNF 14
#define APPSRV_RMV_DEVICE_REQ 15
#define APPSRV_RMV_DEVICE_RSP 16
#define HEADER_LEN 4
#define TX_DATA_CNF_LEN 4
#define JOIN_PERMIT_CNF_LEN 4
#define NWK_INFO_REQ_LEN 18
#define NWK_INFO_IND_LEN 17
#define DEV_ARRAY_HEAD_LEN 3
#define DEV_ARRAY_INFO_LEN 18
#define DEVICE_JOINED_IND_LEN 18
#define DEVICE_NOT_ACTIVE_LEN 13
#define STATE_CHG_IND_LEN 1
#define REMOVE_DEVICE_RSP_LEN 0
#define BEACON_ENABLED 1
#define NON_BEACON 2
#define FREQUENCY_HOPPING 3
#define RMV_STATUS_SUCCESS 0
#define RMV_STATUS_FAIL 1
/*!
* @brief Csf module calls this function to inform the applicaiton client
of the reported sensor data from a network device
*
* @param
*
* @return
*/
void appsrv_deviceRawDataUpdate(ApiMac_mcpsDataInd_t *pDataInd);
/*
* Sets defaults for the application.
*/
void APP_defaults(void);
/*
* Main application function.
*/
void APP_main(void);
/*!
* @brief Csf module calls this function to initialize the application server
* interface
*
*
* @param
*
* @return
*/
void appsrv_Init(void *param);
/*!
* @brief Csf module calls this function to inform the applicaiton client
* that the application has either started/restored the network
*
* @param
*
* @return
*/
void appsrv_networkUpdate(bool restored, Llc_netInfo_t *networkInfo);
/*!
* @brief Csf module calls this function to inform the applicaiton clientr
* that a device has joined the network
*
* @param
*
* @return
*/
void appsrv_deviceUpdate(Llc_deviceListItem_t *pDevInfo);
/*!
* @brief Csf module calls this function to inform the applicaiton client
* that the device has responded to the configuration request
*
* @param
*
* @return
*/
void appsrv_deviceConfigUpdate(ApiMac_sAddr_t *pSrcAddr, int8_t rssi,
Smsgs_configRspMsg_t *pMsg);
/*!
* @brief Csf module calls this function to inform the applicaiton client
* that a device is no longer active in the network
*
* @param
*
* @return
*/
void appsrv_deviceNotActiveUpdate(ApiMac_deviceDescriptor_t *pDevInfo,
bool timeout);
/*!
* @brief Csf module calls this function to inform the applicaiton client
of the reported sensor data from a network device
*
* @param
*
* @return
*/
void appsrv_deviceSensorDataUpdate(ApiMac_sAddr_t *pSrcAddr, int8_t rssi,
Smsgs_sensorMsg_t *pMsg);
/*!
* @brief TBD
*
* @param
*
* @return
*/
void appsrv_stateChangeUpdate(Cllc_states_t state);
/*!
* @brief Broadcast a message to all connections
* @param pMsg - msg to broadcast
*/
extern void appsrv_broadcast(struct mt_msg *pMsg);
/*!
* @brief Send remove device response to gateway
*/
extern void appsrv_send_removeDeviceRsp(void);
#ifdef __cplusplus
}
#endif
#endif /* APPINTERFACE_H */
/*
* ========================================
* Texas Instruments Micro Controller Style
* ========================================
* Local Variables:
* mode: c
* c-file-style: "bsd"
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
* vim:set filetype=c tabstop=4 shiftwidth=4 expandtab=true
*/