C Device Virtualization API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E70343-26
iotcs_virtual_device.h File Reference

The file defines the iot cs device model APIs. More...

#include "iotcs.h"
#include "advanced/iotcs_message.h"

Go to the source code of this file.

Structures

struct  iotcs_named_value_t
 Change event. More...
struct  iotcs_virtual_device_change_event_t
 Change event. More...
struct  iotcs_virtual_device_error_event_t
 Change event. More...

Typedefs

typedef struct
iotcs_virtual_device_handle_t * 
iotcs_virtual_device_handle
 Device Handle.
typedef struct iotcs_named_value_t iotcs_named_value
 Typedef for iotcs_named_value_t structure.
typedef struct
iotcs_virtual_device_change_event_t 
iotcs_virtual_device_change_event
 Typedef for iotcs_virtual_device_change_event_t structure.
typedef struct
iotcs_virtual_device_error_event_t 
iotcs_virtual_device_error_event
 Typedef for iotcs_virtual_device_error_event_t structure.
typedef void(* iotcs_virtual_device_changed_callback )(iotcs_virtual_device_change_event *event)
 Callback invoked in case of attribute value change.
typedef void(* iotcs_action_callback )(iotcs_virtual_device_handle virtual_device_handle, iotcs_typed_value argument)
 Callback invoked in case of action request.
typedef void(* iotcs_virtual_device_on_action_callback )(iotcs_virtual_device_handle device_handle, char *action, iotcs_named_value *argument)
 Callback invoked in case of action request.
typedef void(* iotcs_virtual_device_error_callback )(iotcs_virtual_device_error_event *event)
 Callback invoked in case of network error in attribute update process.
typedef struct
iotcs_device_model_handle_t * 
iotcs_device_model_handle
 Device Model Handle.
typedef struct
iotcs_alert_handle_t * 
iotcs_alert_handle
 Pointer to Device Alert Handle.
typedef struct
iotcs_data_handle_t * 
iotcs_data_handle
 Pointer to Device Data Handle.

Functions

iotcs_result iotcs_get_device_model (const char *device_model, iotcs_device_model_handle *device_model_handle)
 Get device model handle for a given name.
const char * iotcs_get_device_model_name (iotcs_device_model_handle device_model_handle)
 Get device model name.
const char * iotcs_get_device_model_description (iotcs_device_model_handle device_model_handle)
 Get device model description.
const char * iotcs_get_device_model_urn (iotcs_device_model_handle device_model_handle)
 Get device model urn.
void iotcs_free_device_model (iotcs_device_model_handle device_model_handle)
 Release Device Handle.
iotcs_result iotcs_create_virtual_device_handle (const char *endpoint_id, iotcs_device_model_handle device_model_handle, iotcs_virtual_device_handle *virtual_device_handle)
 Get Device Handle.
void iotcs_free_virtual_device_handle (iotcs_virtual_device_handle virtual_device_handle)
 Release Device Handle.
iotcs_result iotcs_virtual_device_set (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, const void *value, size_t length)
 Set value of Device Attribute.
iotcs_result iotcs_virtual_device_offer_boolean (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_bool value)
 Offer to set the value of an attribute.
iotcs_result iotcs_virtual_device_offer_integer (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, int value)
 Offer to set the value of an attribute.
iotcs_result iotcs_virtual_device_offer_float (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, float value)
 Offer to set the value of an attribute.
iotcs_result iotcs_virtual_device_offer_date_time (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_date_time value)
 Offer to set the value of an attribute.
iotcs_result iotcs_virtual_device_get_string (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, const char **value)
 Get STRING value of Device Attribute.
iotcs_result iotcs_virtual_device_set_string (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, const char *value)
 Set STRING value of Device Attribute.
iotcs_result iotcs_virtual_device_get_integer (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, int *value)
 Get INTEGER value of Device Attribute.
iotcs_result iotcs_virtual_device_set_integer (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, int value)
 Set INTEGER value of Device Attribute.
iotcs_result iotcs_virtual_device_get_float (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, float *value)
 Get NUMBER value of Device Attribute.
iotcs_result iotcs_virtual_device_set_float (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, float value)
 Set NUMBER value of Device Attribute.
iotcs_result iotcs_virtual_device_get_boolean (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_bool *value)
 Get BOOLEAN value of Device Attribute.
iotcs_result iotcs_virtual_device_set_boolean (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_bool value)
 Set BOOLEAN value of Device Attribute.
iotcs_result iotcs_virtual_device_get_date_time (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_date_time *value)
 Get DATETIME value of Device Attribute.
iotcs_result iotcs_virtual_device_set_date_time (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_date_time value)
 Set DATETIME value of Device Attribute.
void iotcs_virtual_device_set_on_change (iotcs_virtual_device_handle virtual_device_handle, iotcs_virtual_device_changed_callback callback)
 Set callback for every external change of Device Attributes.
iotcs_result iotcs_virtual_device_attribute_set_on_change (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_virtual_device_changed_callback callback)
 Set callback for every external change of particular Device Attribute.
void iotcs_virtual_device_set_on_error (iotcs_virtual_device_handle virtual_device_handle, iotcs_virtual_device_error_callback callback)
 Set callback for network failure of Device Attribute change notification.
iotcs_result iotcs_virtual_device_attribute_set_on_error (iotcs_virtual_device_handle virtual_device_handle, const char *attribute_name, iotcs_virtual_device_error_callback callback)
 Set callback for network failure of particular Device Attribute change notification.
iotcs_result iotcs_virtual_device_set_callback (iotcs_virtual_device_handle virtual_device_handle, const char *action_name, iotcs_action_callback callback)
 Set callback for given action.
iotcs_result iotcs_virtual_device_set_on_action_callback (iotcs_virtual_device_handle virtual_device_handle, const char *action_name, iotcs_virtual_device_on_action_callback callback)
 Set callback for given action.
iotcs_result iotcs_virtual_device_set_global_on_action_callback (iotcs_virtual_device_handle virtual_device_handle, iotcs_virtual_device_on_action_callback callback)
 Set callback for all actions.
void iotcs_virtual_device_start_update (iotcs_virtual_device_handle virtual_device_handle)
 Suspend background network notifications of changed attribute values.
void iotcs_virtual_device_finish_update (iotcs_virtual_device_handle virtual_device_handle)
 Resume background network notifications of changed attribute values.
iotcs_result iotcs_virtual_device_create_alert_handle (iotcs_virtual_device_handle virtual_device_handle, const char *alert_name, iotcs_alert_handle *alert_handle)
 Get Device Alert Handle.
void iotcs_virtual_device_free_alert_handle (iotcs_alert_handle alert_handle)
 Release Device Alert Handle.
iotcs_result iotcs_alert_raise (iotcs_alert_handle alert_handle)
 Send Alert asynchronously.

Detailed Description

The file defines the iot cs device model APIs.


Typedef Documentation

typedef void(* iotcs_action_callback)(iotcs_virtual_device_handle virtual_device_handle, iotcs_typed_value argument)

Callback invoked in case of action request.

Parameters:
virtual_device_handleThe device for which this action has been invoked
namename of action
argumentargument value together with its type

Callback invoked in case of attribute value change.

Parameters:
eventdescribes attribute together with old and new values

Callback invoked in case of network error in attribute update process.

Note:
The implementation of callback should not call iotcs_alert_raise, #iotcs_data_submit and #iotcs_virtual_device_setXXX procedures to avoid a possible deadlock on outgoing message queue.
Parameters:
eventdescribes attribute together with old and new values
typedef void(* iotcs_virtual_device_on_action_callback)(iotcs_virtual_device_handle device_handle, char *action, iotcs_named_value *argument)

Callback invoked in case of action request.

Parameters:
argumentcontains arguments and virtual device

Function Documentation

iotcs_result iotcs_alert_raise ( iotcs_alert_handle  alert_handle)

Send Alert asynchronously.

Note:
This procedure should not be called from iotcs_virtual_device_error_callback implementation due to the possible deadlock on outgoing message queue.
Parameters:
alert_handleAlert handle
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif alert_handle is NULL.
IOTCS_RESULT_OUT_OF_MEMORYif no additional memory can be allocated for use..
IOTCS_RESULT_OKif succeeds. Operation could be retried at a later time.
IOTCS_RESULT_FAILno new values or not all non-optional values were set since the last iotcs_alert_raise invocation.
iotcs_result iotcs_create_virtual_device_handle ( const char *  endpoint_id,
iotcs_device_model_handle  device_model_handle,
iotcs_virtual_device_handle virtual_device_handle 
)

Get Device Handle.

Parameters:
endpoint_idendpoint id
device_model_handleDevice model handle
virtual_device_handleaddress of Device handle
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif endpoint_id or device_model_handle are NULL.
IOTCS_RESULT_OUT_OF_MEMORYif no additional memory can be allocated for use.
IOTCS_RESULT_OKif succeeds.
IOTCS_RESULT_FAILotherwise.
void iotcs_free_device_model ( iotcs_device_model_handle  device_model_handle)

Release Device Handle.

Parameters:
device_model_handleDevice Handle to release
void iotcs_free_virtual_device_handle ( iotcs_virtual_device_handle  virtual_device_handle)

Release Device Handle.

Parameters:
virtual_device_handleDevice Handle to release
iotcs_result iotcs_get_device_model ( const char *  device_model,
iotcs_device_model_handle device_model_handle 
)

Get device model handle for a given name.

Parameters:
device_modeldevice model URN
device_model_handleaddress of Device Model Handle
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif device model urn is NULL.
IOTCS_RESULT_FAILif there are no device models with current urn on the server or returned device model is incorrect.
IOTCS_RESULT_OKif succeeds.
const char* iotcs_get_device_model_description ( iotcs_device_model_handle  device_model_handle)

Get device model description.

Parameters:
device_model_handleaddress of Device Model Handle
Return values:
devicemodel description
const char* iotcs_get_device_model_name ( iotcs_device_model_handle  device_model_handle)

Get device model name.

Parameters:
device_model_handleaddress of Device Model Handle
Return values:
devicemodel name
const char* iotcs_get_device_model_urn ( iotcs_device_model_handle  device_model_handle)

Get device model urn.

Parameters:
device_model_handleaddress of Device Model Handle
Return values:
devicemodel urn
iotcs_result iotcs_virtual_device_attribute_set_on_change ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_virtual_device_changed_callback  callback 
)

Set callback for every external change of particular Device Attribute.

Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
callbackcallback to call
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_attribute_set_on_error ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_virtual_device_error_callback  callback 
)

Set callback for network failure of particular Device Attribute change notification.

Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
callbackcallback to call
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_create_alert_handle ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  alert_name,
iotcs_alert_handle alert_handle 
)

Get Device Alert Handle.

Parameters:
virtual_device_handleDevice Handle
alert_nameName of the alert
alert_handleaddress of Device Alert Handle
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or alert_name are NULL.
IOTCS_RESULT_OUT_OF_MEMORYif no additional memory can be allocated for use.
IOTCS_RESULT_OKif succeeds.
IOTCS_RESULT_FAILotherwise.
void iotcs_virtual_device_finish_update ( iotcs_virtual_device_handle  virtual_device_handle)

Resume background network notifications of changed attribute values.

Parameters:
virtual_device_handleDevice Handle
void iotcs_virtual_device_free_alert_handle ( iotcs_alert_handle  alert_handle)

Release Device Alert Handle.

Parameters:
alert_handleDevice Alert Handle to release
iotcs_result iotcs_virtual_device_get_boolean ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_bool value 
)

Get BOOLEAN value of Device Attribute.

Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valueaddress of value to return
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_FAILif an attribute value wasn't set before and there is no default value.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_get_date_time ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_date_time value 
)

Get DATETIME value of Device Attribute.

Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valueaddress of value to return
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_FAILif an attribute value wasn't set before and there is no default value.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_get_float ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
float *  value 
)

Get NUMBER value of Device Attribute.

Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valueaddress of value to return
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_FAILif an attribute value wasn't set before and there is no default value.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_get_integer ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
int *  value 
)

Get INTEGER value of Device Attribute.

Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valueaddress of value to return
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_FAILif an attribute value wasn't set before and there is no default value.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_get_string ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
const char **  value 
)

Get STRING value of Device Attribute.

Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valueaddress of pointer to null-terminated string. The string will be allocated by the library and use must release it by calling free(ptr)
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_FAILif an attribute value wasn't set before and there is no default value.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_offer_boolean ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_bool  value 
)

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 iotcs_virtual_device_set method were called. The value is validated according to the constraints in the device model.

Parameters:
virtual_device_handleDevice Handle
attribute_namethe name of an attribute from the device type model
valuethe value to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTIf the value is not valid
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_offer_date_time ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_date_time  value 
)

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 iotcs_virtual_device_set method were called. The value is validated according to the constraints in the device model.

Parameters:
virtual_device_handleDevice Handle
attribute_namethe name of an attribute from the device type model
valuethe value to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTIf the value is not valid
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_offer_float ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
float  value 
)

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 iotcs_virtual_device_set method were called. The value is validated according to the constraints in the device model.

Parameters:
virtual_device_handleDevice Handle
attribute_namethe name of an attribute from the device type model
valuethe value to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTIf the value is not valid
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_offer_integer ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
int  value 
)

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 iotcs_virtual_device_set method were called. The value is validated according to the constraints in the device model.

Parameters:
virtual_device_handleDevice Handle
attribute_namethe name of an attribute from the device type model
valuethe value to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTIf the value is not valid
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
const void *  value,
size_t  length 
)

Set value of Device Attribute.

Note:
This procedure should not be called from iotcs_virtual_device_error_callback implementation due to the possible deadlock on outgoing message queue.
Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valuepointer array of values of 'length' bytes. The particular type is determined based on attribute type and could be: const char*, int, float, iotcs_bool or iotcs_date_time.
lengthlength of 'value' array in bytes
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set_boolean ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_bool  value 
)

Set BOOLEAN value of Device Attribute.

Note:
This procedure should not be called from iotcs_virtual_device_error_callback implementation due to the possible deadlock on outgoing message queue.
Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valuevalue to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found or attribute type is different. Operation could be retried at a later time.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set_callback ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  action_name,
iotcs_action_callback  callback 
)

Set callback for given action.

Parameters:
virtual_device_handleDevice Handle
action_nameName of the action
callbackcallback to call
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or action_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTgiven action_name wasn't found.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set_date_time ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
iotcs_date_time  value 
)

Set DATETIME value of Device Attribute.

Note:
This procedure should not be called from iotcs_virtual_device_error_callback implementation due to the possible deadlock on outgoing message queue.
Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valuevalue to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found or attribute type is different. Operation could be retried at a later time.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set_float ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
float  value 
)

Set NUMBER value of Device Attribute.

Note:
This procedure should not be called from iotcs_virtual_device_error_callback implementation due to the possible deadlock on outgoing message queue.
Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valuevalue to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found or attribute type is different. Operation could be retried at a later time.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set_global_on_action_callback ( iotcs_virtual_device_handle  virtual_device_handle,
iotcs_virtual_device_on_action_callback  callback 
)

Set callback for all actions.

Parameters:
virtual_device_handleDevice Handle
action_nameName of the action
callbackcallback to call
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or action_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTgiven action_name wasn't found.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set_integer ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
int  value 
)

Set INTEGER value of Device Attribute.

Note:
This procedure should not be called from iotcs_virtual_device_error_callback implementation due to the possible deadlock on outgoing message queue.
Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valuevalue to set
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found or attribute type is different. Operation could be retried at a later time.
IOTCS_RESULT_OKif succeeds.
iotcs_result iotcs_virtual_device_set_on_action_callback ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  action_name,
iotcs_virtual_device_on_action_callback  callback 
)

Set callback for given action.

Parameters:
virtual_device_handleDevice Handle
action_nameName of the action
callbackcallback to call
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or action_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTgiven action_name wasn't found.
IOTCS_RESULT_OKif succeeds.
void iotcs_virtual_device_set_on_change ( iotcs_virtual_device_handle  virtual_device_handle,
iotcs_virtual_device_changed_callback  callback 
)

Set callback for every external change of Device Attributes.

Parameters:
virtual_device_handleDevice Handle
callbackcallback to call
void iotcs_virtual_device_set_on_error ( iotcs_virtual_device_handle  virtual_device_handle,
iotcs_virtual_device_error_callback  callback 
)

Set callback for network failure of Device Attribute change notification.

Parameters:
virtual_device_handleDevice Handle
callbackcallback to call
iotcs_result iotcs_virtual_device_set_string ( iotcs_virtual_device_handle  virtual_device_handle,
const char *  attribute_name,
const char *  value 
)

Set STRING value of Device Attribute.

Note:
This procedure should not be called from iotcs_virtual_device_error_callback implementation due to the possible deadlock on outgoing message queue.
Parameters:
virtual_device_handleDevice Handle
attribute_nameName of the attribute
valuepointer to null-terminated string
Return values:
IOTCS_RESULT_INVALID_ARGUMENTif virtual_device_handle or attribute_name are NULL.
IOTCS_RESULT_INVALID_ARGUMENTif given attribute_name wasn't found or attribute type is different. Operation could be retried at a later time.
IOTCS_RESULT_OKif succeeds.
void iotcs_virtual_device_start_update ( iotcs_virtual_device_handle  virtual_device_handle)

Suspend background network notifications of changed attribute values.

Parameters:
virtual_device_handleDevice Handle