41 #if (OFFLINE_MSG_STORE == 2)
163 #if (OFFLINE_MSG_STORE == 2)
171 twStream * twStream_CreateFromFile(
const char * fname);
192 void swap4bytes(
char * bytes);
193 void swap8bytes(
char * bytes);
194 int stringToStream(
char *
string,
twStream * s);
195 char * streamToString(
twStream * s);
196 enum BaseType baseTypeFromString(
const char * s);
197 const char * baseTypeToString(
enum BaseType b);
struct twPrimitive twPrimitive
BaseType primitive structure.
twPrimitive * twPrimitive_FullCopy(twPrimitive *p)
Creates a new twPrimitive structure and copies all data from an existing twPrimitive structure to the...
Definition: twBaseTypes.c:900
twPrimitive * twPrimitive_CreateFromJson(struct cJSON *j, char *name, enum BaseType type)
Helper function to convert a cJSON object to a twPrimitive.
Definition: twBaseTypes.c:1168
struct twLocation twLocation
Location primitive structure.
struct cJSON * twPrimitive_ToJson(char *name, twPrimitive *p, struct cJSON *parent)
Helper function to convert a twPrimitive to a CJSON object.
Definition: twBaseTypes.c:1319
int32_t integer
Definition: twBaseTypes.h:212
struct twPrimitive * variant
Definition: twBaseTypes.h:222
twPrimitive * twPrimitive_CreateVariant(twPrimitive *input)
Helper function to create a twPrimitive of type TW_VARIANT from a twPrimitive structure.
Definition: twBaseTypes.c:1138
twLocation location
Definition: twBaseTypes.h:215
double number
Definition: twBaseTypes.h:213
struct twStream twStream
Dynamically allocated byte array. Automatically expands its length as needed.
double latitude
Definition: twBaseTypes.h:182
twStream * twStream_Create()
Creates a new twStream structure.
Definition: twBaseTypes.c:259
char * data
Definition: twBaseTypes.h:36
twPrimitive * twPrimitive_CreateFromNumber(const double value)
Helper function to create a twPrimitive of type TW_NUMBER from a double.
Definition: twBaseTypes.c:1104
uint32_t length
Definition: twBaseTypes.h:210
int twStream_GetBytes(struct twStream *s, void *b, uint32_t count)
Copies count bytes of data from the twStream::data of a twStream into buf.
Definition: twBaseTypes.c:410
twPrimitive * twPrimitive_CreateFromStreamTyped(twStream *s, enum BaseType type)
Allocates a new twPrimitive structure of a specified type and populates it with data from a twStream...
Definition: twBaseTypes.c:469
char * ptr
Definition: twBaseTypes.h:37
int twStream_Reset(struct twStream *s)
Resets the position pointer of a twStream (twStream::ptr) to the beginning of that twStream's data (t...
Definition: twBaseTypes.c:432
Dynamically allocated byte array. Automatically expands its length as needed.
Definition: twBaseTypes.h:35
twStream * twStream_CreateFromCharArrayZeroCopy(const char *data, uint32_t length)
Allocates a new twStream structure and points twStream::data to an existing char array.
Definition: twBaseTypes.c:321
char * twStream_GetData(struct twStream *s)
Gets a pointer to the twStream::data of a twStream.
Definition: twBaseTypes.c:353
Wrappers for OS-specific functionality.
double longitude
Definition: twBaseTypes.h:183
twPrimitive * twPrimitive_ZeroCopy(twPrimitive *p)
Creates a new twPrimitive structure which inherits all pointers of an existing twPrimitive structure ...
Definition: twBaseTypes.c:887
char boolean
Definition: twBaseTypes.h:216
int twPrimitive_ToStream(twPrimitive *p, twStream *s)
Copies the data from a twPrimitive structure to a twStream structure.
Definition: twBaseTypes.c:662
char twPrimitive_IsTrue(twPrimitive *p1)
Compares a twPrimitive to "true". For booleans true is if the value is "true", for numeric and dattim...
Definition: twBaseTypes.c:827
int twStream_AddBytes(struct twStream *s, void *b, uint32_t count)
Adds data bytes to a twStream.
Definition: twBaseTypes.c:368
twPrimitive * twPrimitive_CreateFromLocation(const twLocation *value)
Helper function to create a twPrimitive of type TW_LOCATION from a location structure.
Definition: twBaseTypes.c:1112
char * twPrimitive_DecoupleStringAndDelete(twPrimitive *p)
Helper function to return the value of a TW_STRING family type, remove it from the twPrimitive p...
Definition: twBaseTypes.c:1150
twPrimitive * twPrimitive_CreateFromString(const char *value, char duplicate)
Helper function to create a twPrimitive of type TW_STRING from a null-terminated char array...
Definition: twBaseTypes.c:1100
twPrimitive * twPrimitive_CreateFromCurrentTime()
Helper function to create a twPrimitive of type TW_DATETIME from the current time.
Definition: twBaseTypes.c:1125
int32_t twStream_GetIndex(struct twStream *s)
Gets the ::twStream#index of a twStream.
Definition: twBaseTypes.c:358
Default settings for ThingWorx C SDK.
int twPrimitive_Compare(twPrimitive *p1, twPrimitive *p2)
Compares two twPrimitive structures for equivalence.
Definition: twBaseTypes.c:752
enum BaseType typeFamily
Definition: twBaseTypes.h:209
DATETIME datetime
Definition: twBaseTypes.h:214
Common definitions for C SDK.
twPrimitive * twPrimitive_CreateFromBoolean(const char value)
Helper function to create a twPrimitive of type TW_BOOLEAN from a char type.
Definition: twBaseTypes.c:1130
void twPrimitive_Delete(void *p)
Frees all memory associated with a twPrimitive and all of its owned substructures.
Definition: twBaseTypes.c:636
struct twInfoTable * infotable
Definition: twBaseTypes.h:221
twPrimitive * twPrimitive_Create()
Creates a new twPrimitive structure.
Definition: twBaseTypes.c:448
twPrimitive * twPrimitive_CreateFromDatetime(const DATETIME value)
Helper function to create a twPrimitive of type TW_DATETIME from a DATETIME type. ...
Definition: twBaseTypes.c:1121
union twPrimitive::@0 val
twPrimitive * twPrimitive_CreateFromVariable(const void *value, enum BaseType type, char duplicateCharArray, uint32_t blobLength)
Helper function to create a twPrimitive of any type from a void *.
Definition: twBaseTypes.c:949
Info table base structure.
Definition: twInfoTable.h:418
double elevation
Definition: twBaseTypes.h:184
twPrimitive * twPrimitive_CreateFromStream(twStream *s)
Creates a new twPrimitive structure and populates it with data from a twStream.
Definition: twBaseTypes.c:458
twPrimitive * twPrimitive_CreateFromBlob(const char *value, int32_t length, char isImage, char duplicate)
Helper function to create a twPrimitive of type TW_BLOB or TW_IMAGE from a char array.
Definition: twBaseTypes.c:1116
uint32_t length
Definition: twBaseTypes.h:38
char ownsData
Definition: twBaseTypes.h:40
int32_t twStream_GetLength(struct twStream *s)
Gets the twStream::length of a twStream.
Definition: twBaseTypes.c:363
twPrimitive * twPrimitive_CreateFromInfoTable(struct twInfoTable *it)
Helper function to create a twPrimitive of type TW_INFOTABLE from a twInfoTable structure.
Definition: twBaseTypes.c:1134
Location primitive structure.
Definition: twBaseTypes.h:181
twPrimitive * twPrimitive_CreateFromInteger(const int32_t value)
Helper function to create a twPrimitive of type TW_INTEGER from an integral type (int, short, char).
Definition: twBaseTypes.c:1108
enum BaseType type
Definition: twBaseTypes.h:208
int32_t len
Definition: twBaseTypes.h:219
void twStream_Delete(void *s)
Frees all memory associated with a twStream and all of its owned substructures.
Definition: twBaseTypes.c:340
BaseType
Definition: twDefinitions.h:155
BaseType primitive structure.
Definition: twBaseTypes.h:207
char * data
Definition: twBaseTypes.h:218
uint32_t maxlength
Definition: twBaseTypes.h:39
twStream * twStream_CreateFromCharArray(const char *data, uint32_t length)
Creates a new twStream structure and copies the data from a char array to the new structure's twStrea...
Definition: twBaseTypes.c:297