ThingWorx C SDK
twApiWrapper.h
1 #include "twApi.h"
2 #include "twFileManager.h"
3 #include "stringUtils.h"
4 #ifdef _WIN32
5 #include <ole2.h> /* needed for CoTaskMemAlloc */
6 #endif
7 #ifndef TW_WRAPPER_EXPORTS_H
8 #define TW_WRAPPER_EXPORTS_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef struct twWPropertyRegInfo
15 {
16  char *propertyName;
17  enum BaseType propertyType;
18  char *propertyDescription;
19  char *propertyPushType;
20  double propertyPushThreshold;
22 
23 typedef struct twWServiceRegInfo
24 {
25  char *serviceName;
26  char *serviceDescription;
27  unsigned char *inputDataShapeBytesPtr;
28  int32_t inputDataShapeLength;
29  enum BaseType outputType;
30  unsigned char *outputDataShapeBytesPtr;
31  int32_t outputDataShapeLength;
33 
34 typedef struct twWRegInfoList
35 {
36  int length; // number of elements
37  void *listPtr; // array of twWPropertyRegInfo | twWServiceRegInfo
39 
40 typedef struct twWDataBlock
41 {
42  char isPrimitive;
43  int32_t length;
44  unsigned char *bytesPtr;
45 } twWDataBlock;
46 
47 typedef int(*processPropertyReadRequest_cb)(const char *entityName, const char *propertyName, twWDataBlock **dataBlock, void *userdata);
48 typedef int(*processPropertyWriteRequest_cb)(const char *entityName, const char *propertyName, twWDataBlock *dataBlock, void *userdata);
49 typedef int(*processServiceRequest_cb)(const char *entityName, const char *serviceName, twWDataBlock *paramsBlock, twWDataBlock **contentBlock, void *userdata);
50 typedef void(*fileTransfer_cb)(char fileRcvd, char *sourceRepository, char *sourcePath, char *sourceFile, char *sourceChecksum,
51  char *targetRepository, char *targetPath, char *targetFile, char *targetChecksum, DATETIME startTime,
52  DATETIME endTime, int32_t duration, char *state, char isComplete, double size, char *transferId,
53  char *user, char *message, void *userdata);
54 
55 
56 //********** P R I V A T E S *********//
57 
58 int twW_InitializeThreadPool();
59 void twW_DestroyThreadPool();
60 
61 twPrimitive * twWDataBlock_ToPrimitive(twWDataBlock *block);
62 twInfoTable * twWDataBlock_ToInfoTable(twWDataBlock *block);
63 int twWDataBlock_FromPrimitive(twPrimitive *p, twWDataBlock **outBlock);
64 int twWDataBlock_FromInfoTable(twInfoTable *it, twWDataBlock **outBlock);
65 int twWDataBlock_FromStruct(void *structPtr, char isPrimitive, twWDataBlock **outBlock);
66 void twWDataBlock_Free(twWDataBlock *block);
67 
68 twDataShape * twW_BytesToDataShape(unsigned char *bytesPtr, int32_t length);
69 
70 enum msgCodeEnum twW_PropertyCallbackDispatcher(const char *entityName, const char *propertyName, twInfoTable **value, char isWrite, void *userdata);
71 enum msgCodeEnum twW_ServiceCallbackDispatcher(const char *entityName, const char *serviceName, twInfoTable *params, twInfoTable **content, void *userdata);
72 void twW_FileTransferCallbackDispatcher(char fileRcvd, twFileTransferInfo *info, void *userdata);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
Definition: twApiWrapper.h:34
String utility function prototypes.
Definition: twApiWrapper.h:23
File Transfer Information structure definition.
Definition: twFileManager.h:48
Definition: twApiWrapper.h:14
msgCodeEnum
Enumeration of HTTP message codes.
Definition: twDefinitions.h:74
Portable ThingWorx C SDK API layer.
Data shape base structure definition.
Definition: twInfoTable.h:184
Definition: blast.c:41
Info table base structure.
Definition: twInfoTable.h:418
ThingWorx file transfer structure definitions and functions.
Definition: twApiWrapper.h:40
BaseType
Definition: twDefinitions.h:156
BaseType primitive structure.
Definition: twBaseTypes.h:204