xref: /btstack/src/btstack_sco_transport.h (revision 2fca4dad957cd7b88f4657ed51e89c12615dda72)
1aac27384SMatthias Ringwald /*
2aac27384SMatthias Ringwald  * Copyright (C) 2021 BlueKitchen GmbH
3aac27384SMatthias Ringwald  *
4aac27384SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5aac27384SMatthias Ringwald  * modification, are permitted provided that the following conditions
6aac27384SMatthias Ringwald  * are met:
7aac27384SMatthias Ringwald  *
8aac27384SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9aac27384SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10aac27384SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11aac27384SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12aac27384SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13aac27384SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14aac27384SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15aac27384SMatthias Ringwald  *    from this software without specific prior written permission.
16aac27384SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17aac27384SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18aac27384SMatthias Ringwald  *    monetary gain.
19aac27384SMatthias Ringwald  *
20aac27384SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21aac27384SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22aac27384SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*2fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*2fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25aac27384SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26aac27384SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27aac27384SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28aac27384SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29aac27384SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30aac27384SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31aac27384SMatthias Ringwald  * SUCH DAMAGE.
32aac27384SMatthias Ringwald  *
33aac27384SMatthias Ringwald  * Please inquire about commercial licensing options at
34aac27384SMatthias Ringwald  * [email protected]
35aac27384SMatthias Ringwald  *
36aac27384SMatthias Ringwald  */
37aac27384SMatthias Ringwald 
38fe5a6c4eSMilanka Ringwald /**
39fe5a6c4eSMilanka Ringwald  * @title SCO Transport
40fe5a6c4eSMilanka Ringwald  *
41fe5a6c4eSMilanka Ringwald  * Hardware abstraction for PCM/I2S Inteface used for HSP/HFP profiles.
42fe5a6c4eSMilanka Ringwald  *
43aac27384SMatthias Ringwald  */
44aac27384SMatthias Ringwald 
45aac27384SMatthias Ringwald #ifndef BTSTACK_SCO_TRANSPORT_H
46aac27384SMatthias Ringwald #define BTSTACK_SCO_TRANSPORT_H
47aac27384SMatthias Ringwald 
48aac27384SMatthias Ringwald #include "btstack_config.h"
49aac27384SMatthias Ringwald 
50aac27384SMatthias Ringwald #include "bluetooth.h"
51aac27384SMatthias Ringwald #include "btstack_defines.h"
52aac27384SMatthias Ringwald 
53aac27384SMatthias Ringwald #include <stdint.h>
54aac27384SMatthias Ringwald 
55aac27384SMatthias Ringwald #if defined __cplusplus
56aac27384SMatthias Ringwald extern "C" {
57aac27384SMatthias Ringwald #endif
58aac27384SMatthias Ringwald 
59aac27384SMatthias Ringwald typedef enum {
60aac27384SMatthias Ringwald     SCO_FORMAT_8_BIT,
61aac27384SMatthias Ringwald     SCO_FORMAT_16_BIT,
62aac27384SMatthias Ringwald } sco_format_t;
63aac27384SMatthias Ringwald 
64fe5a6c4eSMilanka Ringwald /* API_START */
65fe5a6c4eSMilanka Ringwald 
66aac27384SMatthias Ringwald typedef struct {
67aac27384SMatthias Ringwald 
68aac27384SMatthias Ringwald     /**
69aac27384SMatthias Ringwald      * register packet handler for SCO HCI packets
70aac27384SMatthias Ringwald      */
71aac27384SMatthias Ringwald     void (*register_packet_handler)(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));
72aac27384SMatthias Ringwald 
73aac27384SMatthias Ringwald     /**
74aac27384SMatthias Ringwald      * open transport
75aac27384SMatthias Ringwald      * @param con_handle of SCO connection
76aac27384SMatthias Ringwald      * @param sco_format
77aac27384SMatthias Ringwald      */
78aac27384SMatthias Ringwald     void (*open)(hci_con_handle_t con_handle, sco_format_t sco_format);
79aac27384SMatthias Ringwald 
80aac27384SMatthias Ringwald     /**
81aac27384SMatthias Ringwald      * send SCO packet
82aac27384SMatthias Ringwald      */
83aac27384SMatthias Ringwald     void (*send_packet)(const uint8_t *buffer, uint16_t length);
84aac27384SMatthias Ringwald 
85aac27384SMatthias Ringwald     /**
86aac27384SMatthias Ringwald      * close transport
87aac27384SMatthias Ringwald      * @param con_handle of SCO connection
88aac27384SMatthias Ringwald      */
89aac27384SMatthias Ringwald     void (*close)(hci_con_handle_t con_handle);
90aac27384SMatthias Ringwald 
91aac27384SMatthias Ringwald } btstack_sco_transport_t;
92aac27384SMatthias Ringwald 
93fe5a6c4eSMilanka Ringwald /* API_END */
94fe5a6c4eSMilanka Ringwald 
95aac27384SMatthias Ringwald #if defined __cplusplus
96aac27384SMatthias Ringwald }
97aac27384SMatthias Ringwald #endif
98aac27384SMatthias Ringwald 
99aac27384SMatthias Ringwald #endif