179662672Smatthias.ringwald /* 2a0c35809S[email protected] * Copyright (C) 2014 BlueKitchen GmbH 31713bceaSmatthias.ringwald * 41713bceaSmatthias.ringwald * Redistribution and use in source and binary forms, with or without 51713bceaSmatthias.ringwald * modification, are permitted provided that the following conditions 61713bceaSmatthias.ringwald * are met: 71713bceaSmatthias.ringwald * 81713bceaSmatthias.ringwald * 1. Redistributions of source code must retain the above copyright 91713bceaSmatthias.ringwald * notice, this list of conditions and the following disclaimer. 101713bceaSmatthias.ringwald * 2. Redistributions in binary form must reproduce the above copyright 111713bceaSmatthias.ringwald * notice, this list of conditions and the following disclaimer in the 121713bceaSmatthias.ringwald * documentation and/or other materials provided with the distribution. 131713bceaSmatthias.ringwald * 3. Neither the name of the copyright holders nor the names of 141713bceaSmatthias.ringwald * contributors may be used to endorse or promote products derived 151713bceaSmatthias.ringwald * from this software without specific prior written permission. 166b64433eSmatthias.ringwald * 4. Any redistribution, use, or modification is done solely for 176b64433eSmatthias.ringwald * personal benefit and not for any commercial purpose or for 186b64433eSmatthias.ringwald * monetary gain. 191713bceaSmatthias.ringwald * 20a0c35809S[email protected] * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 211713bceaSmatthias.ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 221713bceaSmatthias.ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 231713bceaSmatthias.ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 241713bceaSmatthias.ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 251713bceaSmatthias.ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 261713bceaSmatthias.ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 271713bceaSmatthias.ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 281713bceaSmatthias.ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 291713bceaSmatthias.ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 301713bceaSmatthias.ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311713bceaSmatthias.ringwald * SUCH DAMAGE. 321713bceaSmatthias.ringwald * 33a0c35809S[email protected] * Please inquire about commercial licensing options at 34a0c35809S[email protected] * [email protected] 356b64433eSmatthias.ringwald * 361713bceaSmatthias.ringwald */ 371713bceaSmatthias.ringwald 381713bceaSmatthias.ringwald /* 3979662672Smatthias.ringwald * hci_dump.h 4079662672Smatthias.ringwald * 41a1d7dd1fSmatthias.ringwald * Dump HCI trace as BlueZ's hcidump format, Apple's PacketLogger, or stdout 4279662672Smatthias.ringwald * 4379662672Smatthias.ringwald * Created by Matthias Ringwald on 5/26/09. 4479662672Smatthias.ringwald */ 4579662672Smatthias.ringwald 46f471afd8S[email protected] #ifndef __HCI_DUMP_H 47f471afd8S[email protected] #define __HCI_DUMP_H 48a1d7dd1fSmatthias.ringwald 4979662672Smatthias.ringwald #include <stdint.h> 5079662672Smatthias.ringwald 5120ea11b9S[email protected] #ifdef __AVR__ 52f61ec823S[email protected] #include <avr/pgmspace.h> 5320ea11b9S[email protected] #endif 5420ea11b9S[email protected] 55eed533f6S[email protected] #if defined __cplusplus 56eed533f6S[email protected] extern "C" { 57eed533f6S[email protected] #endif 58eed533f6S[email protected] 598a37b10aSMatthias Ringwald #define LOG_LEVEL_DEBUG 0 608a37b10aSMatthias Ringwald #define LOG_LEVEL_INFO 1 618a37b10aSMatthias Ringwald #define LOG_LEVEL_ERROR 2 628a37b10aSMatthias Ringwald 63*99e736a0SMilanka Ringwald /* API_START */ 64*99e736a0SMilanka Ringwald 658b658ebcSmatthias.ringwald typedef enum { 668b658ebcSmatthias.ringwald HCI_DUMP_BLUEZ = 0, 678adf0ddaSmatthias.ringwald HCI_DUMP_PACKETLOGGER, 688adf0ddaSmatthias.ringwald HCI_DUMP_STDOUT 698b658ebcSmatthias.ringwald } hci_dump_format_t; 7079662672Smatthias.ringwald 71*99e736a0SMilanka Ringwald /* 72*99e736a0SMilanka Ringwald * @brief 73*99e736a0SMilanka Ringwald */ 74a225073eS[email protected] void hci_dump_open(const char *filename, hci_dump_format_t format); 75*99e736a0SMilanka Ringwald 76*99e736a0SMilanka Ringwald /* 77*99e736a0SMilanka Ringwald * @brief 78*99e736a0SMilanka Ringwald */ 792992c131Smatthias.ringwald void hci_dump_set_max_packets(int packets); // -1 for unlimited 80*99e736a0SMilanka Ringwald 81*99e736a0SMilanka Ringwald /* 82*99e736a0SMilanka Ringwald * @brief 83*99e736a0SMilanka Ringwald */ 8479662672Smatthias.ringwald void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len); 85*99e736a0SMilanka Ringwald 86*99e736a0SMilanka Ringwald /* 87*99e736a0SMilanka Ringwald * @brief 88*99e736a0SMilanka Ringwald */ 898a37b10aSMatthias Ringwald void hci_dump_log(int log_level, const char * format, ...); 90*99e736a0SMilanka Ringwald 91*99e736a0SMilanka Ringwald /* 92*99e736a0SMilanka Ringwald * @brief 93*99e736a0SMilanka Ringwald */ 948a37b10aSMatthias Ringwald void hci_dump_enable_log_level(int log_level, int enable); 95*99e736a0SMilanka Ringwald 96*99e736a0SMilanka Ringwald /* 97*99e736a0SMilanka Ringwald * @brief 98*99e736a0SMilanka Ringwald */ 9940d1c7a4Smatthias.ringwald void hci_dump_close(void); 100eed533f6S[email protected] 101*99e736a0SMilanka Ringwald /* API_END */ 102*99e736a0SMilanka Ringwald 10320ea11b9S[email protected] #ifdef __AVR__ 1048a37b10aSMatthias Ringwald void hci_dump_log_P(int log_level, PGM_P format, ...); 10520ea11b9S[email protected] #endif 10620ea11b9S[email protected] 107eed533f6S[email protected] #if defined __cplusplus 108eed533f6S[email protected] } 109eed533f6S[email protected] #endif 110f471afd8S[email protected] #endif // __HCI_DUMP_H 111