|
Tizen IoT Extension SDK 1.0
1.0.0
|
00001 /* 00002 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved 00003 * 00004 * PROPRIETARY/CONFIDENTIAL 00005 * 00006 * This software is the confidential and proprietary information of 00007 * Samsung Electronics Co., Ltd. ("Confidential Information"). 00008 * You shall not disclose such Confidential Information and shall 00009 * use it only in accordance with the terms of the license agreement 00010 * you entered into with Samsung Electronics Co., Ltd. ("SAMSUNG"). 00011 * 00012 * SAMSUNG MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY 00013 * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT 00014 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR 00015 * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SAMSUNG SHALL NOT BE 00016 * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, 00017 * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. 00018 */ 00019 00020 #ifndef __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_RESOURCE_H__ 00021 #define __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_RESOURCE_H__ 00022 00023 #include <stdio.h> 00024 #include <stdlib.h> 00025 #include <stdbool.h> 00026 #include <tizen.h> 00027 #include <smartthings_payload.h> 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00046 typedef enum { 00047 SMARTTHINGS_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, 00048 SMARTTHINGS_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, 00049 SMARTTHINGS_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, 00050 SMARTTHINGS_RESOURCE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, 00051 SMARTTHINGS_RESOURCE_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, 00052 SMARTTHINGS_RESOURCE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, 00053 SMARTTHINGS_RESOURCE_ERROR_OPERATION_FAILED = TIZEN_ERROR_UNKNOWN - 1, 00054 SMARTTHINGS_RESOURCE_ERROR_SERVICE_UNAVAILABLE = TIZEN_ERROR_UNKNOWN -2 00055 } smartthings_resource_error_e; 00056 00061 typedef enum { 00062 SMARTTHINGS_RESOURCE_REQUEST_GET = 0, 00063 SMARTTHINGS_RESOURCE_REQUEST_SET = 1, 00064 SMARTTHINGS_RESOURCE_REQUEST_COLLECTION_GET = 2, 00065 SMARTTHINGS_RESOURCE_REQUEST_COLLECTION_SET = 3 00066 } smartthings_resource_req_type_e; 00067 00072 typedef enum { 00073 SMARTTHINGS_RESOURCE_CONNECTION_STATUS_CONNECTED = 0, 00074 SMARTTHINGS_RESOURCE_CONNECTION_STATUS_DISCONNECTED, 00075 SMARTTHINGS_RESOURCE_CONNECTION_STATUS_REJECTED, 00076 } smartthings_resource_connection_status_e; 00077 00082 typedef struct smartthings_resource_s *smartthings_resource_h; 00083 00105 typedef void (*smartthings_resource_connection_status_cb)(smartthings_resource_error_e result, smartthings_resource_h handle, smartthings_resource_connection_status_e status, void *user_data); 00106 00107 00130 typedef void (*smartthings_resource_request_cb)(smartthings_resource_h st_h, int req_id, const char *uri, 00131 smartthings_resource_req_type_e req_type, 00132 smartthings_payload_h payload, void *user_data); 00133 00151 typedef void (*smartthings_resource_cloud_registration_status_cb)(smartthings_resource_h st_h, bool is_registered, void *user_data); 00152 00153 00181 int smartthings_resource_initialize(smartthings_resource_h *st_h, 00182 smartthings_resource_connection_status_cb connection_status_cb, 00183 void *user_data); 00184 00198 int smartthings_resource_deinitialize(smartthings_resource_h st_h); 00199 00221 int smartthings_resource_set_request_cb(smartthings_resource_h st_h, 00222 smartthings_resource_request_cb req_cb, 00223 void *user_data); 00224 00244 int smartthings_resource_unset_request_cb(smartthings_resource_h st_h); 00245 00268 int smartthings_resource_send_response(smartthings_resource_h st_h, int req_id, const char *uri, smartthings_payload_h payload, bool result); 00269 00290 int smartthings_resource_notify(smartthings_resource_h st_h, const char *uri, smartthings_payload_h payload); 00291 00313 int smartthings_resource_get_uris(smartthings_resource_h st_h, int *count, char ***uris); 00314 00336 int smartthings_resource_set_cloud_registration_status_cb(smartthings_resource_h st_h, 00337 smartthings_resource_cloud_registration_status_cb reg_cb, 00338 void *user_data); 00339 00359 int smartthings_resource_unset_cloud_registration_status_cb(smartthings_resource_h st_h); 00360 00361 00366 #ifdef __cplusplus 00367 } 00368 #endif 00369 00370 #endif /* __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_RESOURCE_H__ */