3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2011 Nokia Corporation
6 * Copyright (C) 2011 Marcel Holtmann <marcel@holtmann.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 #include "gdbus/gdbus.h"
36 #include "src/plugin.h"
39 static GKeyFile *config = NULL;
41 static GKeyFile *open_config_file(const char *file)
46 keyfile = g_key_file_new();
48 g_key_file_set_list_separator(keyfile, ',');
50 if (!g_key_file_load_from_file(keyfile, file, 0, &gerr)) {
51 if (!g_error_matches(gerr, G_FILE_ERROR, G_FILE_ERROR_NOENT))
52 error("Parsing %s failed: %s", file, gerr->message);
54 g_key_file_free(keyfile);
61 static int proximity_init(void)
63 config = open_config_file(CONFIGDIR "/proximity.conf");
65 if (proximity_manager_init(config) < 0)
71 static void proximity_exit(void)
74 g_key_file_free(config);
76 proximity_manager_exit();
79 BLUETOOTH_PLUGIN_DEFINE(proximity, VERSION,
80 BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
81 proximity_init, proximity_exit)