summaryrefslogtreecommitdiff
path: root/cras/src/server/cras_bt_endpoint.h
blob: 963071ca8548f3af265b3015141497ac5b86ef7e (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
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef CRAS_BT_ENDPOINT_H_
#define CRAS_BT_ENDPOINT_H_

#include <dbus/dbus.h>
#include <stdint.h>

#include "cras_bt_adapter.h"

struct cras_bt_transport;

struct cras_bt_endpoint {
	const char *object_path;
	const char *uuid;
	uint8_t codec;

	int (*get_capabilities)(struct cras_bt_endpoint *endpoint,
				void *capabilities, int *len);
	int (*select_configuration)(struct cras_bt_endpoint *endpoint,
				    void *capabilities, int len,
				    void *configuration);

	void (*set_configuration)(struct cras_bt_endpoint *endpoint,
				  struct cras_bt_transport *transport);
	void (*suspend)(struct cras_bt_endpoint *endpoint,
			struct cras_bt_transport *transport);

	void (*transport_state_changed)(struct cras_bt_endpoint *endpoint,
					struct cras_bt_transport *transport);

	struct cras_bt_transport *transport;
	struct cras_bt_endpoint *prev, *next;
};

int cras_bt_register_endpoint(DBusConnection *conn,
			      const struct cras_bt_adapter *adapter,
			      struct cras_bt_endpoint *endpoint);

int cras_bt_unregister_endpoint(DBusConnection *conn,
				const struct cras_bt_adapter *adapter,
				struct cras_bt_endpoint *endpoint);

int cras_bt_register_endpoints(DBusConnection *conn,
			       const struct cras_bt_adapter *adapter);

int cras_bt_endpoint_add(DBusConnection *conn,
			 struct cras_bt_endpoint *endpoint);
void cras_bt_endpoint_rm(DBusConnection *conn,
			 struct cras_bt_endpoint *endpoint);

void cras_bt_endpoint_reset();

struct cras_bt_endpoint *cras_bt_endpoint_get(const char *object_path);

#endif /* CRAS_BT_ENDPOINT_H_ */