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::Alert Class Reference

Public Member Functions

virtual ~Alert ()
 Destructor.
 
template<typename T >
Alertset (const std::string &attributeName, const T &value) throw (std::invalid_argument)
 Set the value of a field in the. More...
 
void raise (void) throw (std::invalid_argument)
 Send the alert. More...
 
virtual void setOnError (ErrorCallback *callback)
 Set a callback that is invoked if an error occurs when raising an. More...
 

Protected Member Functions

 Alert (VirtualDevice *device, iotcs_virtual_device_handle handler, const std::string &alertName) throw (std::invalid_argument)
 

Static Protected Member Functions

static void onErrorCallback (void *handler, iotcs_virtual_device_error_event *event)
 

Member Function Documentation

void iotdcl::Alert::raise ( void  )
throw (std::invalid_argument
)

Send the alert.

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 sending the alert ***exception is thrown.

All fields defined in the format that are

"optional" : true

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

"optional" : true

fields, an std::invalid_argument.

Exceptions
std::invalid_argument
template<typename T >
Alert& iotdcl::Alert::set ( const std::string &  attributeName,
const T &  value 
)
throw (std::invalid_argument
)

Set the value of a field in the.

Alert

. The fields are determined by the format given when the Alert 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 raise().

Parameters
<T>the type of the value.
attributeNamethe name of a field from the alert format
valuethe value to set
Returns
this Alert instance
See Also
VirtualDevice::createAlert(String)
Exceptions
std::invalid_argumentif the value is not valid, or attributeName is NULL
virtual void iotdcl::Alert::setOnError ( ErrorCallback callback)
virtual

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

Alert

.

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*)

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