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 | |
template<typename T > | |
VirtualDevice & | set (const std::string &attributeName, const T &value) throw (std::invalid_argument) |
Set the value of an attribute. More... | |
template<typename T > | |
VirtualDevice & | offer (const std::string &attributeName, const T &value) throw (std::invalid_argument) |
Offer to set the value of an attribute. More... | |
VirtualDevice & | set (const std::string &attributeName, StorageObject *value) throw (std::invalid_argument) |
Set the value of an StorageObject attribute. More... | |
template<typename T > | |
T | get (const std::string &attributeName) |
Get the value of an attribute. More... | |
virtual Alert & | createAlert (const std::string &format)=0 |
Create an iotdcl::Alert for this VirtualDevice. More... | |
virtual Data & | createData (const std::string &format)=0 |
Create a custom iotdcl::Data object for this VirtualDevice. More... | |
virtual void | setOnAction (const std::string &actionName, const ActionCallback *callback)=0 |
Set a callback that is invoked when an action for the given name is received. More... | |
virtual void | setOnAction (const ActionCallback *callback)=0 |
Set a callback that is invoked when any action in the device model is received. More... | |
DEPRECATED (virtual void setCallable(const std::string &actionName, const Callable *callback),"This API does not support actions with multiple arguments. Use setOnAction(std::string, iotdcl::ActionCallback)") | |
Set callback for handling an action. More... | |
Public Member Functions inherited from iotdcl::AbstractVirtualDevice< VirtualDevice > | |
virtual | ~AbstractVirtualDevice () |
Destructor. | |
virtual const DeviceModel & | getDeviceModel ()=0 |
Get the device model of this device object. More... | |
virtual const std::string & | getEndpointId () const =0 |
Get the endpoint id of the device. More... | |
VirtualDevice & | set (const std::string &attributeName, T &value) |
Set the value of an attribute. More... | |
T | get (const std::string &attributeName) |
Get the value of an attribute. More... | |
virtual VirtualDevice & | update (void)=0 |
Set a mark for beginning an update transaction. More... | |
virtual void | finish (void)=0 |
Causes the values set in an update transaction to be sent to the server and clears the update-transaction mark. More... | |
virtual void | setOnChange (const ChangeCallback *callback)=0 |
Set a callback that is invoked when the value of any attribute in the device model is changed from the outside. More... | |
virtual void | setOnChange (const std::string &attributeName, const ChangeCallback *callback)=0 |
Set a callback that is invoked when the value of the given attribute in the device model is changed from the outside. More... | |
virtual void | setOnError (const ErrorCallback *callback)=0 |
Set a callback that is invoked if an error occurs when setting the value of any attribute in the device model, or an error occurs when raising an. More... | |
virtual void | setOnError (const std::string &attributeName, const ErrorCallback *callback)=0 |
Set a callback that is invoked if an error occurs when setting the value of any attribute in the device model or an error occurs when raising an. More... | |
Protected Attributes | |
iotcs_virtual_device_handle | handle |
std::vector< StorageObject * > | eo_list |
|
pure virtual |
Create an iotdcl::Alert for this VirtualDevice.
The alert will be created with the given format URN.
format | the alert format URN. |
|
pure virtual |
Create a custom iotdcl::Data object for this VirtualDevice.
The custom iotdcl::Data object will be created with the given format URN.
format | the custom data message format URN. |
iotdcl::VirtualDevice::DEPRECATED | ( | virtual void | setCallableconst std::string &actionName, const Callable *callback, |
"This API does not support actions with multiple arguments. Use setOnAction(std::string, iotdcl::ActionCallback)" | |||
) |
Set callback for handling an action.
actionName | The action name |
callable | The interface to invoke |
T iotdcl::VirtualDevice::get | ( | const std::string & | attributeName | ) |
Get the value of an attribute.
This method returns the current value held by the virtual device model. For an enterprise client, no REST API call is made to the server. For a device client, no call is made to the physical device.
attributeName | the name of an attribute from the device type model |
VirtualDevice& iotdcl::VirtualDevice::offer | ( | const std::string & | attributeName, |
const T & | value | ||
) | |||
throw | ( | std::invalid_argument | |
) |
Offer to set the value of an attribute.
The attribute value is set depending upon any policy that may have been configured for the attribute. If there is no policy for the given attribute, offer behaves as if the VirtualDevice::set() method were called. The value is validated according to the constraints in the device model.
attributeName | the name of an attribute from the device type model |
value | the value to set |
std::invalid_argument | if the value is not valid, or attributeName is NULL |
VirtualDevice& iotdcl::VirtualDevice::set | ( | const std::string & | attributeName, |
const T & | value | ||
) | |||
throw | ( | std::invalid_argument | |
) |
Set the value of an attribute.
This method is used by the application to synchronize the #AbstractVirtualDevice state with the physical device. This results in a REST API call to the server. For an enterprise client, an endpoint resource REST API call is made to the server. For a device client, an endpoint DATA message REST API call is made to the server. The value is validated according to the constraints in the device model.
attributeName | the name of an attribute from the device type model |
value | the value to set |
std::invalid_argument | if the value is not valid, or attributeName is NULL |
VirtualDevice& iotdcl::VirtualDevice::set | ( | const std::string & | attributeName, |
StorageObject * | value | ||
) | |||
throw | ( | std::invalid_argument | |
) |
Set the value of an StorageObject attribute.
This method is used by the application to synchronize the #AbstractVirtualDevice state with the physical device. This results in a REST API call to the server. For an enterprise client, an endpoint resource REST API call is made to the server. For a device client, an endpoint DATA message REST API call is made to the server. The value is validated according to the constraints in the device model.
attributeName | the name of an attribute from the device type model |
value | StorageObject value to set |
std::invalid_argument | if the value is not valid, or attributeName is NULL |
|
pure virtual |
Set a callback that is invoked when an action for the given name is received.
Note that it is possible to set a callback for a specific action and to set a callback for all actions via setOnAction(iotdcl::ActionCallback). If there is a callback for the specific action and for all actions, both callbacks will be invoked, with the specific action invoked first.
actionName | The action name from the device model |
callback | a callback to invoke when an action is received, if null
|
|
pure virtual |
Set a callback that is invoked when any action in the device model is received.
Note that it is possible to set a callback for a specific action via setOnAction(std::string, iotdcl::ActionCallback). If there is a callback for the specific action and for all actions, both callbacks will be invoked, wiht the specific action invoked first.
callback | a callback to invoke when an action is received, if null
|