2 * Network Configuration Module
4 * Copyright (c) 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 * This file implements wifi direct manager main functions.
23 * @file wifi-direct-main.c
24 * @author Jiung Yu (jiung.yu@samsung.com)
28 #include <glib-object.h>
30 #include <wifi-direct.h>
32 #include "wifi-direct-ipc.h"
33 #include "wifi-direct-log.h"
34 #include "wifi-direct-oem.h"
35 #include "wifi-direct-manager.h"
36 #include "wifi-direct-dbus.h"
37 #include "wifi-direct-util.h"
40 int main(int argc, char *argv[])
42 __WDS_LOG_FUNC_ENTER__;//LCOV_EXCL_LINE
43 GMainLoop *main_loop = NULL;
44 wfd_manager_s *manager = NULL;
46 #if !GLIB_CHECK_VERSION(2, 32, 0)
47 if (!g_thread_supported())
51 #if !GLIB_CHECK_VERSION(2, 36, 0)
55 if (wfd_manager_load() < 0) {
56 WDS_LOGE("Failed to initialize wifi-direct manager");
57 __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE
60 manager = wfd_get_manager();
62 WDS_LOGE("Failed to initialize wifi-direct manager");
63 __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE
68 * wfd_manager_plugin initialization
70 manager->plugin_handle = wfd_util_plugin_init(manager);
71 if (!manager->plugin_handle) {
72 WDS_LOGE("Failed to initialize plugin");
73 wfd_manager_unload(manager);
74 __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE
77 WDS_LOGD("Succeeded to load plugin");
78 #if defined TIZEN_ENABLE_PRD
80 * wfd_manager_prd_plugin initialization
82 manager->prd_plugin_handle = wfd_prd_util_plugin_init(manager);
83 if (!manager->prd_plugin_handle)
84 WDS_LOGW("Failed to initialize prd plugin");
86 WDS_LOGD("Succeeded to load plugin");
87 #endif /* TIZEN_ENABLE_PRD */
89 if (!wfd_manager_dbus_init()) {
90 WDS_LOGE("Failed to DBus");
91 wfd_util_plugin_deinit(manager);
93 __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE
97 main_loop = g_main_loop_new(NULL, FALSE);
98 if (main_loop == NULL) {
99 WDS_LOGE("Failed to create GMainLoop structure");
100 __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE
103 manager->main_loop = main_loop;
104 g_main_loop_run(main_loop);
106 wfd_manager_dbus_unregister_nameowner_signal();
108 wfd_manager_dbus_unregister();
109 wfd_manager_dbus_deinit();
111 #if defined TIZEN_ENABLE_PRD
112 wfd_util_prd_plugin_deinit(manager);
113 #endif /* TIZEN_ENABLE_PRD */
115 wfd_util_plugin_deinit(manager);
117 wfd_manager_unload();
119 __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE