|
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_H__ 00021 #define __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_H__ 00022 00023 #include <stdlib.h> 00024 #include <stdbool.h> 00025 #include <tizen.h> 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00040 #define SMARTTHINGS_SSID_LEN_MAX 32 00041 00046 #define SMARTTHINGS_CLOUD_INFO_LEN_MAX 128 00047 00052 typedef enum { 00053 SMARTTHINGS_ERROR_NONE = TIZEN_ERROR_NONE, 00054 SMARTTHINGS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, 00055 SMARTTHINGS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, 00056 SMARTTHINGS_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, 00057 SMARTTHINGS_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, 00058 SMARTTHINGS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, 00059 SMARTTHINGS_ERROR_OPERATION_FAILED = TIZEN_ERROR_UNKNOWN - 1, 00060 SMARTTHINGS_ERROR_SERVICE_UNAVAILABLE = TIZEN_ERROR_UNKNOWN -2 00061 } smartthings_error_e; 00062 00067 typedef enum { 00068 SMARTTHINGS_STATUS_NOT_READY = -1, 00069 SMARTTHINGS_STATUS_INIT = 0, 00070 SMARTTHINGS_STATUS_ES_STARTED, 00071 SMARTTHINGS_STATUS_ES_DONE, 00072 SMARTTHINGS_STATUS_ES_FAILED_ON_OWNERSHIP_TRANSFER, 00073 SMARTTHINGS_STATUS_CONNECTING_TO_AP, 00074 SMARTTHINGS_STATUS_CONNECTED_TO_AP, 00075 SMARTTHINGS_STATUS_CONNECTING_TO_AP_FAILED, 00076 SMARTTHINGS_STATUS_REGISTERING_TO_CLOUD, 00077 SMARTTHINGS_STATUS_REGISTERED_TO_CLOUD, 00078 SMARTTHINGS_STATUS_REGISTERING_FAILED_ON_SIGN_IN, 00079 SMARTTHINGS_STATUS_REGISTERING_FAILED_ON_PUB_RES 00080 } smartthings_status_e; 00081 00086 typedef enum { 00087 SMARTTHINGS_CONNECTION_STATUS_CONNECTED = 0, 00088 SMARTTHINGS_CONNECTION_STATUS_DISCONNECTED, 00089 SMARTTHINGS_CONNECTION_STATUS_REJECTED, 00090 } smartthings_connection_status_e; 00091 00096 typedef enum { 00097 SMARTTHINGS_WIFI_MODE_11A = (1 << 0), 00098 SMARTTHINGS_WIFI_MODE_11B = (1 << 1), 00099 SMARTTHINGS_WIFI_MODE_11G = (1 << 2), 00100 SMARTTHINGS_WIFI_MODE_11N = (1 << 3), 00101 SMARTTHINGS_WIFI_MODE_11AC = (1 << 4) 00102 } smartthings_wifi_mode_e; 00103 00108 typedef enum { 00109 SMARTTHINGS_WIFI_FREQ_24G = (1 << 0), 00110 SMARTTHINGS_WIFI_FREQ_5G = (1 << 1), 00111 } smartthings_wifi_freq_e; 00112 00117 typedef enum { 00118 SMARTTHINGS_WIFI_AUTHTYPE_NONE = 0, 00119 SMARTTHINGS_WIFI_AUTHTYPE_WEP, 00120 SMARTTHINGS_WIFI_AUTHTYPE_WPA_PSK, 00121 SMARTTHINGS_WIFI_AUTHTYPE_WPA2_PSK 00122 } smartthings_wifi_authtype_e; 00123 00128 typedef enum { 00129 SMARTTHINGS_WIFI_ENCTYPE_NONE = 0, 00130 SMARTTHINGS_WIFI_ENCTYPE_WEP_64, 00131 SMARTTHINGS_WIFI_ENCTYPE_WEP_128, 00132 SMARTTHINGS_WIFI_ENCTYPE_TKIP, 00133 SMARTTHINGS_WIFI_ENCTYPE_AES, 00134 SMARTTHINGS_WIFI_ENCTYPE_TKIP_AES 00135 } smartthings_wifi_enctype_e; 00136 00141 typedef struct smartthings_s *smartthings_h; 00142 00147 typedef struct smartthings_ap_info_s *smartthings_ap_info_h; 00148 00153 typedef struct smartthings_device_prov_info_s *smartthings_device_prov_info_h; 00154 00159 typedef struct smartthings_cloud_info_s *smartthings_cloud_info_h; 00160 00165 typedef struct smartthings_ap_list_s *smartthings_ap_list_h; 00166 00188 typedef void (*smartthings_connection_status_cb)(smartthings_error_e result, smartthings_h handle, smartthings_connection_status_e status, void *user_data); 00189 00206 typedef void (*smartthings_status_changed_cb)(smartthings_h handle, smartthings_status_e status, void *user_data); 00207 00223 typedef void (*smartthings_user_confirm_cb)(smartthings_h handle, void *user_data); 00224 00240 typedef void (*smartthings_reset_confirm_cb)(smartthings_h handle, void *user_data); 00241 00258 typedef void (*smartthings_reset_result_cb)(smartthings_h handle, bool result, void *user_data); 00259 00278 typedef void (*smartthings_pin_generated_cb)(smartthings_h handle, const char* pin, size_t size, void *user_data); 00279 00295 typedef void (*smartthings_pin_display_close_cb)(smartthings_h handle, void *user_data); 00296 00315 typedef void (*smartthings_wifi_ap_provisioning_cb)(smartthings_h handle, smartthings_ap_info_h ap_info_h, void *user_data); 00316 00335 typedef void (*smartthings_device_provisioning_cb)(smartthings_h handle, smartthings_device_prov_info_h dev_prov_h, void *user_data); 00336 00353 typedef void (*smartthings_scan_ap_cb)(smartthings_h handle, int req_id, void *user_data); 00354 00370 typedef void (*smartthings_stop_soft_ap_cb)(smartthings_h handle, void *user_data); 00371 00399 int smartthings_initialize(smartthings_h *handle, 00400 smartthings_connection_status_cb connection_status_cb, 00401 void *user_data); 00402 00417 int smartthings_deinitialize(smartthings_h handle); 00418 00438 int smartthings_start(smartthings_h handle); 00439 00459 int smartthings_stop(smartthings_h handle); 00460 00487 int smartthings_set_status_changed_cb(smartthings_h handle, 00488 smartthings_status_changed_cb status_cb, 00489 void *user_data); 00490 00510 int smartthings_unset_status_changed_cb(smartthings_h handle); 00511 00535 int smartthings_set_certificate_file(smartthings_h handle, const char *certificate, const char *private_key); 00536 00553 int smartthings_set_device_property(smartthings_h handle, const char* dev_name, int wifi_mode, int wifi_freq); 00554 00575 int smartthings_get_device_id(smartthings_h handle, char **device_id); 00576 00595 int smartthings_get_easysetup_status(smartthings_h handle, bool *is_completed); 00596 00619 int smartthings_start_easysetup(smartthings_h handle); 00620 00643 int smartthings_stop_easysetup(smartthings_h handle); 00644 00671 int smartthings_set_user_confirm_cb(smartthings_h handle, 00672 smartthings_user_confirm_cb confirm_cb, 00673 void *user_data); 00674 00694 int smartthings_unset_user_confirm_cb(smartthings_h handle); 00695 00722 int smartthings_set_reset_confirm_cb(smartthings_h handle, 00723 smartthings_reset_confirm_cb confirm_cb, 00724 void *user_data); 00725 00745 int smartthings_unset_reset_confirm_cb(smartthings_h handle); 00746 00773 int smartthings_set_reset_result_cb(smartthings_h handle, 00774 smartthings_reset_result_cb reset_result_cb, 00775 void *user_data); 00776 00796 int smartthings_unset_reset_result_cb(smartthings_h handle); 00797 00798 00828 int smartthings_set_pin_cb(smartthings_h handle, 00829 smartthings_pin_generated_cb generated_cb, 00830 smartthings_pin_display_close_cb close_cb, 00831 void *user_data); 00832 00852 int smartthings_unset_pin_cb(smartthings_h handle); 00853 00880 int smartthings_set_wifi_ap_provisioning_cb(smartthings_h handle, 00881 smartthings_wifi_ap_provisioning_cb wifi_ap_cb, 00882 void *user_data); 00883 00903 int smartthings_unset_wifi_ap_provisioning_cb(smartthings_h handle); 00904 00931 int smartthings_set_device_provisioning_cb(smartthings_h handle, 00932 smartthings_device_provisioning_cb dev_prov_cb, 00933 void *user_data); 00934 00954 int smartthings_unset_device_provisioning_cb(smartthings_h handle); 00955 00983 int smartthings_set_scan_ap_cb(smartthings_h handle, 00984 smartthings_scan_ap_cb scan_ap_cb, 00985 void *user_data); 00986 01006 int smartthings_unset_scan_ap_cb(smartthings_h handle); 01007 01034 int smartthings_set_stop_soft_ap_cb(smartthings_h handle, 01035 smartthings_stop_soft_ap_cb stop_soft_ap_cb, 01036 void *user_data); 01037 01057 int smartthings_unset_stop_soft_ap_cb(smartthings_h handle); 01058 01081 int smartthings_send_user_confirm(smartthings_h handle, bool confirm); 01082 01083 01106 int smartthings_send_reset_confirm(smartthings_h handle, bool confirm); 01107 01129 int smartthings_reset(smartthings_h handle); 01130 01149 int smartthings_apinfo_get_ssid(smartthings_ap_info_h ap_info_h, char **ssid); 01150 01169 int smartthings_apinfo_get_password(smartthings_ap_info_h ap_info_h, char **pwd); 01170 01187 int smartthings_apinfo_get_authtype(smartthings_ap_info_h ap_info_h, smartthings_wifi_authtype_e *authtype); 01188 01205 int smartthings_apinfo_get_enctype(smartthings_ap_info_h ap_info_h, smartthings_wifi_enctype_e *enctype); 01206 01223 int smartthings_apinfo_get_channel(smartthings_ap_info_h ap_info_h, int *channel); 01224 01243 int smartthings_devinfo_get_language(smartthings_device_prov_info_h dev_prov_h, char **language); 01244 01263 int smartthings_devinfo_get_country(smartthings_device_prov_info_h dev_prov_h, char **country); 01264 01283 int smartthings_devinfo_get_datetime(smartthings_device_prov_info_h dev_prov_h, char **datetime); 01284 01302 int smartthings_aplist_create(smartthings_ap_list_h *ap_list_h, unsigned int count); 01303 01317 int smartthings_aplist_destroy(smartthings_ap_list_h ap_list_h); 01318 01335 int smartthings_aplist_set_ssid(smartthings_ap_list_h ap_list_h, int idx, const char *ssid); 01336 01353 int smartthings_aplist_set_bssid(smartthings_ap_list_h ap_list_h, int idx, const char *bssid); 01354 01371 int smartthings_aplist_set_authtype(smartthings_ap_list_h ap_list_h, int idx, smartthings_wifi_authtype_e authtype); 01372 01389 int smartthings_aplist_set_enctype(smartthings_ap_list_h ap_list_h, int idx, smartthings_wifi_enctype_e enctype); 01390 01407 int smartthings_aplist_set_channel(smartthings_ap_list_h ap_list_h, int idx, int channel); 01408 01425 int smartthings_aplist_set_signal_level(smartthings_ap_list_h ap_list_h, int idx, int signal_level); 01426 01443 int smartthings_aplist_set_max_rate(smartthings_ap_list_h ap_list_h, int idx, int max_rate); 01444 01470 int smartthings_send_ap_list(smartthings_h handle, smartthings_ap_list_h ap_list_h, int req_id); 01471 01488 int smartthings_cloudinfo_create(smartthings_cloud_info_h *cloud_info_h); 01489 01503 int smartthings_cloudinfo_destroy(smartthings_cloud_info_h cloud_info_h); 01504 01520 int smartthings_cloudinfo_set_region(smartthings_cloud_info_h cloud_info_h, const char *region); 01521 01534 int smartthings_cloudinfo_set_auth_provider(smartthings_cloud_info_h cloud_info_h, const char *auth_provider); 01535 01548 int smartthings_cloudinfo_set_access_token(smartthings_cloud_info_h cloud_info_h, const char *access_token); 01549 01562 int smartthings_cloudinfo_set_refresh_token(smartthings_cloud_info_h cloud_info_h, const char *refresh_token); 01563 01576 int smartthings_cloudinfo_set_user_id(smartthings_cloud_info_h cloud_info_h, const char *user_id); 01577 01590 int smartthings_cloudinfo_set_client_id(smartthings_cloud_info_h cloud_info_h, const char *client_id); 01591 01611 int smartthings_sign_up_cloud(smartthings_h handle, smartthings_cloud_info_h cloud_info_h); 01612 01631 int smartthings_set_preconfigured_pin(smartthings_h handle, const char* pin); 01632 01651 int smartthings_set_mot_status(smartthings_h handle, bool enable); 01652 01657 #ifdef __cplusplus 01658 } 01659 #endif 01660 01661 #endif /* __SAMSUNG_EXPERIENCE_SERVICE_SMARTTHINGS_H__ */