All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
swi_airvantage.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2014 Sierra Wireless and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * Laurent Barthelemy for Sierra Wireless - initial API and implementation
10  * Romain Perier for Sierra Wireless - initial API and implementation
11  *******************************************************************************/
12 
13 
35 #ifndef SWI_AIRVANTAGE_INCLUDE_GUARD
36 #define SWI_AIRVANTAGE_INCLUDE_GUARD
37 
38 #include <stdlib.h>
39 #include "returncodes.h"
40 #include "swi_dset.h"
41 
53 #define SWI_AV_ERROR 1
54 #define SWI_AV_INFO 1
55 
63 rc_ReturnCode_t swi_av_Init();
64 
70 rc_ReturnCode_t swi_av_Destroy();
71 
72 
73 #define SWI_AV_CX_SYNC UINT_MAX
74 
75 
90 rc_ReturnCode_t swi_av_ConnectToServer
91 (
92  unsigned int latency
93 );
95 
96 
97 
115 rc_ReturnCode_t swi_av_TriggerPolicy
116 (
117  const char* policyPtr
118 );
120 
121 
127 typedef struct swi_av_Asset swi_av_Asset_t;
128 
129 
144 rc_ReturnCode_t swi_av_asset_Create
145 (
146  swi_av_Asset_t** asset,
147  const char* assetIdPtr
150 );
153 
154 
155 
156 
157 
158 
166 rc_ReturnCode_t swi_av_asset_Start
167 (
168  swi_av_Asset_t* asset
169 );
170 
171 
180 rc_ReturnCode_t swi_av_asset_Destroy
181 (
182  swi_av_Asset_t* asset
183 );
184 
185 
186 // end General
188 
201 typedef enum swi_av_timestamp{
205 
220 rc_ReturnCode_t swi_av_asset_PushString
221 (
222  swi_av_Asset_t* asset,
223  const char *pathPtr,
224  const char* policyPtr,
227  uint32_t timestamp,
229  const char* valuePtr
231 );
232 
247 rc_ReturnCode_t swi_av_asset_PushInteger
248 (
249  swi_av_Asset_t* asset,
250  const char *pathPtr,
251  const char* policyPtr,
253  uint32_t timestamp,
255  int64_t value
257 );
258 
273 rc_ReturnCode_t swi_av_asset_PushFloat
274 (
275  swi_av_Asset_t* asset,
276  const char *pathPtr,
277  const char* policyPtr,
279  uint32_t timestamp,
281  double value
283 );
284 
285 // end Data Sending Simple API
287 
298 typedef struct swi_av_Table swi_av_Table_t;
299 
303 typedef enum
304 {
308 
319 rc_ReturnCode_t swi_av_table_Create
320 (
321  swi_av_Asset_t* asset,
322  swi_av_Table_t** table,
323  const char* pathPtr,
326  size_t numColumns,
327  const char** columnNamesPtr,
328  const char* policyPtr,
329  swi_av_Table_Storage_t persisted,
330  int purge
332 );
335 
336 
345 rc_ReturnCode_t swi_av_table_Destroy
346 (
347  swi_av_Table_t* table
348 );
349 
350 
360 rc_ReturnCode_t swi_av_table_PushFloat
361 (
362  swi_av_Table_t* table,
363  double value
364 );
365 
366 
367 
377 rc_ReturnCode_t swi_av_table_PushInteger
378 (
379  swi_av_Table_t* table,
380  int value
381 );
382 
392 rc_ReturnCode_t swi_av_table_PushString
393 (
394  swi_av_Table_t* table,
395  const char* value
396 );
397 
398 
409 rc_ReturnCode_t swi_av_table_PushRow
410 (
411  swi_av_Table_t* table
412 );
413 
414 
415 
416 // end Data Sending Advanced API
418 
441 typedef void (*swi_av_DataWriteCB)
442 (
443  swi_av_Asset_t *asset,
444  const char *pathPtr,
445  swi_dset_Iterator_t* data,
446  int ack_id,
448  void *userDataPtr
450 );
451 
452 
453 
491 rc_ReturnCode_t swi_av_RegisterDataWrite
492 (
493  swi_av_Asset_t *asset,
494  swi_av_DataWriteCB cb,
495  void * userDataPtr
496 );
497 
498 
507 rc_ReturnCode_t swi_av_Acknowledge
508 (
509  int ackId,
510  int status,
511  const char* errMsgPtr,
512  const char* policyPtr,
513  int persisted
514 );
516 
517 
518 
519 
520 // end Data Reception
522 
560 typedef rc_ReturnCode_t (*swi_av_updateNotificationCB)
561 (
562  swi_av_Asset_t *asset,
563  const char* componentNamePtr,
564  const char* versionPtr,
566  const char *updateFilePathPtr,
568  swi_dset_Iterator_t* customParams,
571  void *userDataPtr
573 );
574 
575 
603 rc_ReturnCode_t swi_av_RegisterUpdateNotification
604 (
605  swi_av_Asset_t* asset,
607  void *userDataPtr
609 );
610 
611 
618 rc_ReturnCode_t swi_av_SendUpdateResult
619 (
620  swi_av_Asset_t* asset,
621  const char* componentNamePtr,
622  int updateResult
625 );
628 
629 
630 // end Asset Update
632 
633 #endif /* SWI_AIRVANTAGE_INCLUDE_GUARD */
rc_ReturnCode_t swi_av_Destroy()
rc_ReturnCode_t swi_av_table_PushInteger(swi_av_Table_t *table, int value)
rc_ReturnCode_t swi_av_asset_PushString(swi_av_Asset_t *asset, const char *pathPtr, const char *policyPtr, uint32_t timestamp, const char *valuePtr)
rc_ReturnCode_t swi_av_Init()
rc_ReturnCode_t swi_av_table_Destroy(swi_av_Table_t *table)
rc_ReturnCode_t swi_av_ConnectToServer(unsigned int latency)
rc_ReturnCode_t swi_av_asset_PushInteger(swi_av_Asset_t *asset, const char *pathPtr, const char *policyPtr, uint32_t timestamp, int64_t value)
rc_ReturnCode_t swi_av_RegisterUpdateNotification(swi_av_Asset_t *asset, swi_av_updateNotificationCB cb, void *userDataPtr)
swi_av_Table_Storage_t
Definition: swi_airvantage.h:303
rc_ReturnCode_t swi_av_asset_Destroy(swi_av_Asset_t *asset)
rc_ReturnCode_t swi_av_asset_Create(swi_av_Asset_t **asset, const char *assetIdPtr)
rc_ReturnCode_t swi_av_table_PushFloat(swi_av_Table_t *table, double value)
rc_ReturnCode_t swi_av_asset_PushFloat(swi_av_Asset_t *asset, const char *pathPtr, const char *policyPtr, uint32_t timestamp, double value)
rc_ReturnCode_t swi_av_table_PushRow(swi_av_Table_t *table)
struct swi_av_Asset swi_av_Asset_t
Definition: swi_airvantage.h:127
rc_ReturnCode_t swi_av_table_PushString(swi_av_Table_t *table, const char *value)
rc_ReturnCode_t swi_av_SendUpdateResult(swi_av_Asset_t *asset, const char *componentNamePtr, int updateResult)
struct swi_av_Table swi_av_Table_t
Definition: swi_airvantage.h:298
rc_ReturnCode_t swi_av_Acknowledge(int ackId, int status, const char *errMsgPtr, const char *policyPtr, int persisted)
rc_ReturnCode_t swi_av_RegisterDataWrite(swi_av_Asset_t *asset, swi_av_DataWriteCB cb, void *userDataPtr)
rc_ReturnCode_t swi_av_asset_Start(swi_av_Asset_t *asset)
rc_ReturnCode_t swi_av_table_Create(swi_av_Asset_t *asset, swi_av_Table_t **table, const char *pathPtr, size_t numColumns, const char **columnNamesPtr, const char *policyPtr, swi_av_Table_Storage_t persisted, int purge)
Persistent, everything is saved to the FLASH memory.
Definition: swi_airvantage.h:306
rc_ReturnCode_t(* swi_av_updateNotificationCB)(swi_av_Asset_t *asset, const char *componentNamePtr, const char *versionPtr, const char *updateFilePathPtr, swi_dset_Iterator_t *customParams, void *userDataPtr)
Definition: swi_airvantage.h:561
Explicitly request no timestamp to send alongside the data.
Definition: swi_airvantage.h:202
rc_ReturnCode_t swi_av_TriggerPolicy(const char *policyPtr)
void(* swi_av_DataWriteCB)(swi_av_Asset_t *asset, const char *pathPtr, swi_dset_Iterator_t *data, int ack_id, void *userDataPtr)
Definition: swi_airvantage.h:442
Non persistent, everything is saved only in RAM.
Definition: swi_airvantage.h:305
Timestamp will be automatically generated when the data is added.
Definition: swi_airvantage.h:203
swi_av_timestamp_t
Definition: swi_airvantage.h:201