xref: /btstack/src/hci_dump.h (revision 20ea11b9fd3c86b51ab9f4b1a2d6e56b292d6087)
179662672Smatthias.ringwald /*
26b64433eSmatthias.ringwald  * Copyright (C) 2009-2012 by Matthias Ringwald
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  *
201713bceaSmatthias.ringwald  * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD 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  *
336b64433eSmatthias.ringwald  * Please inquire about commercial licensing options at [email protected]
346b64433eSmatthias.ringwald  *
351713bceaSmatthias.ringwald  */
361713bceaSmatthias.ringwald 
371713bceaSmatthias.ringwald /*
3879662672Smatthias.ringwald  *  hci_dump.h
3979662672Smatthias.ringwald  *
40a1d7dd1fSmatthias.ringwald  *  Dump HCI trace as BlueZ's hcidump format, Apple's PacketLogger, or stdout
4179662672Smatthias.ringwald  *
4279662672Smatthias.ringwald  *  Created by Matthias Ringwald on 5/26/09.
4379662672Smatthias.ringwald  */
4479662672Smatthias.ringwald 
45f471afd8S[email protected] #ifndef __HCI_DUMP_H
46f471afd8S[email protected] #define __HCI_DUMP_H
47a1d7dd1fSmatthias.ringwald 
4879662672Smatthias.ringwald #include <stdint.h>
4979662672Smatthias.ringwald 
50*20ea11b9S[email protected] #ifdef __AVR__
51*20ea11b9S[email protected] #include <avr/progmem.h>
52*20ea11b9S[email protected] #endif
53*20ea11b9S[email protected] 
54eed533f6S[email protected] #if defined __cplusplus
55eed533f6S[email protected] extern "C" {
56eed533f6S[email protected] #endif
57eed533f6S[email protected] 
588b658ebcSmatthias.ringwald typedef enum {
598b658ebcSmatthias.ringwald     HCI_DUMP_BLUEZ = 0,
608adf0ddaSmatthias.ringwald     HCI_DUMP_PACKETLOGGER,
618adf0ddaSmatthias.ringwald     HCI_DUMP_STDOUT
628b658ebcSmatthias.ringwald } hci_dump_format_t;
6379662672Smatthias.ringwald 
64a225073eS[email protected] void hci_dump_open(const char *filename, hci_dump_format_t format);
652992c131Smatthias.ringwald void hci_dump_set_max_packets(int packets); // -1 for unlimited
6679662672Smatthias.ringwald void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len);
67a1d7dd1fSmatthias.ringwald void hci_dump_log(const char * format, ...);
6840d1c7a4Smatthias.ringwald void hci_dump_close(void);
69eed533f6S[email protected] 
70*20ea11b9S[email protected] #ifdef __AVR__
71*20ea11b9S[email protected] void hci_dump_log_P(PGM_P format, ...);
72*20ea11b9S[email protected] #endif
73*20ea11b9S[email protected] 
74eed533f6S[email protected] #if defined __cplusplus
75eed533f6S[email protected] }
76eed533f6S[email protected] #endif
77f471afd8S[email protected] #endif // __HCI_DUMP_H
78