Tizen IoT Extension SDK 1.0
1.0.1
|
The Resource API provides functions for interfaces for resource applications to be controlled by SmartThings Applications. More...
Typedefs | |
typedef struct smartthings_resource_s * | smartthings_resource_h |
The SmartThings resource handle. 1. | |
typedef void(* | smartthings_resource_connection_status_cb )(smartthings_resource_h handle, smartthings_resource_connection_status_e status, void *user_data) |
Callback for status of connection to SmartThings Thing agent. 1. | |
typedef void(* | smartthings_resource_request_cb )(smartthings_resource_h st_h, int req_id, const char *uri, smartthings_resource_req_type_e req_type, smartthings_payload_h payload, void *user_data) |
Callback for handling request(GET/SET) messages. 1. | |
typedef void(* | smartthings_resource_cloud_registration_status_cb )(smartthings_resource_h st_h, bool is_registered, void *user_data) |
Callback for status of resource registration to cloud. 1. | |
Enumerations | |
enum | smartthings_resource_error_e { SMARTTHINGS_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, SMARTTHINGS_RESOURCE_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, SMARTTHINGS_RESOURCE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED = TIZEN_ERROR_UNKNOWN - 1, SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE = TIZEN_ERROR_UNKNOWN -2 } |
Enumeration for the SmartThings resource error. 1. More... | |
enum | smartthings_resource_req_type_e { SMARTTHINGS_RESOURCE_REQUEST_GET = 0, SMARTTHINGS_RESOURCE_REQUEST_SET = 1, SMARTTHINGS_RESOURCE_REQUEST_COLLECTION_GET = 2, SMARTTHINGS_RESOURCE_REQUEST_COLLECTION_SET = 3 } |
Enumeration for the request type of resource and collection resource. 1. More... | |
enum | smartthings_resource_connection_status_e { SMARTTHINGS_RESOURCE_CONNECTION_STATUS_CONNECTED = 0, SMARTTHINGS_RESOURCE_CONNECTION_STATUS_DISCONNECTED, SMARTTHINGS_RESOURCE_CONNECTION_STATUS_REJECTED } |
Enumeration for RPC connection status. 1. More... | |
Functions | |
int | smartthings_resource_initialize (smartthings_resource_h *st_h, smartthings_resource_connection_status_cb connection_status_cb, void *user_data) |
Initializes a resource handle and connects to agent. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing. | |
int | smartthings_resource_deinitialize (smartthings_resource_h st_h) |
Deinitializes a resource handle and disconnects from the agent. 1. | |
int | smartthings_resource_set_request_cb (smartthings_resource_h st_h, smartthings_resource_request_cb req_cb, void *user_data) |
Sets resource request callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing. | |
int | smartthings_resource_unset_request_cb (smartthings_resource_h st_h) |
Unsets resource request callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing. | |
int | smartthings_resource_send_response (smartthings_resource_h st_h, int req_id, const char *uri, smartthings_payload_h payload, bool result) |
Sends response for resource request message. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing http://tizen.org/privilege/internet. | |
int | smartthings_resource_notify (smartthings_resource_h st_h, const char *uri, smartthings_payload_h payload) |
Notifies resource change. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing http://tizen.org/privilege/internet. | |
int | smartthings_resource_get_uris (smartthings_resource_h st_h, int *count, char ***uris) |
Gets resource URIs. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing. | |
int | smartthings_resource_set_cloud_registration_status_cb (smartthings_resource_h st_h, smartthings_resource_cloud_registration_status_cb reg_cb, void *user_data) |
Sets cloud registration callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing. | |
int | smartthings_resource_unset_cloud_registration_status_cb (smartthings_resource_h st_h) |
Unsets cloud registration callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing. |
The Resource API provides functions for interfaces for resource applications to be controlled by SmartThings Applications.
#include <smartthings_resource.h>
The SmartThings Thing Resource API provides the following functionalities:
typedef void(* smartthings_resource_cloud_registration_status_cb)(smartthings_resource_h st_h, bool is_registered, void *user_data) |
Callback for status of resource registration to cloud. 1.
[in] | st_h | The SmartThings resource handle |
[in] | is_registered | The status of resource registration to cloud |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* smartthings_resource_connection_status_cb)(smartthings_resource_h handle, smartthings_resource_connection_status_e status, void *user_data) |
Callback for status of connection to SmartThings Thing agent. 1.
[in] | result | The result of connection operation |
[in] | handle | The SmartThings handle |
[in] | status | The status of connection |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* smartthings_resource_request_cb)(smartthings_resource_h st_h, int req_id, const char *uri, smartthings_resource_req_type_e req_type, smartthings_payload_h payload, void *user_data) |
Callback for handling request(GET/SET) messages. 1.
[in] | st_h | The SmartThings resource handle |
[in] | req_id | The request ID of request message |
[in] | uri | The resource URI |
[in] | req_type | The request type for request message |
[in] | payload | The payload for SET request message |
[in] | user_data | The user data passed from the callback registration function |
Enumeration for the SmartThings resource error. 1.
Enumeration for the request type of resource and collection resource. 1.
Deinitializes a resource handle and disconnects from the agent. 1.
[in] | st_h | The SmartThings resource handle |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
int smartthings_resource_get_uris | ( | smartthings_resource_h | st_h, |
int * | count, | ||
char *** | uris | ||
) |
Gets resource URIs. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing.
[in] | st_h | The SmartThings resource handle |
[out] | count | The resource count |
[out] | uris | The resource URI list |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |
int smartthings_resource_initialize | ( | smartthings_resource_h * | st_h, |
smartthings_resource_connection_status_cb | connection_status_cb, | ||
void * | user_data | ||
) |
Initializes a resource handle and connects to agent. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing.
[out] | st_h | The SmartThings resource handle to be newly created on success |
[in] | connection_status_cb | The connection status callback to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY | Out of memory |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_NOT_SUPPORTED | Not supported |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |
int smartthings_resource_notify | ( | smartthings_resource_h | st_h, |
const char * | uri, | ||
smartthings_payload_h | payload | ||
) |
Notifies resource change. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/internet.
[in] | st_h | The SmartThings resource handle |
[in] | uri | The resource URI |
[in] | payload | The payload of response message |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |
int smartthings_resource_send_response | ( | smartthings_resource_h | st_h, |
int | req_id, | ||
const char * | uri, | ||
smartthings_payload_h | payload, | ||
bool | result | ||
) |
Sends response for resource request message. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/internet.
[in] | st_h | The SmartThings resource handle |
[in] | req_id | The request ID of request message |
[in] | uri | The resource URI |
[in] | payload | The payload of response message |
[in] | result | The result of response |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |
int smartthings_resource_set_cloud_registration_status_cb | ( | smartthings_resource_h | st_h, |
smartthings_resource_cloud_registration_status_cb | reg_cb, | ||
void * | user_data | ||
) |
Sets cloud registration callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing.
[in] | st_h | The SmartThings resource handle |
[in] | reg_cb | The callback to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |
int smartthings_resource_set_request_cb | ( | smartthings_resource_h | st_h, |
smartthings_resource_request_cb | req_cb, | ||
void * | user_data | ||
) |
Sets resource request callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing.
[in] | st_h | The SmartThings resource handle |
[in] | req_cb | The request callback to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |
Unsets cloud registration callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing.
[in] | st_h | The SmartThings resource handle |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |
Unsets resource request callback. 1 http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource
http://tizen.org/privilege/appmanager.launch
http://tizen.org/privilege/datasharing.
[in] | st_h | The SmartThings resource handle |
0
on success, otherwise a negative error value SMARTTHINGS_RESOURCE_ERROR_NONE | Successful |
SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER | Invalid parameter |
SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED | Permission denied |
SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED | Operation failed |
SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE | Service unavailable |