1 /** @file
2  *  @brief Internal APIs for Bluetooth Handsfree profile handling.
3  */
4 
5 /*
6  * Copyright (c) 2015-2016 Intel Corporation
7  *
8  * SPDX-License-Identifier: Apache-2.0
9  */
10 
11 #define BT_HFP_MAX_MTU           140
12 #define BT_HF_CLIENT_MAX_PDU     BT_HFP_MAX_MTU
13 
14 /* HFP AG Features */
15 #define BT_HFP_AG_FEATURE_3WAY_CALL     0x00000001 /* Three-way calling */
16 #define BT_HFP_AG_FEATURE_ECNR          0x00000002 /* EC and/or NR function */
17 #define BT_HFP_AG_FEATURE_VOICE_RECG    0x00000004 /* Voice recognition */
18 #define BT_HFP_AG_INBAND_RING_TONE      0x00000008 /* In-band ring capability */
19 #define BT_HFP_AG_VOICE_TAG             0x00000010 /* Attach no. to voice tag */
20 #define BT_HFP_AG_FEATURE_REJECT_CALL   0x00000020 /* Ability to reject call */
21 #define BT_HFP_AG_FEATURE_ECS           0x00000040 /* Enhanced call status */
22 #define BT_HFP_AG_FEATURE_ECC           0x00000080 /* Enhanced call control */
23 #define BT_HFP_AG_FEATURE_EXT_ERR       0x00000100 /* Extented error codes */
24 #define BT_HFP_AG_FEATURE_CODEC_NEG     0x00000200 /* Codec negotiation */
25 #define BT_HFP_AG_FEATURE_HF_IND        0x00000400 /* HF Indicators */
26 #define BT_HFP_AG_FEARTURE_ESCO_S4      0x00000800 /* eSCO S4 Settings */
27 
28 /* HFP HF Features */
29 #define BT_HFP_HF_FEATURE_ECNR          0x00000001 /* EC and/or NR */
30 #define BT_HFP_HF_FEATURE_3WAY_CALL     0x00000002 /* Three-way calling */
31 #define BT_HFP_HF_FEATURE_CLI           0x00000004 /* CLI presentation */
32 #define BT_HFP_HF_FEATURE_VOICE_RECG    0x00000008 /* Voice recognition */
33 #define BT_HFP_HF_FEATURE_VOLUME        0x00000010 /* Remote volume control */
34 #define BT_HFP_HF_FEATURE_ECS           0x00000020 /* Enhanced call status */
35 #define BT_HFP_HF_FEATURE_ECC           0x00000040 /* Enhanced call control */
36 #define BT_HFP_HF_FEATURE_CODEC_NEG     0x00000080 /* CODEC Negotiation */
37 #define BT_HFP_HF_FEATURE_HF_IND        0x00000100 /* HF Indicators */
38 #define BT_HFP_HF_FEATURE_ESCO_S4       0x00000200 /* eSCO S4 Settings */
39 
40 /* HFP HF Supported features */
41 #define BT_HFP_HF_SUPPORTED_FEATURES    (BT_HFP_HF_FEATURE_CLI | \
42 					 BT_HFP_HF_FEATURE_VOLUME)
43 
44 #define HF_MAX_BUF_LEN                  BT_HF_CLIENT_MAX_PDU
45 #define HF_MAX_AG_INDICATORS            20
46 
47 struct bt_hfp_hf {
48 	struct bt_rfcomm_dlc rfcomm_dlc;
49 	char hf_buffer[HF_MAX_BUF_LEN];
50 	struct at_client at;
51 	bt_u32_t hf_features;
52 	bt_u32_t ag_features;
53 	s8_t ind_table[HF_MAX_AG_INDICATORS];
54 };
55 
56 enum hfp_hf_ag_indicators {
57 	HF_SERVICE_IND,
58 	HF_CALL_IND,
59 	HF_CALL_SETUP_IND,
60 	HF_CALL_HELD_IND,
61 	HF_SINGNAL_IND,
62 	HF_ROAM_IND,
63 	HF_BATTERY_IND
64 };
65