4 * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
5 * Copyright (c) 2013 Intel Corporation. All rights reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include "dtapi_manager.h"
21 #include "dtapi_util.h"
25 #define AC_MANAGER "telephony_framework::api_manager"
28 dtapi_manager_get_modems(TelephonyManager *mgr, GDBusMethodInvocation *invocation,
31 GSList *cp_name_list, *temp_list;
34 const char *name = NULL;
37 cp_name_list = tcore_server_get_modem_plugin_list(server);
38 if (cp_name_list == NULL) {
39 err("Modem List is NULL");
40 telephony_manager_complete_get_modems(mgr, invocation, NULL);
44 count = g_slist_length(cp_name_list);
45 list = g_try_malloc0(sizeof(gchar *) * (count+1));
48 temp_list = cp_name_list;
49 for ( ; cp_name_list ; cp_name_list = cp_name_list->next) {
50 name = cp_name_list->data;
51 list[count] = g_strdup(name);
52 dbg("list[%d]: %s", count, list[count]);
56 telephony_manager_complete_get_modems(mgr, invocation, (const gchar **)list);
59 for (;count > 0; count--)
64 /* Freeing the received list of CP names */
65 g_slist_free_full(temp_list, g_free);
68 TelephonyManager *dtapi_manager_new(Server *server)
70 TelephonyManager *mgr = telephony_manager_skeleton_new();
71 tcore_check_return_value_assert(NULL != mgr, NULL);
73 g_signal_connect(mgr, "handle-get-modems",
74 G_CALLBACK(dtapi_manager_get_modems), server);