#ifdef TZ_VER_3
static int _ic_ocf_feature = -1;
static const char *IC_FEATURE_OCF = "http://tizen.org/feature/iot.ocf";
-
-static int _ic_ocf_security_feature = -1;
-static const char *IC_FEATURE_OCF_SECURITY = "http://tizen.org/feature/iot.ocf.security";
#endif
// TODO: Can't access in user side daemon
bool ic_utils_check_permission(int permssion)
{
- // TODO: Temporary code (need guide from security team)
-
static int has_network_permission = -1;
static int has_internet_permission = -1;
#endif
}
-bool ic_utils_check_ocf_security_feature()
-{
-#ifdef TZ_VER_3
- if (_ic_ocf_security_feature < 0) {
- bool feature_supported = false;
- system_info_get_platform_bool(IC_FEATURE_OCF_SECURITY, &feature_supported);
- _ic_ocf_security_feature = feature_supported ? 1 : 0;
- }
- return _ic_ocf_security_feature;
-#else
- return true;
-#endif
-}
-
void ic_utils_free_platform_info(OCPlatformInfo *platform_info)
{
RET_IF(NULL == platform_info);
char* ic_utils_strdup(const char *src);
bool ic_utils_check_permission(int permssion);
bool ic_utils_check_ocf_feature();
-bool ic_utils_check_ocf_security_feature();
int ic_utils_get_platform_info(OCPlatformInfo *platform_info);
void ic_utils_free_platform_info(OCPlatformInfo *platform_info);
static int icl_timeout_seconds = ICL_TIMEOUT_DEFAULT;
static int icl_init_count;
-API int iotcon_secure_initialize(const char *file_path)
-{
- int ret;
-
- RETV_IF(false == ic_utils_check_ocf_security_feature(), IOTCON_ERROR_NOT_SUPPORTED);
- RETV_IF(false == ic_utils_check_permission((IC_PERMISSION_INTERNET|IC_PERMISSION_NETWORK_GET)),
- IOTCON_ERROR_PERMISSION_DENIED);
- // TODO: Consider (NULL == Path)
- RETV_IF(NULL == file_path, IOTCON_ERROR_INVALID_PARAMETER);
-
- ret = icl_ioty_set_persistent_storage(file_path);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_set_persistent_storage() Fail(%d)", ret);
- return ret;
- }
-
- ret = iotcon_initialize();
- if (IOTCON_ERROR_NONE != ret) {
- ERR("iotcon_initialize() Fail(%d)", ret);
- return ret;
- }
-
- return IOTCON_ERROR_NONE;
-}
-
-API int iotcon_initialize(void)
+API int iotcon_initialize(const char *file_path)
{
int ret;
RETV_IF(false == ic_utils_check_permission((IC_PERMISSION_INTERNET|IC_PERMISSION_NETWORK_GET)),
IOTCON_ERROR_PERMISSION_DENIED);
+ // TODO: Fixme
+ //RETV_IF(NULL == file_path, IOTCON_ERROR_INVALID_PARAMETER);
+
#if !GLIB_CHECK_VERSION(2, 35, 0)
g_type_init();
#endif
+ if (file_path && *file_path) {
+ ret = icl_ioty_set_persistent_storage(file_path);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_set_persistent_storage() Fail(%d)", ret);
+ return ret;
+ }
+ }
+
ic_utils_mutex_lock(IC_UTILS_MUTEX_INIT);
icl_init_count++;
if (1 == icl_init_count) {
* @section CAPI_IOT_CONNECTIVITY_MODULE_FEATURE Related Features
* This API is related with the following features:\n
* - http://tizen.org/feature/iot.ocf\n
- * - http://tizen.org/feature/iot.ocf.security\n
*
* It is recommended to design feature related codes in your application for reliability.\n
*
- * If the feature(http://tizen.org/feature/iot.ocf.security) for OCF security architecture
- * is applied, you MUST call iotcon_secure_initialize() instead of iotcon_initialize().
- * Then applications communicate with each other based on OCF security architecture.
- *
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
*
* 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.\n
*/
/**
- * @brief Initializes IoTCon with secure mode.
- * @details Call this function to start IoTCon above OCF security architecture.
+ * @brief Initializes IoTCon.
+ * @details Call this function to start IoTCon.
*
* @since_tizen 3.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @privilege %http://tizen.org/privilege/internet
*
- * @remarks If the device has the feature("http://tizen.org/feature/iot.ocf.security"),
- * you must call this function instead of iotcon_initialize().\n
- * @a file_path point to a file for handling secure virtual resources.
+ * @remarks The @a file_path point to a file for handling secure virtual resources.
* The file that is CBOR(Concise Binary Object Representation)-format must already exist
* in @a file_path. We recommend to use application-local file for @a file_path.\n
* You must call iotcon_deinitialize() if IoTCon API is no longer needed.
*
- * @param[in] file_path The file path to point to storage for handling secure virtual resources.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE Successful
- * @retval #IOTCON_ERROR_NOT_SUPPORTED Not supported
- * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- * @retval #IOTCON_ERROR_IOTIVITY Iotivity errors
- *
- * @see iotcon_deinitialize()
- * @see system_info_get_platform_bool()
- */
-int iotcon_secure_initialize(const char *file_path);
-
-/**
- * @brief Initializes IoTCon.
- * @details Call this function to start IoTCon.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/network.get
- * @privilege %http://tizen.org/privilege/internet
- *
- * @remarks You must call iotcon_deinitialize() if IoTCon API is no longer needed.
- *
* @return 0 on success, otherwise a negative error value.
* @retval #IOTCON_ERROR_NONE Successful
* @retval #IOTCON_ERROR_NOT_SUPPORTED Not supported
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
*
* @see iotcon_deinitialize()
*/
-int iotcon_initialize(void);
+int iotcon_initialize(const char *file_path);
/**
* @brief Deinitializes IoTCon.
* @pre iotcon_initialize() should be called to initialize.
*
* @see iotcon_initialize()
- * @see iotcon_secure_initialize()
*/
void iotcon_deinitialize(void);
loop = g_main_loop_new(NULL, FALSE);
/* initialize iotcon */
- ret = iotcon_initialize();
+ ret = iotcon_initialize(NULL);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_initialize() Fail(%d)", ret);
return -1;
loop = g_main_loop_new(NULL, FALSE);
/* initialize iotcon */
- ret = iotcon_initialize();
+ ret = iotcon_initialize(NULL);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_initialize() Fail(%d)", ret);
return -1;
loop = g_main_loop_new(NULL, FALSE);
/* initialize iotcon */
- ret = iotcon_initialize();
+ ret = iotcon_initialize(NULL);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_initialize() Fail(%d)", ret);
return -1;
loop = g_main_loop_new(NULL, FALSE);
/* initialize iotcon */
- ret = iotcon_initialize();
+ ret = iotcon_initialize(NULL);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_initialize() Fail(%d)", ret);
return -1;
loop = g_main_loop_new(NULL, FALSE);
/* initialize iotcon */
- ret = iotcon_initialize();
+ ret = iotcon_initialize(NULL);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_initialize() Fail(%d)", ret);
return -1;
loop = g_main_loop_new(NULL, FALSE);
/* initialize iotcon */
- ret = iotcon_initialize();
+ ret = iotcon_initialize(NULL);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_initialize() Fail(%d)", ret);
return -1;
loop = g_main_loop_new(NULL, FALSE);
/* initialize iotcon */
- ret = iotcon_initialize();
+ ret = iotcon_initialize(NULL);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_initialize() Fail(%d)", ret);
return -1;