Blob: asha.h

Blob id: 9e62fcde89510856bdbd5b6526508604961d8aa3

Size: 1.5 KB

 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
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: LGPL-2.1-or-later
/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2024  Asymptotic Inc.
 *
 *  Author: Arun Raghavan <arun@asymptotic.io>
 *
 *
 */

#

#include <stdbool.h>
#include <stdint.h>

enum bt_asha_state_t {
	ASHA_STOPPED = 0,
	ASHA_STARTING,
	ASHA_STARTED,
};

typedef void (*bt_asha_cb_t)(int status, void *data);
typedef void (*bt_asha_attach_cb_t)(void *data);

struct bt_asha {
	struct bt_gatt_client *client;
	struct gatt_db *db;
	struct gatt_db_attribute *attr;
	uint16_t acp_handle;
	uint16_t volume_handle;
	unsigned int status_notify_id;

	uint16_t psm;
	bool right_side;
	bool binaural;
	bool csis_supported;
	bool coc_streaming_supported;
	uint8_t hisyncid[8];
	uint16_t render_delay;
	uint16_t codec_ids;
	int8_t volume;

	enum bt_asha_state_t state;
	bt_asha_cb_t state_cb;
	void *state_cb_data;

	bt_asha_attach_cb_t attach_cb;
	void *attach_cb_data;
};

struct bt_asha_set {
	uint8_t hisyncid[8];
	struct bt_asha *left;
	struct bt_asha *right;
};

struct bt_asha *bt_asha_new(void);
void bt_asha_reset(struct bt_asha *asha);
void bt_asha_state_reset(struct bt_asha *asha);
void bt_asha_free(struct bt_asha *asha);

unsigned int bt_asha_start(struct bt_asha *asha, bt_asha_cb_t cb,
							void *user_data);
unsigned int bt_asha_stop(struct bt_asha *asha);

bool bt_asha_set_volume(struct bt_asha *asha, int8_t volume);

bool bt_asha_attach(struct bt_asha *asha, struct gatt_db *db,
		struct bt_gatt_client *client, bt_asha_attach_cb_t probe_cb,
							void *cb_user_data);