2010-07-27 22:11:29 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 GSyC/LibreSoft, Universidad Rey Juan Carlos.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-12-07 18:46:04 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2012-09-03 19:11:36 +08:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2010-07-27 22:11:29 +08:00
|
|
|
#include <bluetooth/sdp.h>
|
|
|
|
#include <bluetooth/sdp_lib.h>
|
2012-05-31 21:43:33 +08:00
|
|
|
#include <bluetooth/uuid.h>
|
2010-07-27 22:11:29 +08:00
|
|
|
|
2012-12-05 19:22:53 +08:00
|
|
|
#include <btio/btio.h>
|
2010-07-27 22:11:29 +08:00
|
|
|
#include <adapter.h>
|
|
|
|
#include <device.h>
|
2012-09-10 20:32:22 +08:00
|
|
|
#include <profile.h>
|
2011-12-15 22:07:52 +08:00
|
|
|
#include <glib-helper.h>
|
|
|
|
#include <log.h>
|
2010-07-27 22:11:29 +08:00
|
|
|
|
|
|
|
#include "hdp_types.h"
|
|
|
|
|
|
|
|
#include "hdp_manager.h"
|
|
|
|
#include "hdp.h"
|
|
|
|
|
2012-09-25 19:23:57 +08:00
|
|
|
static int hdp_adapter_probe(struct btd_profile *p,
|
|
|
|
struct btd_adapter *adapter)
|
2010-07-27 22:11:29 +08:00
|
|
|
{
|
2012-09-19 18:22:13 +08:00
|
|
|
return hdp_adapter_register(adapter);
|
2010-07-27 22:11:29 +08:00
|
|
|
}
|
|
|
|
|
2012-09-25 19:23:57 +08:00
|
|
|
static void hdp_adapter_remove(struct btd_profile *p,
|
|
|
|
struct btd_adapter *adapter)
|
2010-07-27 22:11:29 +08:00
|
|
|
{
|
|
|
|
hdp_adapter_unregister(adapter);
|
|
|
|
}
|
|
|
|
|
2012-09-25 19:23:57 +08:00
|
|
|
static int hdp_driver_probe(struct btd_profile *p, struct btd_device *device,
|
|
|
|
GSList *uuids)
|
2010-07-27 22:11:29 +08:00
|
|
|
{
|
2012-09-19 18:22:13 +08:00
|
|
|
return hdp_device_register(device);
|
2010-07-27 22:11:29 +08:00
|
|
|
}
|
|
|
|
|
2012-09-25 19:23:57 +08:00
|
|
|
static void hdp_driver_remove(struct btd_profile *p, struct btd_device *device)
|
2010-07-27 22:11:29 +08:00
|
|
|
{
|
|
|
|
hdp_device_unregister(device);
|
|
|
|
}
|
|
|
|
|
2012-09-03 19:11:36 +08:00
|
|
|
static struct btd_profile hdp_profile = {
|
|
|
|
.name = "hdp-profile",
|
|
|
|
.remote_uuids = BTD_UUIDS(HDP_UUID, HDP_SOURCE_UUID, HDP_SINK_UUID),
|
|
|
|
|
|
|
|
.device_probe = hdp_driver_probe,
|
|
|
|
.device_remove = hdp_driver_remove,
|
|
|
|
|
|
|
|
.adapter_probe = hdp_adapter_probe,
|
|
|
|
.adapter_remove = hdp_adapter_remove,
|
2010-07-27 22:11:29 +08:00
|
|
|
};
|
|
|
|
|
2012-09-19 18:22:13 +08:00
|
|
|
int hdp_manager_init(void)
|
2010-07-27 22:11:29 +08:00
|
|
|
{
|
2012-09-19 18:22:13 +08:00
|
|
|
if (hdp_manager_start() < 0)
|
2010-07-27 22:11:29 +08:00
|
|
|
return -1;
|
|
|
|
|
2012-09-03 19:11:36 +08:00
|
|
|
btd_profile_register(&hdp_profile);
|
2010-07-27 22:11:29 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void hdp_manager_exit(void)
|
|
|
|
{
|
2012-09-03 19:11:36 +08:00
|
|
|
btd_profile_unregister(&hdp_profile);
|
|
|
|
|
2010-07-27 22:11:29 +08:00
|
|
|
hdp_manager_stop();
|
|
|
|
}
|