Blame profiles/sap/manager.c

Packit 34410b
/*
Packit 34410b
 *  BlueZ - Bluetooth protocol stack for Linux
Packit 34410b
 *
Packit 34410b
 *  Copyright (C) 2010 Instituto Nokia de Tecnologia - INdT
Packit 34410b
 *
Packit 34410b
 *  This program is free software; you can redistribute it and/or modify
Packit 34410b
 *  it under the terms of the GNU General Public License as published by
Packit 34410b
 *  the Free Software Foundation; either version 2 of the License, or
Packit 34410b
 *  (at your option) any later version.
Packit 34410b
 *
Packit 34410b
 *  This program is distributed in the hope that it will be useful,
Packit 34410b
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 34410b
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 34410b
 *  GNU General Public License for more details.
Packit 34410b
 *
Packit 34410b
 *  You should have received a copy of the GNU General Public License
Packit 34410b
 *  along with this program; if not, write to the Free Software
Packit 34410b
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 34410b
 */
Packit 34410b
Packit 34410b
#ifdef HAVE_CONFIG_H
Packit 34410b
#include <config.h>
Packit 34410b
#endif
Packit 34410b
Packit 34410b
#include <stdbool.h>
Packit 34410b
Packit 34410b
#include "lib/bluetooth.h"
Packit 34410b
#include "lib/sdp.h"
Packit 34410b
Packit 34410b
#include "src/log.h"
Packit 34410b
#include "src/adapter.h"
Packit 34410b
#include "src/device.h"
Packit 34410b
#include "src/profile.h"
Packit 34410b
#include "src/service.h"
Packit 34410b
Packit 34410b
#include "manager.h"
Packit 34410b
#include "server.h"
Packit 34410b
Packit 34410b
static int sap_server_probe(struct btd_profile *p, struct btd_adapter *adapter)
Packit 34410b
{
Packit 34410b
	DBG("path %s", adapter_get_path(adapter));
Packit 34410b
Packit 34410b
	return sap_server_register(adapter);
Packit 34410b
}
Packit 34410b
Packit 34410b
static void sap_server_remove(struct btd_profile *p,
Packit 34410b
						struct btd_adapter *adapter)
Packit 34410b
{
Packit 34410b
	const char *path = adapter_get_path(adapter);
Packit 34410b
Packit 34410b
	DBG("path %s", path);
Packit 34410b
Packit 34410b
	sap_server_unregister(path);
Packit 34410b
}
Packit 34410b
Packit 34410b
static struct btd_profile sap_profile = {
Packit 34410b
	.name		= "sap-server",
Packit 34410b
	.adapter_probe	= sap_server_probe,
Packit 34410b
	.adapter_remove	= sap_server_remove,
Packit 34410b
};
Packit 34410b
Packit 34410b
int sap_manager_init(void)
Packit 34410b
{
Packit 34410b
	btd_profile_register(&sap_profile);
Packit 34410b
Packit 34410b
	return 0;
Packit 34410b
}
Packit 34410b
Packit 34410b
void sap_manager_exit(void)
Packit 34410b
{
Packit 34410b
	btd_profile_unregister(&sap_profile);
Packit 34410b
}