4 * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include "ctsvc_internal.h"
22 #include "ctsvc_mutex.h"
23 #include "ctsvc_socket.h"
25 EXPORT_API int contacts_sim_import_all_contacts()
27 CHECK_CONTACT_SUPPORTED(CONTACT_FEATURE);
29 WARN(DEPRECATED_STRING_FORMAT, __FUNCTION__);
31 ctsvc_mutex_lock(CTS_MUTEX_SOCKET_FD);
32 ret = ctsvc_request_sim_import(0, NULL, NULL);
33 ctsvc_mutex_unlock(CTS_MUTEX_SOCKET_FD);
38 EXPORT_API int contacts_sim_get_initialization_status(bool *completed)
40 CHECK_CONTACT_SUPPORTED(CONTACT_FEATURE);
42 WARN(DEPRECATED_STRING_FORMAT, __FUNCTION__);
43 RETV_IF(NULL == completed, CONTACTS_ERROR_INVALID_PARAMETER);
45 ctsvc_mutex_lock(CTS_MUTEX_SOCKET_FD);
46 ret = ctsvc_request_sim_get_initialization_status(0, completed);
47 ctsvc_mutex_unlock(CTS_MUTEX_SOCKET_FD);
52 EXPORT_API int contacts_sim_import_all_contacts_by_sim_slot_no(int sim_slot_no,
53 contacts_sim_import_progress_cb callback, void *user_data)
55 CHECK_CONTACT_SUPPORTED(CONTACT_FEATURE);
58 RETV_IF(sim_slot_no < 0, CONTACTS_ERROR_INVALID_PARAMETER);
60 ctsvc_mutex_lock(CTS_MUTEX_SOCKET_FD);
61 ret = ctsvc_request_sim_import(sim_slot_no, callback, user_data);
62 ctsvc_mutex_unlock(CTS_MUTEX_SOCKET_FD);
67 EXPORT_API int contacts_sim_get_initialization_status_by_sim_slot_no(int sim_slot_no, bool *completed)
69 CHECK_CONTACT_SUPPORTED(CONTACT_FEATURE);
72 RETV_IF(NULL == completed, CONTACTS_ERROR_INVALID_PARAMETER);
73 RETV_IF(sim_slot_no < 0, CONTACTS_ERROR_INVALID_PARAMETER);
75 ctsvc_mutex_lock(CTS_MUTEX_SOCKET_FD);
76 ret = ctsvc_request_sim_get_initialization_status(sim_slot_no, completed);
77 ctsvc_mutex_unlock(CTS_MUTEX_SOCKET_FD);