3 * neard - Near Field Communication manager
5 * Copyright (C) 2011 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
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.
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
36 static DBusConnection *connection;
38 int __near_manager_adapter_add(uint32_t idx, const char *name,
39 uint32_t protocols, bool powered)
41 struct near_adapter *adapter;
47 adapter = __near_adapter_create(idx, name, protocols, powered);
51 path = __near_adapter_get_path(adapter);
53 __near_adapter_destroy(adapter);
57 err = __near_adapter_add(adapter);
59 __near_adapter_destroy(adapter);
64 void __near_manager_adapter_remove(uint32_t idx)
66 struct near_adapter *adapter;
71 adapter = __near_adapter_get(idx);
75 path = __near_adapter_get_path(adapter);
79 __near_adapter_remove(adapter);
82 int __near_manager_init(DBusConnection *conn)
86 connection = dbus_connection_ref(conn);
88 DBG("connection %p", connection);
90 g_dbus_attach_object_manager(connection);
92 return __near_netlink_get_adapters();
95 void __near_manager_cleanup(void)
99 g_dbus_detach_object_manager(connection);
101 dbus_connection_unref(connection);