ERR("icl_ioty_lite_resource_create() Fail(%d)", ret);
return ret;
}
- (*resource_handle)->connectivity_type = IOTCON_CONNECTIVITY_ALL;
return IOTCON_ERROR_NONE;
}
API int iotcon_lite_resource_destroy(iotcon_lite_resource_h resource)
{
- int ret, connectivity_type;
+ int ret;
RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET),
IOTCON_ERROR_PERMISSION_DENIED);
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- connectivity_type = resource->connectivity_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_ALL:
- ret = icl_ioty_lite_resource_destroy(resource);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_lite_resource_destroy() Fail(%d)", ret);
- return ret;
- }
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
+ ret = icl_ioty_lite_resource_destroy(resource);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_ioty_lite_resource_destroy() Fail(%d)", ret);
+ return ret;
}
+
return IOTCON_ERROR_NONE;
}
API int iotcon_lite_resource_update_state(iotcon_lite_resource_h resource,
iotcon_state_h state)
{
- int ret, connectivity_type;
+ int ret;
RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET),
IOTCON_ERROR_PERMISSION_DENIED);
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- connectivity_type = resource->connectivity_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_ALL:
- ret = icl_ioty_lite_resource_update_state(resource, state);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_lite_resource_update_state() Fail(%d)", ret);
- return ret;
- }
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
+ ret = icl_ioty_lite_resource_update_state(resource, state);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_ioty_lite_resource_update_state() Fail(%d)", ret);
+ return ret;
}
return IOTCON_ERROR_NONE;
ERR("icl_ioty_resource_create() Fail(%d)", ret);
return ret;
}
- (*resource_handle)->connectivity_type = IOTCON_CONNECTIVITY_ALL;
return IOTCON_ERROR_NONE;
}
API int iotcon_resource_destroy(iotcon_resource_h resource)
{
FN_CALL;
- int ret, connectivity_type;
+ int ret;
RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET),
IOTCON_ERROR_PERMISSION_DENIED);
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- connectivity_type = resource->connectivity_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_ALL:
- ret = icl_ioty_resource_destroy(resource);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_resource_destroy() Fail(%d)", ret);
- return ret;
- }
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
+ ret = icl_ioty_resource_destroy(resource);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_ioty_resource_destroy() Fail(%d)", ret);
+ return ret;
}
return IOTCON_ERROR_NONE;
const char *iface)
{
FN_CALL;
- int ret, connectivity_type;
+ int ret;
RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET),
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == iface, IOTCON_ERROR_INVALID_PARAMETER);
- connectivity_type = resource->connectivity_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_ALL:
- ret = icl_ioty_resource_bind_interface(resource, iface);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_resource_bind_interface() Fail(%d)", ret);
- return ret;
- }
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
+ ret = icl_ioty_resource_bind_interface(resource, iface);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_ioty_resource_bind_interface() Fail(%d)", ret);
+ return ret;
}
return IOTCON_ERROR_NONE;
const char *resource_type)
{
FN_CALL;
- int ret, connectivity_type;
+ int ret;
RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET),
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == resource_type, IOTCON_ERROR_INVALID_PARAMETER);
- connectivity_type = resource->connectivity_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_ALL:
- ret = icl_ioty_resource_bind_type(resource, resource_type);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_resource_bind_type() Fail(%d)", ret);
- return ret;
- }
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
+ ret = icl_ioty_resource_bind_type(resource, resource_type);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_ioty_resource_bind_type() Fail(%d)", ret);
+ return ret;
}
return IOTCON_ERROR_NONE;
API int iotcon_resource_notify(iotcon_resource_h resource,
iotcon_representation_h repr, iotcon_observers_h observers, iotcon_qos_e qos)
{
- int ret, connectivity_type;
+ int ret;
RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET),
IOTCON_ERROR_PERMISSION_DENIED);
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- connectivity_type = resource->connectivity_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_ALL:
- ret = icl_ioty_resource_notify(resource, repr, observers, qos);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_resource_notify() Fail(%d)", ret);
- return ret;
- }
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
+ ret = icl_ioty_resource_notify(resource, repr, observers, qos);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_ioty_resource_notify() Fail(%d)", ret);
+ return ret;
}
return IOTCON_ERROR_NONE;
resp->oic_request_h = request->oic_request_h;
resp->oic_resource_h = request->oic_resource_h;
- resp->connectivity_type = request->connectivity_type;
*response = resp;
API int iotcon_response_send(iotcon_response_h resp)
{
FN_CALL;
- int ret, connectivity_type;
+ int ret;
RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
RETV_IF(false == ic_utils_check_permission(IC_PERMISSION_INTERNET),
IOTCON_ERROR_PERMISSION_DENIED);
RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER);
- connectivity_type = resp->connectivity_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_IPV4:
- case IOTCON_CONNECTIVITY_IPV6:
- case IOTCON_CONNECTIVITY_ALL:
- ret = icl_ioty_response_send(resp);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_response_send() Fail(%d)", ret);
- return ret;
- }
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
+ ret = icl_ioty_response_send(resp);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("icl_ioty_response_send() Fail(%d)", ret);
+ return ret;
}
return IOTCON_ERROR_NONE;