summaryrefslogtreecommitdiff
path: root/cras/src/server/cras_hfp_ag_profile.h
blob: fb58efb6e75ba74fb3afd3ee32cde26cfe9199a1 (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
/* 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_HFP_AG_PROFILE_H_
#define CRAS_HFP_AG_PROFILE_H_

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

#include "cras_bt_device.h"
#include "cras_hfp_slc.h"

/*
 * For service record profile, 'SupportedFearues' attribute bit mapping
 * for HFP AG. Bits 0 to 4 are identical to the unsolicited result code
 * of +BRSF command.
 */
#define FEATURES_AG_THREE_WAY_CALLING 0x0001
#define FEATURES_AG_EC_ANDOR_NR 0x0002
#define FEATURES_AG_VOICE_RECOGNITION 0x0004
#define FEATURES_AG_INBAND_RINGTONE 0x0008
#define FEATURES_AG_ATTACH_NUMBER_TO_VOICETAG 0x0010
#define FEATURES_AG_WIDE_BAND_SPEECH 0x0020

struct hfp_slc_handle;

/* Adds a profile instance for HFP AG (Hands-Free Profile Audio Gateway). */
int cras_hfp_ag_profile_create(DBusConnection *conn);

/* Adds a profile instance for HSP AG (Headset Profile Audio Gateway). */
int cras_hsp_ag_profile_create(DBusConnection *conn);

/* Starts the HFP audio gateway for audio input/output. */
int cras_hfp_ag_start(struct cras_bt_device *device);

/*
 * Suspends all connected audio gateways except the one associated to device.
 * Used to stop previously running HFP/HSP audio when a new device is connected.
 * Args:
 *    device - The device that we want to keep connection while others should
 *        be removed.
 */
int cras_hfp_ag_remove_conflict(struct cras_bt_device *device);

/* Suspends audio gateway associated with given bt device. */
void cras_hfp_ag_suspend_connected_device(struct cras_bt_device *device);

/* Gets the active SLC handle. Used for HFP qualification. */
struct hfp_slc_handle *cras_hfp_ag_get_active_handle();

/* Gets the SLC handle for given cras_bt_device. */
struct hfp_slc_handle *cras_hfp_ag_get_slc(struct cras_bt_device *device);

/* Iterate all possible AGs (theoratically only one) and signal its battery
 * level */
void cras_hfp_ag_resend_device_battery_level();

#endif /* CRAS_HFP_AG_PROFILE_H_ */