1 /* 2 * BlueZ - Bluetooth protocol stack for Linux 3 * 4 * Copyright (C) 2010 Instituto Nokia de Tecnologia - INdT 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifdef HAVE_CONFIG_H 22 #include <config.h> 23 #endif 24 25 #include <errno.h> 26 #include <gdbus.h> 27 #include "plugin.h" 28 #include "manager.h" 29 30 static DBusConnection *connection; 31 32 static int sap_init(void) 33 { 34 connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 35 36 if (!connection) 37 return -EIO; 38 39 if (sap_manager_init(connection) < 0) { 40 dbus_connection_unref(connection); 41 return -EIO; 42 } 43 44 return 0; 45 } 46 47 static void sap_exit(void) 48 { 49 sap_manager_exit(); 50 51 dbus_connection_unref(connection); 52 } 53 54 BLUETOOTH_PLUGIN_DEFINE(sap, VERSION, 55 BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, sap_init, sap_exit) 56