mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 08:44:38 +08:00
Remove server.h and server.c files.
This commit is contained in:
parent
b32c90dc0a
commit
2a4471c4b0
@ -37,7 +37,8 @@
|
||||
#include <gdbus.h>
|
||||
|
||||
#include "plugin.h"
|
||||
#include "server.h"
|
||||
#include "adapter.h"
|
||||
#include "driver.h"
|
||||
#include "logging.h"
|
||||
|
||||
static gboolean session_event(GIOChannel *chan,
|
||||
@ -123,24 +124,28 @@ static GIOChannel *setup_rfcomm(uint8_t channel)
|
||||
|
||||
static GIOChannel *chan = NULL;
|
||||
|
||||
static int echo_probe(const char *adapter)
|
||||
static int echo_probe(struct adapter *adapter)
|
||||
{
|
||||
debug("echo probe adapter %s", adapter);
|
||||
const char *path = adapter_get_path(adapter);
|
||||
|
||||
DBG("path %s", path);
|
||||
|
||||
chan = setup_rfcomm(23);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void echo_remove(const char *adapter)
|
||||
static void echo_remove(struct adapter *adapter)
|
||||
{
|
||||
debug("echo remove adapter %s", adapter);
|
||||
const char *path = adapter_get_path(adapter);
|
||||
|
||||
DBG("path %s", path);
|
||||
|
||||
g_io_channel_unref(chan);
|
||||
}
|
||||
|
||||
static struct bt_server echo_server = {
|
||||
.uuid = "00001101-0000-1000-8000-00805F9B34FB",
|
||||
static struct btd_adapter_driver echo_server = {
|
||||
.name = "echo-server",
|
||||
.probe = echo_probe,
|
||||
.remove = echo_remove,
|
||||
};
|
||||
@ -149,14 +154,14 @@ static int echo_init(void)
|
||||
{
|
||||
debug("Setup echo plugin");
|
||||
|
||||
return bt_register_server(&echo_server);
|
||||
return btd_register_adapter_driver(&echo_server);
|
||||
}
|
||||
|
||||
static void echo_exit(void)
|
||||
{
|
||||
debug("Cleanup echo plugin");
|
||||
|
||||
bt_unregister_server(&echo_server);
|
||||
btd_unregister_adapter_driver(&echo_server);
|
||||
}
|
||||
|
||||
BLUETOOTH_PLUGIN_DEFINE("echo", echo_init, echo_exit)
|
||||
|
@ -18,7 +18,7 @@ sbin_PROGRAMS = bluetoothd
|
||||
bluetoothd_SOURCES = main.c hcid.h sdpd.h \
|
||||
sdpd-server.c sdpd-request.c sdpd-service.c \
|
||||
sdpd-database.c security.c storage.c \
|
||||
manager.h manager.c error.h error.c server.h server.c \
|
||||
manager.h manager.c error.h error.c \
|
||||
adapter.h adapter.c device.h device.c plugin.h plugin.c \
|
||||
dbus-common.c dbus-common.h dbus-hci.h dbus-hci.c \
|
||||
dbus-database.c dbus-database.h dbus-service.c dbus-service.h \
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include <gdbus.h>
|
||||
|
||||
#include "hcid.h"
|
||||
#include "server.h"
|
||||
#include "dbus-common.h"
|
||||
#include "error.h"
|
||||
#include "manager.h"
|
||||
|
@ -39,14 +39,12 @@ int btd_register_device_driver(struct btd_device_driver *driver);
|
||||
void btd_unregister_device_driver(struct btd_device_driver *driver);
|
||||
GSList *btd_get_device_drivers(void);
|
||||
|
||||
struct btd_adapter;
|
||||
struct adapter;
|
||||
|
||||
struct btd_adapter_driver {
|
||||
const char *name;
|
||||
int (*probe) (struct btd_adapter_driver *driver,
|
||||
struct btd_adapter *adapter);
|
||||
void (*remove) (struct btd_adapter_driver *driver,
|
||||
struct btd_adapter *adapter);
|
||||
int (*probe) (struct adapter *adapter);
|
||||
void (*remove) (struct adapter *adapter);
|
||||
};
|
||||
|
||||
int btd_register_adapter_driver(struct btd_adapter_driver *driver);
|
||||
|
@ -452,7 +452,7 @@ int manager_register_adapter(int id)
|
||||
struct btd_adapter_driver *driver = l->data;
|
||||
|
||||
if (driver->probe)
|
||||
driver->probe(driver, (struct btd_adapter *) adapter);
|
||||
driver->probe(adapter);
|
||||
}
|
||||
|
||||
manager_add_adapter(adapter);
|
||||
@ -478,7 +478,7 @@ int manager_unregister_adapter(int id)
|
||||
struct btd_adapter_driver *driver = l->data;
|
||||
|
||||
if (driver->remove)
|
||||
driver->remove(driver, (struct btd_adapter *) adapter);
|
||||
driver->remove(adapter);
|
||||
}
|
||||
|
||||
adapter_stop(adapter);
|
||||
|
68
src/server.c
68
src/server.c
@ -1,68 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2004-2008 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "server.h"
|
||||
|
||||
static GSList *servers = NULL;
|
||||
|
||||
int bt_register_server(struct bt_server *server)
|
||||
{
|
||||
servers = g_slist_append(servers, server);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bt_unregister_server(struct bt_server *server)
|
||||
{
|
||||
servers = g_slist_remove(servers, server);
|
||||
}
|
||||
|
||||
void __probe_servers(const char *adapter)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
for (list = servers; list; list = list->next) {
|
||||
struct bt_server *server = list->data;
|
||||
|
||||
if (server->probe)
|
||||
server->probe(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
void __remove_servers(const char *adapter)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
for (list = servers; list; list = list->next) {
|
||||
struct bt_server *server = list->data;
|
||||
|
||||
if (server->remove)
|
||||
server->remove(adapter);
|
||||
}
|
||||
}
|
31
src/server.h
31
src/server.h
@ -1,31 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2004-2008 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
struct bt_server {
|
||||
const char *uuid;
|
||||
int (*probe) (const char *adapter);
|
||||
void (*remove) (const char *adapter);
|
||||
};
|
||||
|
||||
int bt_register_server(struct bt_server *server);
|
||||
void bt_unregister_server(struct bt_server *server);
|
Loading…
Reference in New Issue
Block a user