CPP Device Virtualization API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E92477-09
|
Public Member Functions | |
virtual | ~Data () |
Destructor. | |
template<typename T > | |
Data & | set (const std::string &attributeName, const T &value) throw (std::invalid_argument) |
Set the value of a field in the Data. More... | |
void | submit (void) throw (std::invalid_argument) |
Submit the data. More... | |
virtual void | setOnError (ErrorCallback *callback) |
Set a callback that is invoked if an error occurs when submit an. More... | |
Protected Member Functions | |
Data (VirtualDevice *device, iotcs_virtual_device_handle handle, const std::string &dataName) throw (std::invalid_argument) | |
Static Protected Member Functions | |
static void | onErrorCallback (void *handler, iotcs_virtual_device_error_event *event) |
Data& iotdcl::Data::set | ( | const std::string & | attributeName, |
const T & | value | ||
) | |||
throw | ( | std::invalid_argument | |
) |
Set the value of a field in the Data.
The fields are determined by the format given when the Data is created. The value is validated according to the constraints in the format. If the value is not valid, an IllegalArgumentException is raised.
All fields defined in the format that are
must be set before calling submit().
<T> | the type of the value. |
attributeName | the name of a field from the custom data format |
value | the value to set |
std::invalid_argument | if the value is not valid, or attributeName is NULL |
|
virtual |
Set a callback that is invoked if an error occurs when submit an.
.
callback | a callback to invoke when there is an error setting a value, if NULL, the existing callback will be removed |
void iotdcl::Data::submit | ( | void | ) | ||
throw | ( | std::invalid_argument | |||
) |
Submit the data.
The event time is set when this method is called.
The onError handler of the parent virtual device will be called if there is error submiting the custom data fields.
All fields defined in the format that are
must be set before calling submit(). If submit() is called before setting all
fields, an std::invalid_argument.
std::invalid_argument |