hci.h (a98592bc68752f97644fe016fd3d13da7711f733) hci.h (d6b06661159f27ddc0293fa2a7eaba2d8924e39f)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 87 unchanged lines hidden (view full) ---

96#endif
97#ifndef HCI_INCOMING_PRE_BUFFER_SIZE
98 #define HCI_INCOMING_PRE_BUFFER_SIZE 0
99#endif
100
101//
102#define IS_COMMAND(packet, command) (little_endian_read_16(packet,0) == command.opcode)
103
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 87 unchanged lines hidden (view full) ---

96#endif
97#ifndef HCI_INCOMING_PRE_BUFFER_SIZE
98 #define HCI_INCOMING_PRE_BUFFER_SIZE 0
99#endif
100
101//
102#define IS_COMMAND(packet, command) (little_endian_read_16(packet,0) == command.opcode)
103
104
105/**
106 * LE connection parameter update state
107 */
108
109typedef enum {
110 CON_PARAMETER_UPDATE_NONE,
111 CON_PARAMETER_UPDATE_SEND_REQUEST,
112 CON_PARAMETER_UPDATE_SEND_RESPONSE,

--- 405 unchanged lines hidden (view full) ---

518 const void * config;
519
520 // chipset driver
521 const btstack_chipset_t * chipset;
522
523 // hardware power controller
524 const btstack_control_t * control;
525
104/**
105 * LE connection parameter update state
106 */
107
108typedef enum {
109 CON_PARAMETER_UPDATE_NONE,
110 CON_PARAMETER_UPDATE_SEND_REQUEST,
111 CON_PARAMETER_UPDATE_SEND_RESPONSE,

--- 405 unchanged lines hidden (view full) ---

517 const void * config;
518
519 // chipset driver
520 const btstack_chipset_t * chipset;
521
522 // hardware power controller
523 const btstack_control_t * control;
524
525 /* link key db */
526 const btstack_link_key_db_t * link_key_db;
527
526 // basic configuration
527 const char * local_name;
528 uint32_t class_of_device;
529 bd_addr_t local_bd_addr;
530 uint8_t ssp_enable;
531 uint8_t ssp_io_capability;
532 uint8_t ssp_authentication_requirement;
533 uint8_t ssp_auto_accept;
528 // basic configuration
529 const char * local_name;
530 uint32_t class_of_device;
531 bd_addr_t local_bd_addr;
532 uint8_t ssp_enable;
533 uint8_t ssp_io_capability;
534 uint8_t ssp_authentication_requirement;
535 uint8_t ssp_auto_accept;
534
535
536 // list of existing baseband connections
537 btstack_linked_list_t connections;
538
539 // single buffer for HCI packet assembly + additional prebuffer for H4 drivers
540 uint8_t hci_packet_buffer_prefix[HCI_OUTGOING_PRE_BUFFER_SIZE];
541 uint8_t hci_packet_buffer[HCI_PACKET_BUFFER_SIZE]; // opcode (16), len(8)
542 uint8_t hci_packet_buffer_reserved;

--- 29 unchanged lines hidden (view full) ---

572 uint16_t packet_types;
573
574 /* callback to L2CAP layer */
575 void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size);
576
577 /* callback for SCO data */
578 void (*sco_packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size);
579
536
537 // list of existing baseband connections
538 btstack_linked_list_t connections;
539
540 // single buffer for HCI packet assembly + additional prebuffer for H4 drivers
541 uint8_t hci_packet_buffer_prefix[HCI_OUTGOING_PRE_BUFFER_SIZE];
542 uint8_t hci_packet_buffer[HCI_PACKET_BUFFER_SIZE]; // opcode (16), len(8)
543 uint8_t hci_packet_buffer_reserved;

--- 29 unchanged lines hidden (view full) ---

573 uint16_t packet_types;
574
575 /* callback to L2CAP layer */
576 void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size);
577
578 /* callback for SCO data */
579 void (*sco_packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size);
580
580 /* link key db */
581 btstack_link_key_db_t const * link_key_db;
581 /* callbacks for events */
582 btstack_linked_list_t event_handlers;
582
583 /* hci state machine */
584 HCI_STATE state;
585 hci_substate_t substate;
586 btstack_timer_source_t timeout;
587 uint8_t cmds_ready;
588
589 uint16_t last_cmd_opcode;

--- 190 unchanged lines hidden (view full) ---

780void hci_set_class_of_device(uint32_t class_of_device);
781
782/**
783 * @brief Set Public BD ADDR - passed on to Bluetooth chipset if supported in bt_control_h
784 */
785void hci_set_bd_addr(bd_addr_t addr);
786
787/**
583
584 /* hci state machine */
585 HCI_STATE state;
586 hci_substate_t substate;
587 btstack_timer_source_t timeout;
588 uint8_t cmds_ready;
589
590 uint16_t last_cmd_opcode;

--- 190 unchanged lines hidden (view full) ---

781void hci_set_class_of_device(uint32_t class_of_device);
782
783/**
784 * @brief Set Public BD ADDR - passed on to Bluetooth chipset if supported in bt_control_h
785 */
786void hci_set_bd_addr(bd_addr_t addr);
787
788/**
789 * @brief Add event packet handler.
790 */
791void hci_add_event_handler(btstack_packet_callback_registration_t * callback_handler);
792
793/**
788 * @brief Registers a packet handler. Used if L2CAP is not used (rarely).
789 */
790void hci_register_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));
791
792/**
793 * @brief Registers a packet handler for SCO data. Used for HSP and HFP profiles.
794 */
795void hci_register_sco_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));

--- 96 unchanged lines hidden ---
794 * @brief Registers a packet handler. Used if L2CAP is not used (rarely).
795 */
796void hci_register_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));
797
798/**
799 * @brief Registers a packet handler for SCO data. Used for HSP and HFP profiles.
800 */
801void hci_register_sco_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));

--- 96 unchanged lines hidden ---