ThingWorx C SDK
Classes | Typedefs | Functions
twProperties.h File Reference

Property definitions & metadata functions. More...

#include "twOSPort.h"
#include "twLogger.h"
#include "twBaseTypes.h"
#include "twInfoTable.h"
#include "cJSON.h"

Go to the source code of this file.

Classes

struct  twPropertyDef
 Property definition structure. More...
 
struct  twProperty
 Property base structure. More...
 

Typedefs

typedef struct twPropertyDef twPropertyDef
 Property definition structure.
 
typedef struct twProperty twProperty
 Property base structure.
 

Functions

twPropertyDeftwPropertyDef_Create (char *name, enum BaseType type, char *description, char *pushType, double pushThreshold)
 Creates a new twPropertyDef structure. More...
 
void twPropertyDef_Delete (void *input)
 Frees all memory associated with a twPropertyDef structure and all its owned substructures. More...
 
twPropertytwProperty_Create (char *name, twPrimitive *value, DATETIME timestamp)
 Creates a new twProperty structure. More...
 
twPropertytwPropertyVTQ_Create (char *name, twPrimitive *value, DATETIME timestamp, char *quality)
 Creates a new twProperty structure with an OPC style Quality value. More...
 
twPropertytwProperty_CreateFromStream (twStream *s)
 Creates a new twProperty structure from a :twStream. More...
 
void twProperty_Delete (void *input)
 Frees all memory associated with a twProperty structure and all its owned substructures. More...
 

Detailed Description

Property definitions & metadata functions.

Function Documentation

twProperty* twProperty_Create ( char *  name,
twPrimitive value,
DATETIME  timestamp 
)

Creates a new twProperty structure.

Parameters
[in]nameThe name of the property.
[in]valueA pointer to a twPrimitive containing the value of the property.
[in]timestampTimestamp of the property (defaults to current time).
Returns
A pointer to the structure that is created. Returns NULL on failure.
Note
The newly created structure will gain ownership of the value pointer and is responsible for freeing it.
The default quality value is "GOOD".
The calling function retains ownership of the newly allocated twProperty structure and is responsible for freeing it via twProperty_Delete().
twProperty* twProperty_CreateFromStream ( twStream s)

Creates a new twProperty structure from a :twStream.

Parameters
[in]sPointer to the stream to read from
Returns
A pointer to the structure that is created. Returns NULL on failure.
void twProperty_Delete ( void *  input)

Frees all memory associated with a twProperty structure and all its owned substructures.

Parameters
[in]inputA pointer to the twProperty structure to be deleted.
Returns
Nothing.
twPropertyDef* twPropertyDef_Create ( char *  name,
enum BaseType  type,
char *  description,
char *  pushType,
double  pushThreshold 
)

Creates a new twPropertyDef structure.

Parameters
[in]nameThe name of the property.
[in]typeThe BaseType of the property.
[in]descriptionA description of the property.
[in]pushTypeThe push type of the property. Can be set to #NEVER, #ALWAYS, or #VALUE (on change).
[in]pushThresholdThe amount the property has to change (if the type is TW_NUMBER or TW_INTEGER) before pushing the new value.
Returns
A pointer to the structure that is created. Returns NULL on failure.
Note
The calling function will gain ownership of the newly allocated twPropertyDef structure and is responsible for freeing it via twPropertyDef_Delete().
void twPropertyDef_Delete ( void *  input)

Frees all memory associated with a twPropertyDef structure and all its owned substructures.

Parameters
[in]inputA pointer to the twPropertyDef structure to be deleted.
Returns
Nothing.
twProperty* twPropertyVTQ_Create ( char *  name,
twPrimitive value,
DATETIME  timestamp,
char *  quality 
)

Creates a new twProperty structure with an OPC style Quality value.

Parameters
[in]nameThe name of the property.
[in]valueA pointer to a twPrimitive containing the value of the property.
[in]timestampTimestamp of the property (defaults to current time).
[in]qualtiyThe OPC style quality of the value(defaults to "GOOD").
Returns
A pointer to the structure that is created. Returns NULL on failure.
Note
The newly created structure will gain ownership of the value pointer and is responsible for freeing it.
The calling function retains ownership of the newly allocated twProperty structure and is responsible for freeing it via twProperty_Delete().