summaryrefslogtreecommitdiff
path: root/profiles/sap/manager.c
blob: 6670f397c94c78261770606f39f621bd376293c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2010 Instituto Nokia de Tecnologia - INdT
 *
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdbool.h>

#include "lib/bluetooth.h"
#include "lib/sdp.h"

#include "src/log.h"
#include "src/adapter.h"
#include "src/device.h"
#include "src/profile.h"
#include "src/service.h"

#include "manager.h"
#include "server.h"

static int sap_server_probe(struct btd_profile *p, struct btd_adapter *adapter)
{
	DBG("path %s", adapter_get_path(adapter));

	return sap_server_register(adapter);
}

static void sap_server_remove(struct btd_profile *p,
						struct btd_adapter *adapter)
{
	const char *path = adapter_get_path(adapter);

	DBG("path %s", path);

	sap_server_unregister(path);
}

static struct btd_profile sap_profile = {
	.name		= "sap-server",
	.adapter_probe	= sap_server_probe,
	.adapter_remove	= sap_server_remove,
};

int sap_manager_init(void)
{
	btd_profile_register(&sap_profile);

	return 0;
}

void sap_manager_exit(void)
{
	btd_profile_unregister(&sap_profile);
}