ThingWorx C SDK
twSubscribedProps.h
1 /*
2  * Copyright 2017, PTC, Inc.
3  *
4  * Thingworx Subscribed Properties
5  */
6 
7 #include "twOSPort.h"
8 #include "twLogger.h"
9 #include "twApi.h"
10 #include "twInfoTable.h"
11 #include "twProperties.h"
12 
13 #ifndef TW_SUBSCRIBED_PROPS_H
14 #define TW_SUBSCRIBED_PROPS_H
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 typedef struct twSubscribedProperty {
21  const char * entity;
22  twProperty * prop;
23  char fold;
24  char foldedPropertyNeedsUpdate;
25  uint32_t size;
27 
28 /***************************************/
29 /* Entity Saved Property List */
30 /***************************************/
31 typedef struct twEntitySavedProperties {
32  char * name;
33  twList * props;
35 
36 /***************************************/
37 /* Entity Current Value List */
38 /***************************************/
39 typedef struct twEntityCurrentValues {
40  char *name;
41  twDict *props;
43 
44 
45 /***************************************/
46 /* Subscribed Properties Manager */
47 /***************************************/
48 typedef struct twSubscribedPropsMgr {
49  TW_MUTEX mtx;
50  twDict * currentValues;
51  twDict * savedValues;
52  twStream * persistedValues;
53  char fold;
54  twInfoTable * itTemplate;
55  uint32_t queueSize;
56  char * subscribedPropsFile;
58 
59 twSubscribedPropsMgr * twSubscribedPropsMgr_Get();
60 
61 void twSubscribedProperty_Delete(void * prop);
62 
63 int twSubscribedProperty_ToStream (twSubscribedProperty * p, twStream * s);
64 
65 int twSubscribedPropsMgr_Initialize();
66 
67 void twSubscribedPropsMgr_Delete();
68 
69 void twSubscribedPropsMgr_SetFolding(char fold);
70 
71 int twSubscribedPropsMgr_PushSubscribedProperties(char *entityName, char forceConnect, char requiresLock);
72 int twSubscribedPropsMgr_PushSubscribedPropertiesAsync(char *entityName, char forceConnect,
73  response_cb cb,twList** messageListRef);
74 
75 int twSubscribedPropsMgr_SetPropertyVTQ(char * entityName, char * propertyName, twPrimitive * value, DATETIME timestamp, char * quality, char fold, char pushUpdate);
76 int twSubscribedPropsMgr_PurgeCurrentValueForProperty(char * entityName, char * propertyName);
77 int twSubscribedPropsMgr_PurgeCurrentValuesForThing(char *entityName);
78 int twSubscribedPropsMgr_PurgeChangesForProperty(char * entityName, char * propertyName);
79 int twSubscribedPropsMgr_PurgeChangesForThing(char * entityName);
80 int twSubscribedPropsMgr_QueueValueForSending (twSubscribedProperty * propertyToQueue, twDict * propertyListByEntity, char* src);
81 twSubscribedProperty *twSubscribedPropsMgr_getPropertyCurrentValue(char *entityName, char *propertyName);
82 
83 void twSubscribedProperty_Delete(void * prop);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif
Property definitions & metadata functions.
ThingWorx twInfoTable and twDataShape definitions and functions.
#define TW_MUTEX
For Linux builds a TW_MUTEX is a pthread_mutex_t.
Definition: twLinux-openssl.h:81
Dynamically allocated byte array. Automatically expands its length as needed.
Definition: twBaseTypes.h:35
Wrappers for OS-specific functionality.
Linked list structure definition.
Definition: twList.h:59
Definition: twSubscribedProps.h:31
Definition: twSubscribedProps.h:20
Definition: twSubscribedProps.h:48
Portable ThingWorx C SDK API layer.
Definition: twSubscribedProps.h:39
Property base structure.
Definition: twProperties.h:68
Info table base structure.
Definition: twInfoTable.h:418
Structure definitions and function prototypes for the ThingWorx logging facility. ...
BaseType primitive structure.
Definition: twBaseTypes.h:204