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);
+ if (CONTACTS_ERROR_NONE != ret)
+ {
+ CTS_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) {
CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", 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);
+ if (CONTACTS_ERROR_NONE != ret)
+ {
+ CTS_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) {
CTS_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_NONE);
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 (CONTACTS_ERROR_INVALID_PARAMETER == ret)
+ ret = CONTACTS_ERROR_IPC;
if (0 == ((ctsvc_base_s *)contact)->connection_count) {
ret = ctsvc_client_handle_remove(id, contact);
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);
+ if (CONTACTS_ERROR_NONE != ret)
+ {
+ CTS_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) {
CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", 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_NONE);
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 (CONTACTS_ERROR_INVALID_PARAMETER == ret)
+ ret = CONTACTS_ERROR_IPC;
if (0 == ((ctsvc_base_s *)contact)->connection_count) {
ret = ctsvc_client_handle_remove(id, contact);
else {
CTS_DBG("System : please call contacts_connect(), connection count is (%d)", _ctsvc_connection);
ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
- return CONTACTS_ERROR_INVALID_PARAMETER;
+ return CONTACTS_ERROR_DB;
}
_ctsvc_connection--;
if (1 == base->connection_count) {
ret = ctsvc_ipc_disconnect(contact, ctsvc_client_get_tid(), _ctsvc_connection_on_thread);
if (ret != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_disconnect_on_thread() Fail(%d)", ret);
+ CTS_ERR("ctsvc_ipc_disconnect() Fail(%d)", ret);
ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
return ret;
}
else {
CTS_DBG("System : please call contacts_connect_on_thread(), connection count is (%d)", _ctsvc_connection_on_thread);
ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
- return CONTACTS_ERROR_INVALID_PARAMETER;
+ return CONTACTS_ERROR_DB;
}
_ctsvc_connection_on_thread--;
* otherwise a negative error value
*
* @retval #CONTACTS_ERROR_NONE Successful
- * @retval #CONTACTS_ERROR_DB Database operation failure
- * @retval #CONTACTS_ERROR_IPC_NOT_AVALIABLE IPC server is not available
* @retval #CONTACTS_ERROR_IPC IPC error
+ * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #CONTACTS_ERROR_SYSTEM System error
- * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
+ * @retval #CONTACTS_ERROR_INTERNAL Internal error
*
* @see contacts_disconnect()
*/
* otherwise a negative error value
*
* @retval #CONTACTS_ERROR_NONE Successful
- * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CONTACTS_ERROR_DB Database operation failure
* @retval #CONTACTS_ERROR_IPC IPC error
+ * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CONTACTS_ERROR_SYSTEM System error
+ * @retval #CONTACTS_ERROR_DB Database operation failure
*
* @see contacts_connect()
*/
* otherwise a negative error value
*
* @retval #CONTACTS_ERROR_NONE Successful
- * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #CONTACTS_ERROR_DB Database operation failure
- * @retval #CONTACTS_ERROR_IPC_NOT_AVALIABLE IPC server is not available
* @retval #CONTACTS_ERROR_IPC IPC error
+ * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #CONTACTS_ERROR_SYSTEM System error
* @retval #CONTACTS_ERROR_INTERNAL Internal error
* @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*
+ * @remarks If there is no opened connection, this function returns #CONTACTS_ERROR_DB.
+ *
* @return @c 0 on success,
* otherwise a negative error value
*
* @retval #CONTACTS_ERROR_NONE Successful
- * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CONTACTS_ERROR_DB Database operation failure
* @retval #CONTACTS_ERROR_IPC IPC error
+ * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CONTACTS_ERROR_SYSTEM System error
+ * @retval #CONTACTS_ERROR_DB Database operation failure
*
* @see contacts_connect_on_thread()
*/
* otherwise a negative error value
*
* @retval #CONTACTS_ERROR_NONE Successful
- * @retval #CONTACTS_ERROR_DB Database operation failure
- * @retval #CONTACTS_ERROR_IPC_NOT_AVALIABLE IPC server is not available
* @retval #CONTACTS_ERROR_IPC IPC error
+ * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #CONTACTS_ERROR_SYSTEM System error
- * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
+ * @retval #CONTACTS_ERROR_INTERNAL Internal error
*
* @see contacts_disconnect()
*/