xref: /btstack/src/hci.h (revision 0a974e0c4482b3feeb23227e3c157e6c9aec941f)
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 
12 #include "hci_transport.h"
13 
14 typedef enum {
15     HCI_POWER_OFF = 0,
16     HCI_POWER_ON
17 } HCI_POWER_MODE;
18 
19 typedef struct {
20     uint16_t    opcode;
21     const char *format;
22 } hci_cmd_t;
23 
24 // set up HCI
25 void hci_init(hci_transport_t *transport, void *config);
26 
27 // power control
28 int hci_power_control(HCI_POWER_MODE mode);
29 
30 // run the hci daemon loop
31 void hci_run();
32 
33 //
34 void hexdump(uint8_t *data, int size);
35 
36 // create hci command packet based on a template and a list of parameters
37 void hci_create_cmd_packet(uint8_t *buffer, uint8_t *cmd_len, hci_cmd_t *cmd, ...);
38 
39 int hci_send_cmd_packet(uint8_t *buffer, int size);
40 
41 extern hci_cmd_t hci_inquiry;
42 extern hci_cmd_t hci_reset;
43 
44 #define HCI_INQUIRY_LAP 0x9E8B33L  // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
45