-
Notifications
You must be signed in to change notification settings - Fork 1
/
csf_linux.h
301 lines (264 loc) · 8.89 KB
/
csf_linux.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/******************************************************************************
@file csf_linux.h
@brief TIMAC 2.0 API Collector specific (linux) function definitions
Group: WCS LPC
$Target Device: DEVICES $
******************************************************************************
$License: BSD3 2016 $
******************************************************************************
$Release Name: PACKAGE NAME $
$Release Date: PACKAGE RELEASE DATE $
*****************************************************************************/
#if !defined(CSF_LINUX_H)
#define CSF_LINUX_H
typedef uint8_t UArg;
/*!
* Network parameters for a non-frequency hopping coordinator.
*/
/*! Network Information */
typedef struct
{
/*! Device Information */
ApiMac_deviceDescriptor_t deviceInfo;
/*! Channel */
uint8_t channel;
} Llc_networkInfo_t;
/*!
* Frequency Hopping Interface Settings
*/
typedef struct _Llc_fhintervalsettings_t
{
/*! Channel dwell time (in milliseconds) */
uint16_t dwell;
/*! Channel interval time (in milliseconds) */
uint16_t interval;
} Llc_fhIntervalSettings_t;
/*!
* Device frequency hopping information
*/
typedef struct _Llc_deviceinfofh_t
{
/*! Broadcast Interval settings */
Llc_fhIntervalSettings_t bcIntervals;
/*! Broadcast number of channels used */
uint8_t bcNumChans;
/*!
Broadcast channels used. Pointer to an array of bytes, Each byte
is a channel number and the order is the sequence to hop.
*/
uint8_t *pBcChans;
/*! Unicast Rx Interval settings */
Llc_fhIntervalSettings_t unicastIntervals;
/*! Unicast Rx number of channels used */
uint8_t unicastNumChans;
/*!
* Unicast channels used. Pointer to an array of bytes, Each byte
* is a channel number and the order is the sequence to hop.
*/
uint8_t *pUnicastChans;
} Llc_deviceInfoFh_t;
/*!
* Network parameters for a frequency hopping coordinator.
*/
typedef struct _Llc_networkinfofh_t
{
/*! Device Information */
/* Address information */
ApiMac_deviceDescriptor_t devInfo;
/*! Device Frequency Hopping Information */
Llc_deviceInfoFh_t fhInfo;
} Llc_networkInfoFh_t;
/*! Stored network information */
typedef struct
{
/*! true if network is frequency hopping */
bool fh;
/*! union to hold network information */
union
{
Llc_netInfo_t netInfo;
Llc_networkInfoFh_t fhNetInfo;
} info;
} Csf_networkInformation_t;
/*! for use by web interface */
typedef struct
{
/*! Address information */
ApiMac_deviceDescriptor_t devInfo;
/*! Device capability */
ApiMac_capabilityInfo_t capInfo;
} Csf_deviceInformation_t;
/*
* @brief Get the device list
*
* Note: Memory must be released via Csf_freeDeviceList()
*/
int Csf_getDeviceInformationList(Csf_deviceInformation_t **ppDeviceInfo);
/*
* @brief Release memory from the getDeviceList call
*/
void Csf_freeDeviceInformationList(size_t n, Csf_deviceInformation_t *p);
/*
* @brief given a state, return the ascii text name of this state (for dbg)
* @param s - the state.
*/
const char *CSF_cllc_statename(Cllc_states_t s);
/*
* @brief return the last known state of the CLLC.
*/
Cllc_states_t Csf_getCllcState(void);
/*!
* @brief Send the configuration message to a collector module to be
* sent OTA.
*
* @param pDstAddr - destination address of the device to send the message
* @param frameControl - configure what to the device is to report back.
* Ref. Smsgs_dataFields_t.
* @param reportingInterval - in millseconds- how often to report, 0
* means to turn off automated reporting, but will
* force the sensor device to send the Sensor Data
* message once.
* @param pollingInterval - in millseconds- how often to the device is to
* poll its parent for data (for sleeping devices
* only.
*
* @return status(uint8_t) - Success (0), Failure (1)
*/
extern uint8_t Csf_sendConfigRequest( ApiMac_sAddr_t *pDstAddr,
uint16_t frameControl,
uint32_t reportingInterval,
uint32_t pollingInterval);
/*!
* @brief Build and send the toggle led message to a device.
*
* @param pDstAddr - destination address of the device to send the message
*
* @return Collector_status_success, Collector_status_invalid_state
* or Collector_status_deviceNotFound
*/
extern uint8_t Csf_sendToggleLedRequest(
ApiMac_sAddr_t *pDstAddr);
extern uint8_t Csf_customCommand(
ApiMac_sAddr_t *pDstAddr,
uint8_t *state,
uint16_t length);
/*!
* @brief The application calls this function to indicate that a device
* disassociated.
*
* @param pSrcAddr - short address of the device that disassociated
*/
extern void Csf_deviceDisassocUpdate( ApiMac_sAddr_t *pSrcAddr );
/*!
* @brief Display divice short address when config data is received
*
* @param pSrcAddr - short address of the device that sent the message
*/
extern void Csf_deviceConfigDisplay(ApiMac_sAddr_t *pSrcAddr);
/*!
* @brief The application calls this function to print out the reported
* device type
*
* @param pSrcAddr - short address of the device that sent the message
* @param deviceFamilyID - the integer ID of the device family
* @param deviceTypeID - the integer ID of the board/device
*/
extern void Csf_deviceSensorDeviceTypeResponseUpdate(ApiMac_sAddr_t *pSrcAddr, uint8_t deviceFamilyID,
uint8_t deviceTypeID);
/*!
* @brief Display Sensor device and data
*
* @param pDataInd - pointer to the data indication information
*/
extern void Csf_deviceSensorDisplay(ApiMac_mcpsDataInd_t *pDataInd);
/*!
The application calls this function to indicate that a device
has reported its FW version.
Public function defined in csf.h
*/
/*!
* @brief The application calls this function to indicate that a device
* has reported its FW version.
*
* @param pSrcAddr - short address of the device that sent the message
* @param fwVerStr - the FW version string
*/
extern void Csf_deviceSensorFwVerUpdate(uint16_t srcAddr, char *fwVerStr);
/*!
The application calls this function to indicate that a device
has requested an OAD block.
Public function defined in csf.h
*/
/*!
* @brief The application calls this function to indicate that a device
* has reported its FW version.
*
* @param pSrcAddr - short address of the device that sent the message
* @param blockNum - block requested
* @param NumBlocks - Total number of block
*/
extern void Csf_deviceSensorOadUpdate( uint16_t srcAddr, uint16_t imgId, uint16_t blockNum, uint16_t NumBlocks);
/*!
The application calls this function to continue with FW update for on-chip OAD
Public function defined in csf.h
*/
/*!
* @brief The application calls this function to icontinue with
* FW update for on-chip OAD
*
* @param pSrcAddr - short address of the device that sent the message
*/
extern void Csf_deviceSensorOadResetRspRcvd(uint16_t srcAddr);
/*!
* @brief The application calls this function to blink the identify LED.
*
* @param identifyTime - time in seconds to identify for
*/
extern void Csf_identifyLED(uint16_t identifyTime, uint16_t shortAddr);
/*!
* @brief The application calls this function to reinitialize
* the MAC attributes on the CoProcessor after a reset
*/
extern void Csf_restoreMacAttributes(void);
/*!
* @brief The application calls this function tostart the device
*/
extern void Csf_processCoPReset(void);
/*!
* @brief Find the extended address froma given short address
*
* @param shortAddr - short address used to find the device
* @param pExtAddr - Memory location to copy the found extended address to.
*
* @return true if found and extended address is copied to pExtAddr, false if not
*/
bool Csf_getDeviceExtended(uint16_t shortAddr, ApiMac_sAddrExt_t *pExtAddr);
/*!
* @brief The application calls this function to indicate that a device
* has reported raw sensor data.
*
* The information will be saved.
*
* @param pDataInd - raw inbound data
*/
extern void Csf_deviceRawDataUpdate(ApiMac_mcpsDataInd_t *pDataInd);
/*!
* @brief Handles printing that the orphaned device joined back
*
* @return none
*/
extern void Csf_IndicateOrphanReJoin(uint16_t shortAddr);
#endif
/*
* ========================================
* 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
*/