--- /dev/null
+/*
+ * Network Configuration Module
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * This file implements wifi direct manager main functions.
+ *
+ * @file wifi-direct-main.c
+ * @author Jiung Yu (jiung.yu@samsung.com)
+ * @version 0.1
+ */
+#include <glib.h>
+
+#include <wifi-direct.h>
+
+#include "wifi-direct-ipc.h"
+#include "wifi-direct-log.h"
+#include "wifi-direct-oem.h"
+#include "wifi-direct-manager.h"
+
+
+int main(int argc, char *argv[])
+{
+ __WDS_LOG_FUNC_ENTER__;
+ GMainLoop *main_loop = NULL;
+ wfd_manager_s *manager = NULL;
+
+#if !GLIB_CHECK_VERSION(2, 32, 0)
+ if (!g_thread_supported())
+ g_thread_init(NULL);
+#endif
+
+#if !GLIB_CHECK_VERSION(2, 36, 0)
+ g_type_init();
+#endif
+
+ if (wfd_manager_load() < 0) {
+ WDS_LOGE("Failed to initialize wifi-direct manager");
+ __WDS_LOG_FUNC_EXIT__;
+ return -1;
+ }
+ manager = wfd_get_manager();
+ if (!manager) {
+ WDS_LOGE("Failed to initialize wifi-direct manager");
+ __WDS_LOG_FUNC_EXIT__;
+ return -1;
+ }
+
+ main_loop = g_main_loop_new(NULL, FALSE);
+ if (main_loop == NULL) {
+ WDS_LOGE("Failed to create GMainLoop structure");
+ __WDS_LOG_FUNC_EXIT__;
+ return -1;
+ }
+ manager->main_loop = main_loop;
+ g_main_loop_run(main_loop);
+
+ wfd_manager_unload();
+
+ __WDS_LOG_FUNC_EXIT__;
+ return 0;
+}
}
#endif /* TIZEN_ENABLE_PRD */
-int main(int argc, char *argv[])
+int wfd_manager_load()
{
__WDS_LOG_FUNC_ENTER__;
- GMainLoop *main_loop = NULL;
-
-#if !GLIB_CHECK_VERSION(2, 32, 0)
- if (!g_thread_supported())
- g_thread_init(NULL);
-#endif
-
-#if !GLIB_CHECK_VERSION(2, 36, 0)
- g_type_init();
-#endif
/* TODO: Parsing argument */
/* Wi-Fi direct connection for S-Beam can be optimized using argument */
return -1;
}
- main_loop = g_main_loop_new(NULL, FALSE);
- if (main_loop == NULL) {
- WDS_LOGE("Failed to create GMainLoop structure");
- __WDS_LOG_FUNC_EXIT__;
- return -1;
- }
- g_manager->main_loop = main_loop;
- g_main_loop_run(main_loop);
-
+ __WDS_LOG_FUNC_EXIT__;
+ return 0;
+}
+void wfd_manager_unload()
+{
+ __WDS_LOG_FUNC_ENTER__;
wfd_manager_dbus_unregister_nameowner_signal();
wfd_manager_dbus_unregister();
wfd_plugin_deinit(g_manager);
wfd_manager_deinit(g_manager);
-
__WDS_LOG_FUNC_EXIT__;
- return 0;
+ return;
}