1853ebd39SMatthias Ringwald /* 2853ebd39SMatthias Ringwald * Copyright (C) 2017 BlueKitchen GmbH 3853ebd39SMatthias Ringwald * 4853ebd39SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5853ebd39SMatthias Ringwald * modification, are permitted provided that the following conditions 6853ebd39SMatthias Ringwald * are met: 7853ebd39SMatthias Ringwald * 8853ebd39SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9853ebd39SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10853ebd39SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11853ebd39SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12853ebd39SMatthias Ringwald * documentation and/or other materials provided with the distribution. 13853ebd39SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14853ebd39SMatthias Ringwald * contributors may be used to endorse or promote products derived 15853ebd39SMatthias Ringwald * from this software without specific prior written permission. 16853ebd39SMatthias Ringwald * 17*2fca4dadSMilanka Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 18853ebd39SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19853ebd39SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 20*2fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 21*2fca4dadSMilanka Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 22853ebd39SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23853ebd39SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 24853ebd39SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 25853ebd39SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26853ebd39SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 27853ebd39SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28853ebd39SMatthias Ringwald * SUCH DAMAGE. 29853ebd39SMatthias Ringwald * 30853ebd39SMatthias Ringwald */ 31853ebd39SMatthias Ringwald 32e501bae0SMatthias Ringwald #define BTSTACK_FILE__ "btstack_tlv.c" 33924838cdSMatthias Ringwald 34853ebd39SMatthias Ringwald /* 35853ebd39SMatthias Ringwald * btstack_tlv.c 36853ebd39SMatthias Ringwald * 37853ebd39SMatthias Ringwald * Singleton for BTstack's Tag Value Length Persistent Storage implementation 38853ebd39SMatthias Ringwald */ 39853ebd39SMatthias Ringwald 40853ebd39SMatthias Ringwald #include "btstack_tlv.h" 41924838cdSMatthias Ringwald #include "btstack_debug.h" 42924838cdSMatthias Ringwald 43853ebd39SMatthias Ringwald 44661f177dSMatthias Ringwald static const btstack_tlv_t * btstack_tlv_singleton_impl; 45853ebd39SMatthias Ringwald static void * btstack_tlv_singleton_context; 46853ebd39SMatthias Ringwald 47661f177dSMatthias Ringwald void btstack_tlv_set_instance(const btstack_tlv_t * tlv_impl, void * tlv_context){ 48924838cdSMatthias Ringwald log_info("TLV Instance %p", tlv_impl); 49853ebd39SMatthias Ringwald btstack_tlv_singleton_impl = tlv_impl; 50853ebd39SMatthias Ringwald btstack_tlv_singleton_context = tlv_context; 51853ebd39SMatthias Ringwald } 52853ebd39SMatthias Ringwald 53661f177dSMatthias Ringwald void btstack_tlv_get_instance(const btstack_tlv_t ** tlv_impl, void ** tlv_context){ 54853ebd39SMatthias Ringwald *tlv_impl = btstack_tlv_singleton_impl; 55853ebd39SMatthias Ringwald *tlv_context = btstack_tlv_singleton_context; 56853ebd39SMatthias Ringwald } 57