CPP Device Virtualization API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E92477-09
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
iotdcl::Data Class Reference

Public Member Functions

virtual ~Data ()
 Destructor.
 
template<typename T >
Dataset (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)
 

Member Function Documentation

template<typename T >
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

"optional" : true

must be set before calling submit().

Parameters
<T>the type of the value.
attributeNamethe name of a field from the custom data format
valuethe value to set
Returns
this Data instance
See Also
VirtualDevice::createData(const std::string &)
Exceptions
std::invalid_argumentif the value is not valid, or attributeName is NULL
virtual void iotdcl::Data::setOnError ( ErrorCallback callback)
virtual

Set a callback that is invoked if an error occurs when submit an.

Data

.

Parameters
callbacka callback to invoke when there is an error setting a value, if NULL, the existing callback will be removed
See Also
AbstractVirtualDevice.setOnError(const std::string &, const ErrorCallback*)
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

"optional" : true

must be set before calling submit(). If submit() is called before setting all

"optional" : true

fields, an std::invalid_argument.

Exceptions
std::invalid_argument

The documentation for this class was generated from the following file: