Tizen Native API  3.0
Remote Resource

IoTCon Remote Resource provides API to manage remote resource.

Required Header

#include <iotcon.h>

Overview

The IoTCon Remote Resource API provides methods for managing resource handle and send request. Example :

#include <iotcon.h>
...
static void _on_get(iotcon_remote_resource_h resource, iotcon_error_e err,
        iotcon_request_type_e request_type, iotcon_response_h response, void *user_data)
{
    if (IOTCON_ERROR_NONE != err)
        return;

    // handle get result
    ...
}

static bool _on_find(iotcon_remote_resource_h resource, iotcon_error_e result,
        void *user_data)
{
    int ret;
    iotcon_remote_resource_h resource_clone = NULL;

    if (IOTCON_ERROR_NONE != result)
        return IOTCON_FUNC_STOP;

    if (NULL == resource)
        return IOTCON_FUNC_CONTINUE;

    // clone handle
    ret = iotcon_remote_resource_clone(resource, &resource_clone);
    if (IOTCON_ERROR_NONE != ret)
        return IOTCON_FUNC_CONTINUE;

    // request get
    ret = iotcon_remote_resource_get(resource_clone, NULL, _on_get, NULL);
    if (IOTCON_ERROR_NONE != ret) {
        iotcon_remote_resource_destroy(resource_clone);
        return IOTCON_FUNC_CONTINUE;
    }

    ...

    return IOTCON_FUNC_CONTINUE;
}

static void _find_light_resource()
{
    int ret;

    ret = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_IPV4,
            "org.tizen.light", false, _on_find, NULL);
    if (IOTCON_ERROR_NONE != ret)
        return;
}

Related Features

This API is related with the following features:

  • http://tizen.org/feature/iot.ocf
    It is recommended to design feature related codes in your application for reliability.
    You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
    To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
    More details on featuring your application can be found from Feature Element.

Functions

int iotcon_remote_resource_create (const char *host_address, iotcon_connectivity_type_e connectivity_type, const char *uri_path, uint8_t policies, iotcon_resource_types_h resource_types, iotcon_resource_interfaces_h resource_ifaces, iotcon_remote_resource_h *remote_resource)
 Creates a new resource handle.
int iotcon_remote_resource_destroy (iotcon_remote_resource_h resource)
 Destroys a resource handle.
int iotcon_remote_resource_clone (iotcon_remote_resource_h src, iotcon_remote_resource_h *dest)
 Clones a clone of a remote resource.
int iotcon_remote_resource_observe_register (iotcon_remote_resource_h resource, iotcon_observe_policy_e observe_policy, iotcon_query_h query, iotcon_remote_resource_observe_cb cb, void *user_data)
 Registers observe callback on the resource.
int iotcon_remote_resource_observe_deregister (iotcon_remote_resource_h resource)
 Deregisters observe callback on the resource.
int iotcon_remote_resource_get (iotcon_remote_resource_h resource, iotcon_query_h query, iotcon_remote_resource_response_cb cb, void *user_data)
 Gets the attributes of a resource asynchronously.
int iotcon_remote_resource_put (iotcon_remote_resource_h resource, iotcon_representation_h repr, iotcon_query_h query, iotcon_remote_resource_response_cb cb, void *user_data)
 Puts the representation of a resource asynchronously.
int iotcon_remote_resource_post (iotcon_remote_resource_h resource, iotcon_representation_h repr, iotcon_query_h query, iotcon_remote_resource_response_cb cb, void *user_data)
 Posts on a resource asynchronously.
int iotcon_remote_resource_delete (iotcon_remote_resource_h resource, iotcon_remote_resource_response_cb cb, void *user_data)
 Deletes a resource asynchronously.
int iotcon_remote_resource_start_caching (iotcon_remote_resource_h resource, iotcon_remote_resource_cached_representation_changed_cb cb, void *user_data)
 Starts caching of a remote resource.
int iotcon_remote_resource_stop_caching (iotcon_remote_resource_h resource)
 Stops caching of a remote resource.
int iotcon_remote_resource_start_monitoring (iotcon_remote_resource_h resource, iotcon_remote_resource_state_changed_cb cb, void *user_data)
 Starts monitoring of a remote resource.
int iotcon_remote_resource_stop_monitoring (iotcon_remote_resource_h resource)
 Stops monitoring of a remote resource.
int iotcon_remote_resource_get_uri_path (iotcon_remote_resource_h resource, char **uri_path)
 Gets an URI path of the remote resource.
int iotcon_remote_resource_get_connectivity_type (iotcon_remote_resource_h resource, iotcon_connectivity_type_e *connectivity_type)
 Gets a connectivity type of the remote resource.
int iotcon_remote_resource_get_host_address (iotcon_remote_resource_h resource, char **host_address)
 Gets a host address of the remote resource.
int iotcon_remote_resource_get_device_id (iotcon_remote_resource_h resource, char **device_id)
 Gets a device ID of the remote resource.
int iotcon_remote_resource_get_device_name (iotcon_remote_resource_h resource, char **device_name)
 Gets the device name of the remote resource.
int iotcon_remote_resource_get_types (iotcon_remote_resource_h resource, iotcon_resource_types_h *types)
 Gets resource types of the remote resource.
int iotcon_remote_resource_get_interfaces (iotcon_remote_resource_h resource, iotcon_resource_interfaces_h *ifaces)
 Gets resource interfaces of the remote resource.
int iotcon_remote_resource_get_policies (iotcon_remote_resource_h resource, uint8_t *policies)
 Checks whether the remote resource is observable or not.
int iotcon_remote_resource_get_options (iotcon_remote_resource_h resource, iotcon_options_h *options)
 Gets options of the remote resource.
int iotcon_remote_resource_set_options (iotcon_remote_resource_h resource, iotcon_options_h options)
 Sets options into the remote resource.
int iotcon_remote_resource_get_cached_representation (iotcon_remote_resource_h resource, iotcon_representation_h *representation)
 Gets cached representation from the remote resource.
int iotcon_remote_resource_get_checking_interval (iotcon_remote_resource_h resource, int *interval)
 Gets the checking interval which is using on the monitoring & caching of remote resource.
int iotcon_remote_resource_set_checking_interval (iotcon_remote_resource_h resource, int interval)
 Sets the checking interval which is using on the monitoring & caching of remote resource.

Typedefs

typedef void(* iotcon_remote_resource_observe_cb )(iotcon_remote_resource_h resource, iotcon_error_e err, int sequence_number, iotcon_response_h response, void *user_data)
 Specifies the type of observe callback passed to iotcon_remote_resource_observe_register(). The err could be one of iotcon_error_e.
The response is created by a server. Therefore, you can't get any values that the server didn't set.
typedef void(* iotcon_remote_resource_response_cb )(iotcon_remote_resource_h resource, iotcon_error_e err, iotcon_request_type_e request_type, iotcon_response_h response, void *user_data)
 Specifies the type of response function.
typedef void(* iotcon_remote_resource_cached_representation_changed_cb )(iotcon_remote_resource_h resource, iotcon_representation_h representation, void *user_data)
 Specifies the type of function passed to iotcon_remote_resource_start_caching().
typedef void(* iotcon_remote_resource_state_changed_cb )(iotcon_remote_resource_h resource, iotcon_remote_resource_state_e state, void *user_data)
 Specifies the type of function passed to iotcon_remote_resource_start_monitoring().

Typedef Documentation

Specifies the type of function passed to iotcon_remote_resource_start_caching().

Since :
3.0
Parameters:
[in]resourceThe handle of the remote resource
[in]representationThe handle of the representation
[in]user_dataThe user data to pass to the function
Precondition:
The callback must be registered using iotcon_remote_resource_start_caching()
See also:
iotcon_remote_resource_start_caching()
iotcon_remote_resource_stop_caching()
typedef void(* iotcon_remote_resource_observe_cb)(iotcon_remote_resource_h resource, iotcon_error_e err, int sequence_number, iotcon_response_h response, void *user_data)

Specifies the type of observe callback passed to iotcon_remote_resource_observe_register(). The err could be one of iotcon_error_e.
The response is created by a server. Therefore, you can't get any values that the server didn't set.

Since :
3.0
Parameters:
[in]resourceThe handle of the remote resource
[in]errThe error code
[in]sequence_numberThe sequence number of observe
[in]responseThe handle of the response
[in]user_dataThe user data passed from the callback registration function
Precondition:
The callback must be registered using iotcon_remote_resource_observe_register()
See also:
iotcon_remote_resource_observe_register()
iotcon_remote_resource_observe_deregister()
iotcon_resource_notify()
typedef void(* iotcon_remote_resource_response_cb)(iotcon_remote_resource_h resource, iotcon_error_e err, iotcon_request_type_e request_type, iotcon_response_h response, void *user_data)

Specifies the type of response function.

The function passed to iotcon_remote_resource_get(), iotcon_remote_resource_put(), iotcon_remote_resource_post(), iotcon_remote_resource_delete().
The err could be one of iotcon_error_e.
The request_type could be one of iotcon_request_type_e.
The response is created by a server. Therefore, you can't get any values that the server didn't set.

Since :
3.0
Parameters:
[in]resourceThe handle of the resource
[in]errThe error code
[in]request_typeThe request type
[in]responseThe handle of the response
[in]user_dataThe user data passed from the callback registration function
Precondition:
The callback must be registered using iotcon_remote_resource_get(), iotcon_remote_resource_put(), iotcon_remote_resource_post(), iotcon_remote_resource_delete().
See also:
iotcon_remote_resource_get()
iotcon_remote_resource_put()
iotcon_remote_resource_post()
iotcon_remote_resource_delete()

Specifies the type of function passed to iotcon_remote_resource_start_monitoring().

Since :
3.0
Parameters:
[in]resourceThe handle of the remote resource
[in]stateThe state of the remote resource
[in]user_dataThe user data to pass to the function
Precondition:
The callback must be registered using iotcon_remote_resource_start_monitoring()
See also:
iotcon_remote_resource_start_monitoring()
iotcon_remote_resource_stop_monitoring()

Function Documentation

Clones a clone of a remote resource.

Since :
3.0
Remarks:
You must destroy dest by calling iotcon_remote_resource_destroy() if dest is no longer needed.
Parameters:
[in]srcThe Source of resource
[out]destThe cloned resource handle
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_create()
iotcon_remote_resource_destroy()
int iotcon_remote_resource_create ( const char *  host_address,
iotcon_connectivity_type_e  connectivity_type,
const char *  uri_path,
uint8_t  policies,
iotcon_resource_types_h  resource_types,
iotcon_resource_interfaces_h  resource_ifaces,
iotcon_remote_resource_h remote_resource 
)

Creates a new resource handle.

Creates a resource proxy object so that iotcon_remote_resource_get(), iotcon_remote_resource_put(), iotcon_remote_resource_post(), iotcon_remote_resource_delete(), iotcon_remote_resource_observe_register(), iotcon_remote_resource_start_caching() and iotcon_remote_resource_start_monitoring() API can be used without discovering the object in advance.
To use this API, you should provide all of the details required to correctly contact and observe the object.
If not, you should discover the resource object manually.
The policies can contain multiple policies like IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE.

Since :
3.0
Remarks:
You must destroy remote_resource by calling iotcon_remote_resource_destroy() if remote_resource is no longer needed.
Parameters:
[in]host_addressThe host address of the resource
[in]connectivity_typeThe connectivity type. Can not use IOTCON_CONNECTIVITY_ALL.
Connectivity type of specific remote resource(It has specific host address, not IOTCON_MULTICAST_ADDRESS) is already decided.
Use specific connectivity type of the remote resource.
You can refer to the iotcon_remote_resource_get_connectivity_type().
[in]uri_pathThe URI path of the resource
[in]policiesThe policies of the resource
Set of iotcon_resource_policy_e
[in]resource_typesThe resource types of the resource. For example, "core.light"
[in]resource_ifacesThe resource interfaces of the resource
[out]remote_resourceGenerated resource handle
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_IOTIVITYIoTivity errors
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
See also:
iotcon_remote_resource_destroy()
iotcon_remote_resource_clone()

Deletes a resource asynchronously.

When server sends response on delete request, iotcon_remote_resource_response_cb() will be called.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the resource
[in]cbThe callback function
[in]user_dataThe user data to pass to the function
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
Postcondition:
When the client receive delete response, iotcon_remote_resource_response_cb() will be called.
See also:
iotcon_remote_resource_response_cb()
iotcon_set_timeout()

Destroys a resource handle.

Since :
3.0
Parameters:
[in]resourceThe handle of the resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_create()
iotcon_remote_resource_clone()

Gets the attributes of a resource asynchronously.

When server sends response on get request, iotcon_remote_resource_response_cb() will be called.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the resource
[in]queryThe query to send to server
[in]cbThe callback function
[in]user_dataThe user data to pass to the function
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
Postcondition:
When the client receive get response, iotcon_remote_resource_response_cb() will be called.
See also:
iotcon_remote_resource_response_cb()
iotcon_set_timeout()

Gets cached representation from the remote resource.

Since :
3.0
Remarks:
representation must not be released using iotcon_representation_destroy().
Parameters:
[in]resourceThe handle of the remote resource
[out]representationThe handle of the representation
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter

Gets the checking interval which is using on the monitoring & caching of remote resource.

This API get the checking interval which is using in the process of monitoring and caching() of remote resource.
The monitoring and caching will operate "GET method" with the checking interval. Default checking interval is 10 seconds.

Since :
3.0
Parameters:
[in]resourceThe handle of the remote resource
[out]intervalSeconds for time interval
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_set_checking_interval()
iotcon_remote_resource_start_monitoring()
iotcon_remote_resource_start_caching()

Gets a connectivity type of the remote resource.

Since :
3.0
Parameters:
[in]resourceThe handle of the remote resource
[out]connectivity_typeThe connectivity type of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_get_policies()
iotcon_remote_resource_set_options()
int iotcon_remote_resource_get_device_id ( iotcon_remote_resource_h  resource,
char **  device_id 
)

Gets a device ID of the remote resource.

Since :
3.0
Remarks:
device_id must not be released using free().
If resource is created by calling iotcon_remote_resource_create(), you cannot get device_id. In this case, the return value of this function is IOTCON_ERROR_NO_DATA.
Parameters:
[in]resourceThe handle of the remote resource
[out]device_idThe device ID of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_NO_DATANo data available
See also:
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_get_policies()
iotcon_remote_resource_set_options()
int iotcon_remote_resource_get_device_name ( iotcon_remote_resource_h  resource,
char **  device_name 
)

Gets the device name of the remote resource.

Since :
3.0
Remarks:
device_name must not be released using free().
If resource is created by calling iotcon_remote_resource_create(), you cannot get device_name. In this case, the return value of this function is IOTCON_ERROR_NO_DATA.
Parameters:
[in]resourceThe handle of the remote resource
[out]device_nameThe device name of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_NO_DATANo data available
See also:
iotcon_set_device_name()
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_get_properties()
iotcon_remote_resource_set_options()
int iotcon_remote_resource_get_host_address ( iotcon_remote_resource_h  resource,
char **  host_address 
)

Gets a host address of the remote resource.

Since :
3.0
Remarks:
host_address must not be released using free().
Parameters:
[in]resourceThe handle of the remote resource
[out]host_addressThe host address of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_get_policies()
iotcon_remote_resource_set_options()

Gets resource interfaces of the remote resource.

Since :
3.0
Remarks:
ifaces must not be released using iotcon_resource_interfaces_destroy().
Parameters:
[in]resourceThe handle of the remote resource
[out]ifacesThe resource interfaces of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_policies()
iotcon_remote_resource_set_options()

Gets options of the remote resource.

Since :
3.0
Remarks:
options must not be released using iotcon_options_destroy().
Parameters:
[in]resourceThe handle of the remote resource
[out]optionsThe handle of the header options
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_set_options()
iotcon_remote_resource_get_policies()
int iotcon_remote_resource_get_policies ( iotcon_remote_resource_h  resource,
uint8_t *  policies 
)

Checks whether the remote resource is observable or not.

The policies can contain multiple policies like IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE.

Since :
3.0
Parameters:
[in]resourceThe handle of the resource
[out]policiesThe policies of the resource
Set of iotcon_resource_policy_e
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_set_options()

Gets resource types of the remote resource.

Since :
3.0
Remarks:
types must not be released using iotcon_resource_types_destroy().
Parameters:
[in]resourceThe handle of the remote resource
[out]typesThe resource types of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_uri_path()
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_get_policies()
iotcon_remote_resource_set_options()
int iotcon_remote_resource_get_uri_path ( iotcon_remote_resource_h  resource,
char **  uri_path 
)

Gets an URI path of the remote resource.

Since :
3.0
Remarks:
uri_path must not be released using free().
Parameters:
[in]resourceThe handle of the remote resource
[out]uri_pathThe URI path of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_host_address()
iotcon_remote_resource_get_connectivity_type()
iotcon_remote_resource_get_device_id()
iotcon_remote_resource_get_device_name()
iotcon_remote_resource_get_types()
iotcon_remote_resource_get_interfaces()
iotcon_remote_resource_get_policies()
iotcon_remote_resource_set_options()

Deregisters observe callback on the resource.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_SYSTEMSystem error
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
See also:
iotcon_remote_resource_observe_cb()
iotcon_remote_resource_observe_register()
iotcon_resource_notify()

Registers observe callback on the resource.

When server sends notification message, iotcon_remote_resource_observe_cb() will be called. The observe_policy could be one of iotcon_observe_policy_e.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the resource
[in]observe_policyThe type to specify how client wants to observe
[in]queryThe query to send to server
[in]cbThe callback function to get notifications from server
[in]user_dataThe user data to pass to the function
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_IOTIVITYIoTivity errors
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
Postcondition:
When the resource receive notification message, iotcon_remote_resource_observe_cb() will be called.
See also:
iotcon_remote_resource_observe_cb()
iotcon_remote_resource_observe_deregister()
iotcon_resource_notify()

Posts on a resource asynchronously.

When server sends response on post request, iotcon_remote_resource_response_cb() will be called.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the resource
[in]reprThe handle of the representation
[in]queryThe query to send to server
[in]cbThe callback function
[in]user_dataThe user data to pass to the function
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
Postcondition:
When the client receive post response, iotcon_remote_resource_response_cb() will be called.
See also:
iotcon_remote_resource_response_cb()
iotcon_set_timeout()

Puts the representation of a resource asynchronously.

When server sends response on put request, iotcon_remote_resource_response_cb() will be called.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the resource
[in]reprThe handle of the representation
[in]queryThe query to send to server
[in]cbThe callback function
[in]user_dataThe user data to pass to the function
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
Postcondition:
When the client receive put response, iotcon_remote_resource_response_cb() will be called.
See also:
iotcon_remote_resource_response_cb()
iotcon_set_timeout()

Sets the checking interval which is using on the monitoring & caching of remote resource.

This API set the checking interval which is using in the process of monitoring and caching() of remote resource.
The monitoring and caching will operate "GET method" with the checking interval changed by this function. Default checking interval is 10 seconds.

Since :
3.0
Parameters:
[in]resourceThe handle of the remote resource
[in]intervalSeconds for time interval (must be in range from 1 to 3600)
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
See also:
iotcon_remote_resource_get_checking_interval()
iotcon_remote_resource_start_monitoring()
iotcon_remote_resource_start_caching()

Starts caching of a remote resource.

Use this function to start caching the resource's attribute.
Although, remote resource is not observable, it keeps the representation up-to-date. Because it checks whether representation is changed periodically.
Therefore, you can get the cached representation even when the remote resource is off-line. The default checking interval is 10 seconds. It can be changed by iotcon_remote_resource_set_checking_interval().

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the remote resource to be cached
[in]cbThe callback function to add into callback list
[in]user_dataThe user data to pass to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_SYSTEMSystem error
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_ALREADYAlready done
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
See also:
iotcon_remote_resource_stop_caching()
iotcon_remote_resource_cached_representation_changed_cb()

Starts monitoring of a remote resource.

When remote resource's state is changed, registered callbacks will be called in turn. Although, remote resource does not call iotcon_start_presence(), it knows the state of resource. Because it checks the state of resource, periodically.
The default checking interval is 10 seconds. It can be changed by iotcon_remote_resource_set_checking_interval().

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the remote resource
[in]cbThe callback function to add into callback list
[in]user_dataThe user data to pass to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_ALREADYAlready done
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
See also:
iotcon_remote_resource_stop_monitoring()
iotcon_remote_resource_state_changed_cb()

Stops caching of a remote resource.

Use this function to stop caching the resource's attribute.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_SYSTEMSystem error
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
See also:
iotcon_remote_resource_start_caching()
iotcon_remote_resource_cached_representation_changed_cb()

Stops monitoring of a remote resource.

Use this function to stop monitoring the remote resource.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]resourceThe handle of the remote resource
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_SYSTEMSystem error
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
See also:
iotcon_remote_resource_start_monitoring()
iotcon_remote_resource_state_changed_cb()