Sending String Data to Device Cloud in C
A client application on the device can send string data to Device Cloud using the attribute APIs.
String data appears as attributes under the Attributes tab on the thing details page. Click the View icon of an attribute to see the historical values published from the application. For more information about viewing attributes, see Device Cloud Management Portal User's Guide: Viewing and Updating the Attributes of a Thing.
In the options parameter of the API, you can specify additional, optional information, including the following:
-
maximum time to wait for the publish operation to complete
-
timestamp of the attribute
-
whether to publish the attribute value even if the value has not changed since the attribute was published previously
The function parameter txn is for future use.
You must have initialized your application (see Initializing Your C Application).
The thing definition that corresponds to your application must have the attributes defined, or the thing definition must have Auto def attributes selected. For more information about defining attributes, see Device Cloud Management Portal User's Guide: Defining Attributes.
To send data to Device Cloud, your application must be connected to Device Cloud.
When you no longer need to send the data, call the iot_options_free function, if applicable, to free the associated memory.