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