xref: /btstack/src/le-audio/le_audio_util.h (revision 54461c8047b3c5f9654296103bcf995fc81d2a8c)
15deb0bb6SMatthias Ringwald /*
25deb0bb6SMatthias Ringwald  * Copyright (C) 2022 BlueKitchen GmbH
35deb0bb6SMatthias Ringwald  *
45deb0bb6SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
55deb0bb6SMatthias Ringwald  * modification, are permitted provided that the following conditions
65deb0bb6SMatthias Ringwald  * are met:
75deb0bb6SMatthias Ringwald  *
85deb0bb6SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
95deb0bb6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
105deb0bb6SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
115deb0bb6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
125deb0bb6SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
135deb0bb6SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
145deb0bb6SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
155deb0bb6SMatthias Ringwald  *    from this software without specific prior written permission.
165deb0bb6SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
175deb0bb6SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
185deb0bb6SMatthias Ringwald  *    monetary gain.
195deb0bb6SMatthias Ringwald  *
205deb0bb6SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
215deb0bb6SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
225deb0bb6SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
235deb0bb6SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
245deb0bb6SMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
255deb0bb6SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
265deb0bb6SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
275deb0bb6SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
285deb0bb6SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
295deb0bb6SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
305deb0bb6SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
315deb0bb6SMatthias Ringwald  * SUCH DAMAGE.
325deb0bb6SMatthias Ringwald  *
335deb0bb6SMatthias Ringwald  * Please inquire about commercial licensing options at
345deb0bb6SMatthias Ringwald  * [email protected]
355deb0bb6SMatthias Ringwald  *
365deb0bb6SMatthias Ringwald  */
375deb0bb6SMatthias Ringwald 
385deb0bb6SMatthias Ringwald /**
395deb0bb6SMatthias Ringwald  * @title LE Audio Util
405deb0bb6SMatthias Ringwald  *
415deb0bb6SMatthias Ringwald  */
425deb0bb6SMatthias Ringwald 
435deb0bb6SMatthias Ringwald #ifndef LE_AUDIO_UTIL_H
445deb0bb6SMatthias Ringwald #define LE_AUDIO_UTIL_H
455deb0bb6SMatthias Ringwald 
465deb0bb6SMatthias Ringwald #include <stdint.h>
475deb0bb6SMatthias Ringwald #include "le_audio.h"
485deb0bb6SMatthias Ringwald 
495deb0bb6SMatthias Ringwald #if defined __cplusplus
505deb0bb6SMatthias Ringwald extern "C" {
515deb0bb6SMatthias Ringwald #endif
525deb0bb6SMatthias Ringwald 
53*54461c80SMatthias Ringwald uint16_t le_audio_util_virtual_memcpy_helper(
545deb0bb6SMatthias Ringwald     const uint8_t * field_data, uint16_t field_len, uint16_t field_offset,
555deb0bb6SMatthias Ringwald     uint8_t * buffer, uint16_t buffer_size, uint16_t buffer_offset);
565deb0bb6SMatthias Ringwald 
57*54461c80SMatthias Ringwald uint16_t le_audio_util_metadata_virtual_memcpy(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);
585deb0bb6SMatthias Ringwald 
59*54461c80SMatthias Ringwald uint16_t le_audio_util_metadata_parse(uint8_t * buffer, uint8_t buffer_size, le_audio_metadata_t * metadata);
605deb0bb6SMatthias Ringwald 
61*54461c80SMatthias Ringwald uint16_t le_audio_util_metadata_serialize(le_audio_metadata_t * metadata, uint8_t * event, uint16_t event_size);
625deb0bb6SMatthias Ringwald 
635deb0bb6SMatthias Ringwald #if defined __cplusplus
645deb0bb6SMatthias Ringwald }
655deb0bb6SMatthias Ringwald #endif
665deb0bb6SMatthias Ringwald 
675deb0bb6SMatthias Ringwald #endif
685deb0bb6SMatthias Ringwald 
69