xref: /btstack/src/le-audio/le_audio_util.h (revision 5deb0bb6ea9d1704b91e71811c5345f5da4109d5)
1*5deb0bb6SMatthias Ringwald /*
2*5deb0bb6SMatthias Ringwald  * Copyright (C) 2022 BlueKitchen GmbH
3*5deb0bb6SMatthias Ringwald  *
4*5deb0bb6SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*5deb0bb6SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*5deb0bb6SMatthias Ringwald  * are met:
7*5deb0bb6SMatthias Ringwald  *
8*5deb0bb6SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*5deb0bb6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*5deb0bb6SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*5deb0bb6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*5deb0bb6SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*5deb0bb6SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*5deb0bb6SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*5deb0bb6SMatthias Ringwald  *    from this software without specific prior written permission.
16*5deb0bb6SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*5deb0bb6SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*5deb0bb6SMatthias Ringwald  *    monetary gain.
19*5deb0bb6SMatthias Ringwald  *
20*5deb0bb6SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*5deb0bb6SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*5deb0bb6SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*5deb0bb6SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*5deb0bb6SMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*5deb0bb6SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*5deb0bb6SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*5deb0bb6SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*5deb0bb6SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*5deb0bb6SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*5deb0bb6SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*5deb0bb6SMatthias Ringwald  * SUCH DAMAGE.
32*5deb0bb6SMatthias Ringwald  *
33*5deb0bb6SMatthias Ringwald  * Please inquire about commercial licensing options at
34*5deb0bb6SMatthias Ringwald  * [email protected]
35*5deb0bb6SMatthias Ringwald  *
36*5deb0bb6SMatthias Ringwald  */
37*5deb0bb6SMatthias Ringwald 
38*5deb0bb6SMatthias Ringwald /**
39*5deb0bb6SMatthias Ringwald  * @title LE Audio Util
40*5deb0bb6SMatthias Ringwald  *
41*5deb0bb6SMatthias Ringwald  */
42*5deb0bb6SMatthias Ringwald 
43*5deb0bb6SMatthias Ringwald #ifndef LE_AUDIO_UTIL_H
44*5deb0bb6SMatthias Ringwald #define LE_AUDIO_UTIL_H
45*5deb0bb6SMatthias Ringwald 
46*5deb0bb6SMatthias Ringwald #include <stdint.h>
47*5deb0bb6SMatthias Ringwald #include "le_audio.h"
48*5deb0bb6SMatthias Ringwald 
49*5deb0bb6SMatthias Ringwald #if defined __cplusplus
50*5deb0bb6SMatthias Ringwald extern "C" {
51*5deb0bb6SMatthias Ringwald #endif
52*5deb0bb6SMatthias Ringwald 
53*5deb0bb6SMatthias Ringwald uint16_t le_audio_virtual_memcpy_helper(
54*5deb0bb6SMatthias Ringwald     const uint8_t * field_data, uint16_t field_len, uint16_t field_offset,
55*5deb0bb6SMatthias Ringwald     uint8_t * buffer, uint16_t buffer_size, uint16_t buffer_offset);
56*5deb0bb6SMatthias Ringwald 
57*5deb0bb6SMatthias Ringwald uint16_t le_audio_virtual_memcpy_metadata(const le_audio_metadata_t * metadata, uint8_t metadata_length, uint16_t * records_offset, uint8_t * buffer, uint16_t buffer_size, uint16_t buffer_offset);
58*5deb0bb6SMatthias Ringwald 
59*5deb0bb6SMatthias Ringwald uint16_t le_audio_metadata_parse_tlv(uint8_t * buffer, uint8_t buffer_size, le_audio_metadata_t * metadata);
60*5deb0bb6SMatthias Ringwald 
61*5deb0bb6SMatthias Ringwald uint16_t le_audio_copy_metadata_to_event_buffer(le_audio_metadata_t * metadata, uint8_t * event, uint16_t event_size);
62*5deb0bb6SMatthias Ringwald 
63*5deb0bb6SMatthias Ringwald #if defined __cplusplus
64*5deb0bb6SMatthias Ringwald }
65*5deb0bb6SMatthias Ringwald #endif
66*5deb0bb6SMatthias Ringwald 
67*5deb0bb6SMatthias Ringwald #endif
68*5deb0bb6SMatthias Ringwald 
69