*
* Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- * Jongwon Lee <gogosing.lee@samsung.com>
- * Donghee Ye <donghee.ye@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
unsigned int id = ctsvc_client_get_pid();
ret = ctsvc_client_handle_get_p_with_id(id, &contact);
- if (NULL == contact) {
+ if (CONTACTS_ERROR_NO_DATA == ret) {
ret = ctsvc_client_handle_create(id, &contact);
- RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_create() Fail(%d)", ret);
- }
- else if (CONTACTS_ERROR_NONE != ret) {
- CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
+ if (CONTACTS_ERROR_NONE != ret) {
+ ERR("ctsvc_client_handle_create() Fail(%d)", ret);
+ if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
+ return CONTACTS_ERROR_INTERNAL;
+ return ret;
+ }
+ } else if (CONTACTS_ERROR_NONE != ret) {
+ ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
return ret;
}
ret = ctsvc_client_connect_with_flags(contact, flags);
+ if ((CONTACTS_ERROR_IPC_NOT_AVALIABLE == ret)
+ || (CONTACTS_ERROR_PERMISSION_DENIED == ret))
+ return CONTACTS_ERROR_IPC;
return ret;
}
unsigned int id = ctsvc_client_get_pid();
ret = ctsvc_client_handle_get_p_with_id(id, &contact);
- if (NULL == contact) {
+ if (CONTACTS_ERROR_NO_DATA == ret) {
ret = ctsvc_client_handle_create(id, &contact);
- RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_create() Fail(%d)", ret);
- }
- else if (CONTACTS_ERROR_NONE != ret) {
- CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
+ if (CONTACTS_ERROR_NONE != ret) {
+ ERR("ctsvc_client_handle_create() Fail(%d)", ret);
+ if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
+ return CONTACTS_ERROR_INTERNAL;
+ return ret;
+ }
+ } else if (CONTACTS_ERROR_NONE != ret) {
+ ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
return ret;
}
ret = ctsvc_client_connect(contact);
+ if ((CONTACTS_ERROR_IPC_NOT_AVALIABLE == ret)
+ || (CONTACTS_ERROR_PERMISSION_DENIED == ret))
+ return CONTACTS_ERROR_IPC;
return ret;
}
unsigned int id = ctsvc_client_get_pid();
ret = ctsvc_client_handle_get_p_with_id(id, &contact);
- RETV_IF(NULL == contact, CONTACTS_ERROR_DB);
+ RETV_IF(CONTACTS_ERROR_NO_DATA == ret, CONTACTS_ERROR_NONE);
RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
ret = ctsvc_client_disconnect(contact);
WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_client_disconnect() Fail(%d)", ret);
-
- if (0 == ((ctsvc_base_s *)contact)->connection_count) {
- ret = ctsvc_client_handle_remove(id, contact);
- WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_client_handle_remove() Fail(%d)", ret);
- }
+ if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
+ ret = CONTACTS_ERROR_IPC;
return ret;
}
unsigned int id = ctsvc_client_get_tid();
ret = ctsvc_client_handle_get_p_with_id(id, &contact);
- if (NULL == contact) {
+ if (CONTACTS_ERROR_NO_DATA == ret) {
ret = ctsvc_client_handle_create(id, &contact);
- RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_create() Fail(%d)", ret);
- }
- else if (CONTACTS_ERROR_NONE != ret) {
- CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
+ if (CONTACTS_ERROR_NONE != ret) {
+ ERR("ctsvc_client_handle_create() Fail(%d)", ret);
+ if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
+ return CONTACTS_ERROR_INTERNAL;
+ return ret;
+ }
+ } else if (CONTACTS_ERROR_NONE != ret) {
+ ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
return ret;
}
ret = ctsvc_client_connect_on_thread(contact);
WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_client_connect_on_thread() Fail(%d)", ret);
+ if ((CONTACTS_ERROR_IPC_NOT_AVALIABLE == ret)
+ || (CONTACTS_ERROR_PERMISSION_DENIED == ret))
+ return CONTACTS_ERROR_IPC;
return ret;
}
unsigned int id = ctsvc_client_get_tid();
ret = ctsvc_client_handle_get_p_with_id(id, &contact);
- RETV_IF(NULL == contact, CONTACTS_ERROR_DB);
+ RETV_IF(CONTACTS_ERROR_NO_DATA == ret, CONTACTS_ERROR_NONE);
RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
ret = ctsvc_client_disconnect_on_thread(contact);
WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_client_disconnect_on_thread() Fail(%d)", ret);
-
- if (0 == ((ctsvc_base_s *)contact)->connection_count) {
- ret = ctsvc_client_handle_remove(id, contact);
- WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_client_handle_remove() Fail(%d)", ret);
- }
+ if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
+ ret = CONTACTS_ERROR_IPC;
return ret;
}