4 * Copyright (c) 2010 - 2012 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.
23 #include "ctsvc_internal.h"
24 #include "ctsvc_ipc_define.h"
25 #include "ctsvc_client_ipc.h"
26 #include <pims-ipc-data.h>
27 #include "ctsvc_ipc_marshal.h"
29 API int contacts_phone_log_reset_statistics(void)
31 int ret = CONTACTS_ERROR_NONE;
33 pims_ipc_data_h indata = NULL;
34 pims_ipc_data_h outdata = NULL;
36 RETVM_IF(ctsvc_get_ipc_handle() == NULL,CONTACTS_ERROR_IPC,"contacts not connected");
39 indata = pims_ipc_data_create(0);
42 CTS_ERR("ipc data created fail!");
43 ret = CONTACTS_ERROR_OUT_OF_MEMORY;
48 if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE, CTSVC_IPC_SERVER_PHONELOG_RESET_STATISTICS, indata, &outdata) != 0)
50 CTS_ERR("ctsvc_ipc_call failed");
51 return CONTACTS_ERROR_IPC;
56 pims_ipc_data_destroy(indata);
62 unsigned int size = 0;
63 ret = *(int*) pims_ipc_data_get(outdata, &size);
65 if (CONTACTS_ERROR_NONE == ret) {
66 int transaction_ver = 0;
67 transaction_ver = *(int*)pims_ipc_data_get(outdata,&size);
68 ctsvc_client_ipc_set_change_version(transaction_ver);
71 pims_ipc_data_destroy(outdata);
78 API int contacts_phone_log_delete(contacts_phone_log_delete_e op, ...)
80 int ret = CONTACTS_ERROR_NONE;
82 pims_ipc_data_h indata = NULL;
83 pims_ipc_data_h outdata = NULL;
89 RETVM_IF(ctsvc_get_ipc_handle() == NULL,CONTACTS_ERROR_IPC, "contacts not connected");
91 indata = pims_ipc_data_create(0);
93 CTS_ERR("ipc data created fail!");
94 ret = CONTACTS_ERROR_OUT_OF_MEMORY;
95 pims_ipc_data_destroy(indata);
99 ret = ctsvc_ipc_marshal_int( op, indata);
100 if (ret != CONTACTS_ERROR_NONE) {
101 CTS_ERR("ctsvc_ipc_marshal_int fail");
102 pims_ipc_data_destroy(indata);
107 case CONTACTS_PHONE_LOG_DELETE_BY_ADDRESS:
109 number = va_arg(args, char *);
111 RETV_IF(NULL == number, CONTACTS_ERROR_INVALID_PARAMETER);
112 ret = ctsvc_ipc_marshal_string( number, indata);
113 if (ret != CONTACTS_ERROR_NONE) {
114 CTS_ERR("ctsvc_ipc_marshal_string fail");
115 pims_ipc_data_destroy(indata);
119 case CONTACTS_PHONE_LOG_DELETE_BY_MESSAGE_EXTRA_DATA1:
120 case CONTACTS_PHONE_LOG_DELETE_BY_EMAIL_EXTRA_DATA1:
122 extra_data1 = va_arg(args, int);
124 ret = ctsvc_ipc_marshal_int( extra_data1, indata);
125 if (ret != CONTACTS_ERROR_NONE) {
126 CTS_ERR("ctsvc_ipc_marshal_int fail");
127 pims_ipc_data_destroy(indata);
132 CTS_ERR("Invalid parameter : operation is not proper (%d)", ret);
133 pims_ipc_data_destroy(indata);
134 return CONTACTS_ERROR_INVALID_PARAMETER;
137 if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE,
138 CTSVC_IPC_SERVER_PHONELOG_DELETE, indata, &outdata) != 0) {
139 CTS_ERR("ctsvc_ipc_call failed");
140 pims_ipc_data_destroy(indata);
141 return CONTACTS_ERROR_IPC;
144 pims_ipc_data_destroy(indata);
147 unsigned int size = 0;
148 ret = *(int*) pims_ipc_data_get(outdata, &size);
150 if (CONTACTS_ERROR_NONE == ret) {
151 int transaction_ver = 0;
152 transaction_ver = *(int*)pims_ipc_data_get(outdata,&size);
153 ctsvc_client_ipc_set_change_version(transaction_ver);
156 pims_ipc_data_destroy(outdata);