Tizen IoT Extension SDK 1.0
1.0.1
|
00001 /***************************************************************** 00002 * 00003 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 ******************************************************************/ 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 00100 typedef void (*smartthings_resource_connection_status_cb)(smartthings_resource_h handle, smartthings_resource_connection_status_e status, void *user_data); 00101 00124 typedef void (*smartthings_resource_request_cb)(smartthings_resource_h st_h, int req_id, const char *uri, 00125 smartthings_resource_req_type_e req_type, 00126 smartthings_payload_h payload, void *user_data); 00127 00145 typedef void (*smartthings_resource_cloud_registration_status_cb)(smartthings_resource_h st_h, bool is_registered, void *user_data); 00146 00147 00175 int smartthings_resource_initialize(smartthings_resource_h *st_h, 00176 smartthings_resource_connection_status_cb connection_status_cb, 00177 void *user_data); 00178 00192 int smartthings_resource_deinitialize(smartthings_resource_h st_h); 00193 00215 int smartthings_resource_set_request_cb(smartthings_resource_h st_h, 00216 smartthings_resource_request_cb req_cb, 00217 void *user_data); 00218 00238 int smartthings_resource_unset_request_cb(smartthings_resource_h st_h); 00239 00262 int smartthings_resource_send_response(smartthings_resource_h st_h, int req_id, const char *uri, smartthings_payload_h payload, bool result); 00263 00284 int smartthings_resource_notify(smartthings_resource_h st_h, const char *uri, smartthings_payload_h payload); 00285 00307 int smartthings_resource_get_uris(smartthings_resource_h st_h, int *count, char ***uris); 00308 00330 int smartthings_resource_set_cloud_registration_status_cb(smartthings_resource_h st_h, 00331 smartthings_resource_cloud_registration_status_cb reg_cb, 00332 void *user_data); 00333 00353 int smartthings_resource_unset_cloud_registration_status_cb(smartthings_resource_h st_h); 00354 00355 00360 #ifdef __cplusplus 00361 } 00362 #endif 00363 00364 #endif /* __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_RESOURCE_H__ */