xref: /btstack/src/hci.h (revision 02ea9861adb72eb7d0cba8d04d752df236f0e067)
1 /*
2  *  hci.h
3  *
4  *  Created by Matthias Ringwald on 4/29/09.
5  *
6  */
7 
8 #pragma once
9 
10 #include <stdint.h>
11 #include <stdlib.h>
12 
13 #include "hci_transport.h"
14 
15 typedef enum {
16     HCI_POWER_OFF = 0,
17     HCI_POWER_ON
18 } HCI_POWER_MODE;
19 
20 typedef struct {
21     uint16_t    opcode;
22     const char *format;
23 } hci_cmd_t;
24 
25 typedef uint8_t bd_addr_t[6];
26 
27 // set up HCI
28 void hci_init(hci_transport_t *transport, void *config);
29 
30 // power control
31 int hci_power_control(HCI_POWER_MODE mode);
32 
33 // run the hci daemon loop
34 void hci_run();
35 
36 //
37 void hexdump(uint8_t *data, int size);
38 
39 // create and send hci command packet based on a template and a list of parameters
40 int hci_send_cmd(hci_cmd_t *cmd, ...);
41 
42 extern hci_cmd_t hci_inquiry;
43 extern hci_cmd_t hci_reset;
44 extern hci_cmd_t hci_create_connection;
45 extern hci_cmd_t hci_host_buffer_size;
46 extern hci_cmd_t hci_write_page_timeout;
47 
48 #define HCI_INQUIRY_LAP 0x9E8B33L  // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
49