2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 /* This is infrastructral, shared function for all bt-* / *.c files. */
22 #include "bt-internal-types.h"
24 bool is_battery_monitor_enabled = false;
26 tizen_profile_t profile = _PROFILE_UNKNOWN;
28 bt_plugin_info_t *headed_plugin_info = NULL;
30 void bluetooth_plugin_init()
32 headed_plugin_info = g_malloc0(sizeof(bt_plugin_info_t));
33 if (!headed_plugin_info)
36 /* check ARCH 64 or 32*/
37 if (!access(FILEPATH_ARCH_64, 0))
38 headed_plugin_info->handle_headed = dlopen(HEADED_PLUGIN_FILEPATH64, RTLD_NOW);
40 headed_plugin_info->handle_headed = dlopen(HEADED_PLUGIN_FILEPATH, RTLD_NOW);
42 if (!headed_plugin_info->handle_headed) {
43 headed_plugin_info->plugin_headed_enabled = FALSE;
47 headed_plugin_info->headed_plugin = dlsym(headed_plugin_info->handle_headed, "headed_plugin");
48 if (!headed_plugin_info->headed_plugin) {
49 dlclose(headed_plugin_info->handle_headed);
50 headed_plugin_info->plugin_headed_enabled = FALSE;
54 headed_plugin_info->plugin_headed_enabled = TRUE;
57 void bluetooth_plugin_deinit()
59 if (!headed_plugin_info->plugin_headed_enabled) {
60 g_free(headed_plugin_info);
61 headed_plugin_info = NULL;
65 dlclose(headed_plugin_info->handle_headed);
66 headed_plugin_info->plugin_headed_enabled = FALSE;
67 g_free(headed_plugin_info);
68 headed_plugin_info = NULL;