ThingWorx C SDK
|
Macros | |
#define | TW_DECLARE_SERVICE(serviceName, description, inputShape, outputType, outputShape, serviceHandler) twExt_RegisterNamespacedService(_tw_thing_name, serviceName, _tw_thing_namespace , description, inputShape, outputType, outputShape, serviceHandler, NULL) |
Defines a service name on your Thing, specifies its input and return parameters and maps it to en existing C function. More... | |
#define | TW_SERVICE(serviceName, description, inputShape, outputType, outputShape, serviceHandler) twExt_RegisterNamespacedService(_tw_thing_name, serviceName, _tw_thing_namespace , description, inputShape, outputType, outputShape, serviceHandler, NULL) |
A shorter version of TW_DECLARE_SERVICE. Defines a service name on your Thing, specifies its input and return parameters and maps it to en existing C function. More... | |
#define | TW_GET_STRING_PARAM(params, paramName) twInfoTable_GetString(params, #paramName, 0, ¶mName); |
A utility macro that can be used to extract a String parameter from the first row of an InfoTable. It is intended to be used inside Service handlers to extract input parameters that are assumed to be Strings from the input InfoTable. More... | |
#define | TW_GET_NUMBER_PARAM(params, paramName) twInfoTable_GetNumber(params, #paramName, 0, ¶mName); |
A utility macro that can be used to extract a double/Number parameter from the first row of an InfoTable. It is intended to be used inside Service handlers to extract input parameters that are assumed to be Numbers from the input InfoTable. More... | |
#define TW_DECLARE_SERVICE | ( | serviceName, | |
description, | |||
inputShape, | |||
outputType, | |||
outputShape, | |||
serviceHandler | |||
) | twExt_RegisterNamespacedService(_tw_thing_name, serviceName, _tw_thing_namespace , description, inputShape, outputType, outputShape, serviceHandler, NULL) |
Defines a service name on your Thing, specifies its input and return parameters and maps it to en existing C function.
serviceName | const char * [in] The name of the DataShape to create. DataShape names are optional and the constant TW_SHAPE_NAME_NONE can be used if no name is required. |
description | A text description of the purpose of this service. If no description is required use TW_NO_DESCRIPTION |
inputShape | twDataShape* [in] A DataShape created using the macro TW_MAKE_DATASHAPE that represents the input parameters of your Service. |
outputType | twPrimitive * [in] A ThingWorx primitive type representing the return type for your Service. Use one of the enum BaseType values. Examples are {TW_STRING,TW_NUMBER,TW_BOOLEAN,TW_INFOTABLE} |
outputShape | twDataShape* [in] A DataShapeEntry created using the macro TW_MAKE_DATASHAPE that should only be used if outputType is TW_INFOTABLE to define the DataShape to be used by the returned InfoTable. If outputType is anything other than TW_INFOTABLE this parameter should be TW_NO_RETURN_DATASHAPE. |
serviceHandler | service_cb [in] A pointer to a C function of type service_cb. Example: enum msgCodeEnum myServiceFunction(const char * entityName, const char * serviceName, twInfoTable * params, twInfoTable ** content, void * userdata); |
#define TW_GET_NUMBER_PARAM | ( | params, | |
paramName | |||
) | twInfoTable_GetNumber(params, #paramName, 0, ¶mName); |
A utility macro that can be used to extract a double/Number parameter from the first row of an InfoTable. It is intended to be used inside Service handlers to extract input parameters that are assumed to be Numbers from the input InfoTable.
params | twInfoTable* An InfoTable passed into a Service handler function containing its input parameters. |
paramName | const char * [in] The name of the parameter to extract from the first row of the params InfoTable. |
#define TW_GET_STRING_PARAM | ( | params, | |
paramName | |||
) | twInfoTable_GetString(params, #paramName, 0, ¶mName); |
A utility macro that can be used to extract a String parameter from the first row of an InfoTable. It is intended to be used inside Service handlers to extract input parameters that are assumed to be Strings from the input InfoTable.
params | twInfoTable* An infotable passed into a Service handler function containing its input parameters. |
paramName | const char * [in] The name of the parameter to extract from the first row of the params InfoTable. |
#define TW_SERVICE | ( | serviceName, | |
description, | |||
inputShape, | |||
outputType, | |||
outputShape, | |||
serviceHandler | |||
) | twExt_RegisterNamespacedService(_tw_thing_name, serviceName, _tw_thing_namespace , description, inputShape, outputType, outputShape, serviceHandler, NULL) |
A shorter version of TW_DECLARE_SERVICE. Defines a service name on your Thing, specifies its input and return parameters and maps it to en existing C function.
serviceName | const char * [in] The name of the DataShape to create. DataShape names are optional and the constant TW_SHAPE_NAME_NONE can be used if no name is required. |
description | A text description of the purpose of this service. If no description is required use TW_NO_DESCRIPTION |
inputShape | twDataShape* [in] A DataShape created using the macro TW_MAKE_DATASHAPE that represents the input parameters of your Service. |
outputType | twPrimitive * [in] A ThingWorx primitive type representing the return type for your Service. Use one of the enum BaseType values. Examples are {TW_STRING,TW_NUMBER,TW_BOOLEAN,TW_INFOTABLE} |
outputShape | twDataShape* [in] A DataShapeEntry created using the macro TW_MAKE_DATASHAPE that should only be used if outputType is TW_INFOTABLE to define the DataShape to be used by the returned InfoTable. If outputType is anything other than TW_INFOTABLE this parameter should be TW_NO_RETURN_DATASHAPE. |
serviceHandler | service_cb [in] A pointer to a C function of type service_cb. Example: enum msgCodeEnum myServiceFunction(const char * entityName, const char * serviceName, twInfoTable * params, twInfoTable ** content, void * userdata); |