4 * Copyright (c) 2014 - 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.
23 #include "service_adaptor_errors.h"
24 #include "service_adaptor_internal.h"
27 //******************************************************************************
28 //* Global variables and defines
29 //******************************************************************************
31 //******************************************************************************
33 //******************************************************************************
35 //******************************************************************************
36 //* Private interface definition
37 //******************************************************************************
39 //******************************************************************************
40 //* Public interface definition
41 //******************************************************************************
43 API char *ipc_insure_g_variant_dup_string(GVariant *string)
45 char *ret = g_variant_dup_string(string, NULL);
47 if (0 == strcmp(ret, ""))
55 API void ipc_insure_g_variant_builder_add_array_string(GVariantBuilder *builder, const char *str)
59 g_variant_builder_add(builder, "(s)", "");
63 g_variant_builder_add(builder, "(s)", str);
67 API char *ipc_make_return_type(const char *type)
69 return g_strdup_printf("(%sis)", SAL_IPC_STR(type));
72 API void ipc_create_error_msg(int code, char **ipc_msg)
76 case SERVICE_ADAPTOR_ERROR_NONE:
81 case SERVICE_ADAPTOR_ERROR_INTERNAL:
83 *ipc_msg = strdup("SERVICE_ADAPTOR_ERROR_INTERNAL");
88 *ipc_msg = strdup("SERVICE_ADAPTOR_ERROR_UNKNOWN");
94 API void ipc_create_variant_info(GVariant *parameters, int size, GVariant ***var_info)
96 for (size_t i = 0; i < size; i++)
98 *(var_info +i) = (GVariant **) g_variant_get_child_value(parameters, i);
102 API void ipc_destroy_variant_info(GVariant **var_info, int size)
104 for (size_t i = 0; i < size; i++)
106 g_variant_unref(var_info[i]);
110 API void ipc_free_reply_data(ipc_reply_data_h reply)
114 RET_IF(NULL == reply);
116 SAL_FREE(reply->type);