• 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_HFP_SLC_H_
7 #define CRAS_HFP_SLC_H_
8 
9 struct hfp_slc_handle;
10 
11 /* Callback to call when service level connection initialized. */
12 typedef int (*hfp_slc_init_cb)(struct hfp_slc_handle *handle);
13 
14 /* Callback to call when service level connection disconnected. */
15 typedef int (*hfp_slc_disconnect_cb)(struct hfp_slc_handle *handle);
16 
17 /* Creates an hfp_slc_handle to poll the RFCOMM file descriptor
18  * to read and handle received AT commands.
19  * Args:
20  *    fd - the rfcomm fd used to initialize service level connection
21  *    is_hsp - if the slc handle is created for headset profile
22  *    device - The bt device associated with the created slc object
23  *    init_cb - the callback function to be triggered when a service level
24  *        connection is initialized.
25  *    disconnect_cb - the callback function to be triggered when the service
26  *        level connection is disconnected.
27  */
28 struct hfp_slc_handle *hfp_slc_create(int fd, int is_hsp,
29 				      struct cras_bt_device *device,
30 				      hfp_slc_init_cb init_cb,
31 				      hfp_slc_disconnect_cb disconnect_cb);
32 
33 /* Destroys an hfp_slc_handle. */
34 void hfp_slc_destroy(struct hfp_slc_handle *handle);
35 
36 /* Sets the call status to notify handsfree device. */
37 int hfp_set_call_status(struct hfp_slc_handle *handle, int call);
38 
39 /* Fakes the incoming call event for qualification test. */
40 int hfp_event_incoming_call(struct hfp_slc_handle *handle,
41 			    const char *number,
42 			    int type);
43 
44 /* Handles the call status changed event.
45  * AG will send notification to HF accordingly. */
46 int hfp_event_update_call(struct hfp_slc_handle *handle);
47 
48 /* Handles the call setup status changed event.
49  * AG will send notification to HF accordingly. */
50 int hfp_event_update_callsetup(struct hfp_slc_handle *handle);
51 
52 /* Handles the call held status changed event.
53  * AG will send notification to HF accordingly. */
54 int hfp_event_update_callheld(struct hfp_slc_handle *handle);
55 
56 /* Sets battery level which is required for qualification test. */
57 int hfp_event_set_battery(struct hfp_slc_handle *handle, int value);
58 
59 /* Sets signal strength which is required for qualification test. */
60 int hfp_event_set_signal(struct hfp_slc_handle *handle, int value);
61 
62 /* Sets service availability which is required for qualification test. */
63 int hfp_event_set_service(struct hfp_slc_handle *handle, int value);
64 
65 /* Sets speaker gain value to headsfree device. */
66 int hfp_event_speaker_gain(struct hfp_slc_handle *handle, int gain);
67 
68 #endif /* CRAS_HFP_SLC_H_ */
69