bluez/profiles/health/hdp_manager.c

95 lines
2.2 KiB
C
Raw Normal View History

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
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdbool.h>
2010-07-27 22:11:29 +08:00
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
#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>
#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"
static int hdp_adapter_probe(struct btd_profile *p,
struct btd_adapter *adapter)
2010-07-27 22:11:29 +08:00
{
return hdp_adapter_register(adapter);
2010-07-27 22:11:29 +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);
}
static int hdp_driver_probe(struct btd_profile *p, struct btd_device *device,
GSList *uuids)
2010-07-27 22:11:29 +08:00
{
return hdp_device_register(device);
2010-07-27 22:11:29 +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);
}
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
};
int hdp_manager_init(void)
2010-07-27 22:11:29 +08:00
{
if (hdp_manager_start() < 0)
2010-07-27 22:11:29 +08:00
return -1;
btd_profile_register(&hdp_profile);
2010-07-27 22:11:29 +08:00
return 0;
}
void hdp_manager_exit(void)
{
btd_profile_unregister(&hdp_profile);
2010-07-27 22:11:29 +08:00
hdp_manager_stop();
}