• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef CRAS_BT_ENDPOINT_H_
7 #define CRAS_BT_ENDPOINT_H_
8 
9 #include <dbus/dbus.h>
10 #include <stdint.h>
11 
12 #include "cras_bt_adapter.h"
13 
14 struct cras_bt_transport;
15 
16 struct cras_bt_endpoint {
17 	const char *object_path;
18 	const char *uuid;
19 	uint8_t codec;
20 
21 	int (*get_capabilities)(struct cras_bt_endpoint *endpoint,
22 				void *capabilities, int *len);
23 	int (*select_configuration)(struct cras_bt_endpoint *endpoint,
24 				    void *capabilities, int len,
25 				    void *configuration);
26 
27 	void (*set_configuration)(struct cras_bt_endpoint *endpoint,
28 				  struct cras_bt_transport *transport);
29 	void (*suspend)(struct cras_bt_endpoint *endpoint,
30 			struct cras_bt_transport *transport);
31 
32 	void (*transport_state_changed)(struct cras_bt_endpoint *endpoint,
33 					struct cras_bt_transport *transport);
34 
35 	struct cras_bt_transport *transport;
36 	struct cras_bt_endpoint *prev, *next;
37 };
38 
39 int cras_bt_register_endpoint(DBusConnection *conn,
40 			      const struct cras_bt_adapter *adapter,
41 			      struct cras_bt_endpoint *endpoint);
42 
43 int cras_bt_unregister_endpoint(DBusConnection *conn,
44 				const struct cras_bt_adapter *adapter,
45 				struct cras_bt_endpoint *endpoint);
46 
47 int cras_bt_register_endpoints(DBusConnection *conn,
48 			       const struct cras_bt_adapter *adapter);
49 
50 int cras_bt_endpoint_add(DBusConnection *conn,
51 			 struct cras_bt_endpoint *endpoint);
52 void cras_bt_endpoint_rm(DBusConnection *conn,
53 			 struct cras_bt_endpoint *endpoint);
54 
55 void cras_bt_endpoint_reset();
56 
57 struct cras_bt_endpoint *cras_bt_endpoint_get(const char *object_path);
58 
59 #endif /* CRAS_BT_ENDPOINT_H_ */
60