mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-03 20:54:18 +00:00
structure btstack-config.h
This commit is contained in:
parent
c953b8dd2f
commit
a9a4c40924
@ -158,7 +158,7 @@ static void update_set_power_vector(uint8_t *hci_cmd_buffer){
|
||||
// f) don't touch level 0
|
||||
for ( i = (NUM_POWER_LEVELS-1) ; i >= 1 ; i--){
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// level 1 is BLE transmit power for GFSK
|
||||
if (i == 1 && modulation_type == 0) {
|
||||
hci_cmd_buffer[4+1] = 2 * get_max_power_for_modulation_type(modulation_type);
|
||||
|
@ -79,7 +79,7 @@
|
||||
|
||||
#include "btstack_client.h"
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
#include "ble/gatt_client.h"
|
||||
#include "ble/att_server.h"
|
||||
#include "ble/att.h"
|
||||
@ -182,7 +182,7 @@ static btstack_timer_source_t timeout;
|
||||
static uint8_t timeout_active = 0;
|
||||
static int power_management_sleep = 0;
|
||||
static btstack_linked_list_t clients = NULL; // list of connected clients `
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
static btstack_linked_list_t gatt_client_helpers = NULL; // list of used gatt client (helpers)
|
||||
static uint16_t gatt_client_id = 0;
|
||||
#endif
|
||||
@ -353,7 +353,7 @@ static void daemon_remove_client_sdp_service_record_handle(connection_t * connec
|
||||
remove_and_free_uint32_from_list(&client_state->sdp_record_handles, handle);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
static void daemon_add_gatt_client_handle(connection_t * connection, uint32_t handle){
|
||||
client_state_t * client_state = client_for_connection(connection);
|
||||
if (!client_state) return;
|
||||
@ -639,7 +639,7 @@ static connection_t * connection_for_rfcomm_cid(uint16_t cid){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
static void daemon_gatt_client_close_connection(connection_t * connection){
|
||||
client_state_t * client = client_for_connection(connection);
|
||||
if (!client) return;
|
||||
@ -662,7 +662,7 @@ static void daemon_disconnect_client(connection_t * connection){
|
||||
daemon_sdp_close_connection(client);
|
||||
daemon_rfcomm_close_connection(client);
|
||||
daemon_l2cap_close_connection(client);
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// NOTE: experimental - disconnect all LE connections where GATT Client was used
|
||||
// gatt_client_disconnect_connection(connection);
|
||||
daemon_gatt_client_close_connection(connection);
|
||||
@ -740,7 +740,7 @@ static void sdp_emit_service_registered(void *connection, uint32_t handle, uint8
|
||||
socket_connection_send_packet(connection, HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
|
||||
btstack_linked_list_gatt_client_helper_t * daemon_get_gatt_client_helper(uint16_t handle) {
|
||||
btstack_linked_list_iterator_t it;
|
||||
@ -880,7 +880,7 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
client_state_t *client;
|
||||
uint8_t status;
|
||||
uint8_t * data;
|
||||
#if defined(HAVE_MALLOC) && defined(HAVE_BLE)
|
||||
#if defined(HAVE_MALLOC) && defined(ENABLE_BLE)
|
||||
uint8_t uuid128[16];
|
||||
le_service_t service;
|
||||
le_characteristic_t characteristic;
|
||||
@ -1144,7 +1144,7 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
handle = READ_BT_16(packet, 3);
|
||||
gap_disconnect(handle);
|
||||
break;
|
||||
#if defined(HAVE_MALLOC) && defined(HAVE_BLE)
|
||||
#if defined(HAVE_MALLOC) && defined(ENABLE_BLE)
|
||||
case GATT_DISCOVER_ALL_PRIMARY_SERVICES:
|
||||
gatt_helper = daemon_setup_gatt_client_request(connection, packet, 1);
|
||||
if (!gatt_helper) break;
|
||||
@ -1533,7 +1533,7 @@ static void daemon_packet_handler(void * connection, uint8_t packet_type, uint16
|
||||
if (!connection) break;
|
||||
daemon_remove_client_l2cap_channel(connection, cid);
|
||||
break;
|
||||
#if defined(HAVE_BLE) && defined(HAVE_MALLOC)
|
||||
#if defined(ENABLE_BLE) && defined(HAVE_MALLOC)
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
log_info("daemon : ignore HCI_EVENT_DISCONNECTION_COMPLETE ingnoring.");
|
||||
// note: moved to gatt_client_handler because it's received here prematurely
|
||||
@ -1767,7 +1767,7 @@ static void * btstack_run_loop_thread(void *context){
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
|
||||
static void handle_gatt_client_event(uint8_t packet_type, uint8_t * packet, uint16_t size){
|
||||
|
||||
@ -2019,17 +2019,17 @@ int main (int argc, char * const * argv){
|
||||
l2cap_register_packet_handler(&l2cap_packet_handler);
|
||||
timeout.process = daemon_no_connections_timeout;
|
||||
|
||||
#ifdef HAVE_RFCOMM
|
||||
log_info("config.h: HAVE_RFCOMM\n");
|
||||
#ifdef ENABLE_RFCOMM
|
||||
log_info("config.h: ENABLE_RFCOMM\n");
|
||||
rfcomm_init();
|
||||
rfcomm_register_packet_handler(&rfcomm_packet_handler);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SDP
|
||||
#ifdef ENABLE_SDP
|
||||
sdp_init();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// GATT Client
|
||||
gatt_client_init();
|
||||
gatt_client_id = gatt_client_register_packet_handler(&handle_gatt_client_event);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define HAVE_BZERO
|
||||
#define HAVE_TIME_MS
|
||||
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define HAVE_HCI_DUMP
|
||||
#define ENABLE_LOG_INFO
|
||||
|
@ -136,24 +136,26 @@ echo "#define HAVE_BZERO" >> btstack-config.h
|
||||
if test "x$HAVE_SO_NOSIGPIPE" == xyes ; then
|
||||
echo "#define HAVE_SO_NOSIGPIPE" >> btstack-config.h
|
||||
fi
|
||||
echo >> btstack-config.h
|
||||
|
||||
# todo: HAVE -> ENABLE in features below
|
||||
|
||||
echo "// BTstack features that can be enabled" >> btstack-config.h
|
||||
echo "#define HAVE_BLE" >> btstack-config.h
|
||||
echo "#define ENABLE_LOG_INFO " >> btstack-config.h
|
||||
echo "#define ENABLE_BLE" >> btstack-config.h
|
||||
echo "#define ENABLE_LOG_ERROR" >> btstack-config.h
|
||||
echo "#define HAVE_SDP" >> btstack-config.h
|
||||
echo "#define HAVE_RFCOMM" >> btstack-config.h
|
||||
echo "#define ENABLE_LOG_INFO " >> btstack-config.h
|
||||
echo "#define ENABLE_RFCOMM" >> btstack-config.h
|
||||
echo "#define ENABLE_SDP" >> btstack-config.h
|
||||
echo "#define ENABLE_SDP_DES_DUMP" >> btstack-config.h
|
||||
echo >> btstack-config.h
|
||||
|
||||
echo "// BTstack configuration. buffers, sizes, .." >> btstack-config.h
|
||||
echo "#define HCI_ACL_PAYLOAD_SIZE 1021" >> btstack-config.h
|
||||
echo "#define SDP_DES_DUMP" >> btstack-config.h
|
||||
echo >> btstack-config.h
|
||||
|
||||
# unsorted yet
|
||||
echo "// Daemon configuration" >> btstack-config.h
|
||||
# todo: USE_BLUETOOL -> HAVE_BLUETOOL
|
||||
# todo: USE_POWERMANAGEMENT -> HAVE_POWERMANAGMENT / ENABLE_POWERMANAGEMENT
|
||||
|
||||
if test "x$HCI_TRANSPORT" = xUSB; then
|
||||
USB_SOURCES=hci_transport_h2_libusb.c
|
||||
echo "#define HAVE_TRANSPORT_USB" >> btstack-config.h
|
||||
@ -170,12 +172,11 @@ else
|
||||
echo "#define USE_POWERMANAGEMENT" >> btstack-config.h
|
||||
fi
|
||||
fi
|
||||
# are those still needed?
|
||||
if test ! -z "$REMOTE_DEVICE_DB" ; then
|
||||
echo "#define REMOTE_DEVICE_DB $REMOTE_DEVICE_DB" >> btstack-config.h
|
||||
fi
|
||||
|
||||
echo "" >> btstack-config.h
|
||||
echo >> btstack-config.h
|
||||
echo "#endif" >> btstack-config.h
|
||||
|
||||
AC_SUBST(HAVE_LIBUSB)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#define EMBEDDED
|
||||
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_BZERO
|
||||
|
@ -14,8 +14,8 @@
|
||||
#define USE_POWERMANAGEMENT
|
||||
#define USE_SPRINGBOARD
|
||||
#define USE_LAUNCHD
|
||||
#define HAVE_SDP
|
||||
#define HAVE_RFCOMM
|
||||
#define ENABLE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
@ -25,6 +25,6 @@
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HCI_ACL_PAYLOAD_SIZE 1021
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#endif
|
@ -5,12 +5,12 @@
|
||||
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
#define HAVE_BZERO
|
||||
#define HAVE_HCI_DUMP
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_RFCOMM
|
||||
#define HAVE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define ENABLE_SDP
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
#define HAVE_SCO
|
||||
@ -18,8 +18,8 @@
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof BNEP header, avoid memcpy
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define SDP_DES_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#define HAVE_SCO
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#define EMBEDDED
|
||||
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_BZERO
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#define EMBEDDED
|
||||
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_BZERO
|
||||
|
@ -7,9 +7,9 @@
|
||||
#define UART_DEVICE "/dev/ttyS0"
|
||||
#define UART_SPEED 115200
|
||||
#define USE_POWERMANAGEMENT
|
||||
#define HAVE_SDP
|
||||
#define HAVE_RFCOMM
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define ENABLE_BLE
|
||||
#define REMOTE_DEVICE_DB remote_device_db_memory
|
||||
// #define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
@ -19,7 +19,7 @@
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HCI_ACL_PAYLOAD_SIZE 1021
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#define BTSTACK_UNIX "/data/btstack/BTstack"
|
||||
#define BTSTACK_LOG_FILE "/data/btstack/hci_dump.pklg"
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#define EMBEDDED
|
||||
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_BZERO
|
||||
|
@ -4,20 +4,20 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
#define HAVE_TRANSPORT_USB
|
||||
#define HAVE_BLE
|
||||
#define HAVE_SDP
|
||||
#define HAVE_RFCOMM
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_BZERO
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
#define HAVE_HCI_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#endif
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
#define HAVE_BZERO
|
||||
#define HAVE_HCI_DUMP
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_RFCOMM
|
||||
#define HAVE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define ENABLE_SDP
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
#define HAVE_SCO
|
||||
@ -18,7 +18,7 @@
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof BNEP header, avoid memcpy
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define SDP_DES_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#endif
|
||||
|
@ -4,20 +4,20 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
#define HAVE_TRANSPORT_USB
|
||||
#define HAVE_BLE
|
||||
#define HAVE_SDP
|
||||
#define HAVE_RFCOMM
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_BZERO
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
#define HAVE_HCI_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#endif
|
||||
|
@ -4,20 +4,20 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
#define HAVE_TRANSPORT_USB
|
||||
#define HAVE_BLE
|
||||
#define HAVE_SDP
|
||||
#define HAVE_RFCOMM
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_BZERO
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
#define HAVE_HCI_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#endif
|
||||
|
@ -3,21 +3,21 @@
|
||||
#ifndef __BTSTACK_CONFIG
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// #define HAVE_BLE
|
||||
// #define ENABLE_BLE
|
||||
|
||||
#define HAVE_SDP
|
||||
#define HAVE_RFCOMM
|
||||
#define ENABLE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_BZERO
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
#define HAVE_HCI_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#endif
|
||||
|
@ -4,21 +4,21 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
#define HAVE_TRANSPORT_USB
|
||||
#define HAVE_BLE
|
||||
#define HAVE_SDP
|
||||
#define HAVE_RFCOMM
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_SDP
|
||||
#define ENABLE_RFCOMM
|
||||
#define REMOTE_DEVICE_DB remote_device_db_iphone
|
||||
#define HAVE_SO_NOSIGPIPE
|
||||
#define HAVE_TIME
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_BZERO
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
#define HAVE_HCI_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
|
||||
#define HAVE_SCO
|
||||
#define HAVE_SCO_OVER_HCI
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#define EMBEDDED
|
||||
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_BZERO
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define HAVE_WICED
|
||||
#define WICED_BT_UART_MANUAL_CTS_RTS
|
||||
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_BZERO
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "l2cap.h"
|
||||
#include "l2cap_signaling.h"
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
#include "ble/ad_parser.h"
|
||||
#include "ble/ancs_client.h"
|
||||
#include "ble/att.h"
|
||||
|
@ -474,7 +474,7 @@ void btstack_memory_service_record_item_free(service_record_item_t *service_reco
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
|
||||
// MARK: gatt_client_t
|
||||
#ifdef MAX_NO_GATT_CLIENTS
|
||||
@ -646,7 +646,7 @@ void btstack_memory_init(void){
|
||||
#if MAX_NO_SERVICE_RECORD_ITEMS > 0
|
||||
btstack_memory_pool_create(&service_record_item_pool, service_record_item_storage, MAX_NO_SERVICE_RECORD_ITEMS, sizeof(service_record_item_t));
|
||||
#endif
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
#if MAX_NO_GATT_CLIENTS > 0
|
||||
btstack_memory_pool_create(&gatt_client_pool, gatt_client_storage, MAX_NO_GATT_CLIENTS, sizeof(gatt_client_t));
|
||||
#endif
|
||||
|
@ -65,7 +65,7 @@ extern "C" {
|
||||
#include "classic/sdp.h"
|
||||
|
||||
// BLE
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
#include "ble/gatt_client.h"
|
||||
#include "ble/sm.h"
|
||||
#endif
|
||||
@ -119,7 +119,7 @@ void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection);
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void);
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item);
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// gatt_client, gatt_subclient, whitelist_entry, sm_lookup_entry
|
||||
gatt_client_t * btstack_memory_gatt_client_get(void);
|
||||
void btstack_memory_gatt_client_free(gatt_client_t *gatt_client);
|
||||
|
@ -58,7 +58,7 @@ void sdp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet,
|
||||
|
||||
static uint16_t setup_service_search_attribute_request(uint8_t * data);
|
||||
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
static uint16_t setup_service_search_request(uint8_t * data);
|
||||
static uint16_t setup_service_attribute_request(uint8_t * data);
|
||||
static void parse_service_search_response(uint8_t* packet);
|
||||
@ -108,7 +108,7 @@ static void send_request(uint16_t channel){
|
||||
uint16_t request_len = 0;
|
||||
|
||||
switch (PDU_ID){
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
case SDP_ServiceSearchResponse:
|
||||
request_len = setup_service_search_request(data);
|
||||
break;
|
||||
@ -197,7 +197,7 @@ void sdp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet,
|
||||
PDU_ID = (SDP_PDU_ID_t)packet[0];
|
||||
log_info("SDP Client :: PDU ID. %u ,%u", PDU_ID, packet[0]);
|
||||
switch (PDU_ID){
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
case SDP_ServiceSearchResponse:
|
||||
parse_service_search_response(packet);
|
||||
break;
|
||||
@ -311,7 +311,7 @@ static uint16_t setup_service_search_attribute_request(uint8_t * data){
|
||||
return offset;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
void parse_service_record_handle_list(uint8_t* packet, uint16_t total_count, uint16_t current_count){
|
||||
sdp_parser_handle_service_search(packet, total_count, current_count);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ extern "C" {
|
||||
*/
|
||||
void sdp_client_query(bd_addr_t remote, uint8_t * des_serviceSearchPattern, uint8_t * des_attributeIDList);
|
||||
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
void sdp_client_service_attribute_search(bd_addr_t remote, uint32_t search_serviceRecordHandle, uint8_t * des_attributeIDList);
|
||||
void sdp_client_service_search(bd_addr_t remote, uint8_t * des_serviceSearchPattern);
|
||||
#endif
|
||||
|
@ -62,7 +62,7 @@ static uint16_t record_size;
|
||||
static uint16_t attribute_value_size;
|
||||
static int record_counter = 0;
|
||||
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
static uint32_t record_handle;
|
||||
#endif
|
||||
|
||||
@ -241,7 +241,7 @@ void sdp_parser_handle_chunk(uint8_t * data, uint16_t size){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
void sdp_parser_init_service_attribute_search(void){
|
||||
// init
|
||||
de_state_init(&de_header_state);
|
||||
|
@ -96,7 +96,7 @@ typedef struct sdp_query_attribute_value_event {
|
||||
} sdp_query_attribute_value_event_t;
|
||||
|
||||
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
typedef struct sdp_query_service_record_handle_event {
|
||||
uint8_t type;
|
||||
uint16_t total_count;
|
||||
@ -127,7 +127,7 @@ void sdp_parser_handle_chunk(uint8_t * data, uint16_t size);
|
||||
void sdp_parser_handle_done(uint8_t status);
|
||||
|
||||
|
||||
#ifdef HAVE_SDP_EXTRA_QUERIES
|
||||
#ifdef ENABLE_SDP_EXTRA_QUERIES
|
||||
/*
|
||||
* @brief
|
||||
*/
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h> // PRIx32
|
||||
|
||||
#ifdef SDP_DES_DUMP
|
||||
#ifdef ENABLE_SDP_DES_DUMP
|
||||
// workaround for missing PRIx32 on mspgcc (16-bit MCU)
|
||||
#ifndef PRIx32
|
||||
#warning Using own: #define PRIx32 "lx"
|
||||
@ -614,7 +614,7 @@ int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceS
|
||||
|
||||
// MARK: Dump DataElement
|
||||
// context { indent }
|
||||
#ifdef SDP_DES_DUMP
|
||||
#ifdef ENABLE_SDP_DES_DUMP
|
||||
static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_t de_size, void *my_context){
|
||||
int indent = *(int*) my_context;
|
||||
int i;
|
||||
@ -668,7 +668,7 @@ static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_
|
||||
#endif
|
||||
|
||||
void de_dump_data_element(uint8_t * record){
|
||||
#ifdef SDP_DES_DUMP
|
||||
#ifdef ENABLE_SDP_DES_DUMP
|
||||
int indent = 0;
|
||||
// hack to get root DES, too.
|
||||
de_type_t type = de_get_element_type(record);
|
||||
|
28
src/hci.c
28
src/hci.c
@ -51,7 +51,7 @@
|
||||
#include "btstack_run_loop_embedded.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
#include "gap.h"
|
||||
#endif
|
||||
|
||||
@ -90,7 +90,7 @@ static int hci_power_control_on(void);
|
||||
static void hci_power_control_off(void);
|
||||
static void hci_state_reset(void);
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// called from test/ble_client/advertising_data_parser.c
|
||||
void le_handle_advertisement_report(uint8_t *packet, int size);
|
||||
static void hci_remove_from_whitelist(bd_addr_type_t address_type, bd_addr_t address);
|
||||
@ -798,7 +798,7 @@ static int hci_classic_supported(void){
|
||||
}
|
||||
|
||||
static int hci_le_supported(void){
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// No. 37, byte 4, bit 6 = LE Supported (Controller)
|
||||
return (hci_stack->local_supported_features[4] & (1 << 6)) != 0;
|
||||
#else
|
||||
@ -816,7 +816,7 @@ void hci_le_advertisement_address(uint8_t * addr_type, bd_addr_t addr){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
void le_handle_advertisement_report(uint8_t *packet, int size){
|
||||
int offset = 3;
|
||||
int num_reports = packet[offset];
|
||||
@ -1068,7 +1068,7 @@ static void hci_initializing_run(void){
|
||||
hci_stack->substate = HCI_INIT_W4_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE;
|
||||
hci_send_cmd(&hci_write_synchronous_flow_control_enable, 1); // SCO tracking enabled
|
||||
break;
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// LE INIT
|
||||
case HCI_INIT_LE_READ_BUFFER_SIZE:
|
||||
hci_stack->substate = HCI_INIT_W4_LE_READ_BUFFER_SIZE;
|
||||
@ -1351,7 +1351,7 @@ static void event_handler(uint8_t *packet, int size){
|
||||
hci_stack->sco_data_packet_length, hci_stack->sco_packets_total_num);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
if (COMMAND_COMPLETE_EVENT(packet, hci_le_read_buffer_size)){
|
||||
hci_stack->le_data_packets_length = READ_BT_16(packet, 6);
|
||||
hci_stack->le_acl_packets_total_num = packet[8];
|
||||
@ -1725,7 +1725,7 @@ static void event_handler(uint8_t *packet, int size){
|
||||
hci_release_packet_buffer();
|
||||
break;
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
case HCI_EVENT_LE_META:
|
||||
switch (packet[2]){
|
||||
case HCI_SUBEVENT_LE_ADVERTISING_REPORT:
|
||||
@ -2298,7 +2298,7 @@ void hci_run(void){
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
if (hci_stack->state == HCI_STATE_WORKING){
|
||||
// handle le scan
|
||||
switch(hci_stack->le_scanning_state){
|
||||
@ -2436,7 +2436,7 @@ void hci_run(void){
|
||||
hci_send_cmd(&hci_create_connection, connection->address, hci_usable_acl_packet_types(), 0, 0, 0, 1);
|
||||
break;
|
||||
default:
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
log_info("sending hci_le_create_connection");
|
||||
hci_send_cmd(&hci_le_create_connection,
|
||||
0x0060, // scan interval: 60 ms
|
||||
@ -2486,7 +2486,7 @@ void hci_run(void){
|
||||
}
|
||||
return;
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
case SEND_CANCEL_CONNECTION:
|
||||
connection->state = SENT_CANCEL_CONNECTION;
|
||||
hci_send_cmd(&hci_le_create_connection_cancel);
|
||||
@ -2583,7 +2583,7 @@ void hci_run(void){
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
if (connection->le_con_parameter_update_state == CON_PARAMETER_UPDATE_CHANGE_HCI_CON_PARAMETERS){
|
||||
connection->le_con_parameter_update_state = CON_PARAMETER_UPDATE_NONE;
|
||||
|
||||
@ -2607,7 +2607,7 @@ void hci_run(void){
|
||||
log_info("HCI_STATE_HALTING");
|
||||
|
||||
// free whitelist entries
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
{
|
||||
btstack_linked_list_iterator_t lit;
|
||||
btstack_linked_list_iterator_init(&lit, &hci_stack->le_whitelist);
|
||||
@ -2785,7 +2785,7 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
|
||||
hci_stack->loopback_mode = packet[3];
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
if (IS_COMMAND(packet, hci_le_set_advertising_parameters)){
|
||||
hci_stack->adv_addr_type = packet[8];
|
||||
}
|
||||
@ -3429,7 +3429,7 @@ gap_connection_type_t gap_get_connection_type(hci_con_handle_t connection_handle
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
|
||||
/**
|
||||
* @brief Auto Connection Establishment - Start Connecting to device
|
||||
|
@ -409,7 +409,7 @@ typedef struct {
|
||||
uint16_t le_conn_latency;
|
||||
uint16_t le_supervision_timeout;
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// LE Security Manager
|
||||
sm_connection_t sm_connection;
|
||||
#endif
|
||||
|
@ -140,14 +140,14 @@ uint16_t hci_cmd_create_from_template(uint8_t *hci_cmd_buffer, const hci_cmd_t *
|
||||
memcpy(&hci_cmd_buffer[pos], ptr, 16);
|
||||
pos += 16;
|
||||
break;
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
case 'A': // 31 bytes advertising data
|
||||
ptr = va_arg(argptr, uint8_t *);
|
||||
memcpy(&hci_cmd_buffer[pos], ptr, 31);
|
||||
pos += 31;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_SDP
|
||||
#ifdef ENABLE_SDP
|
||||
case 'S': { // Service Record (Data Element Sequence)
|
||||
ptr = va_arg(argptr, uint8_t *);
|
||||
uint16_t len = de_get_len(ptr);
|
||||
@ -741,7 +741,7 @@ OPCODE(OGF_STATUS_PARAMETERS, 0x05), "H"
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
/**
|
||||
* Low Energy Commands
|
||||
*/
|
||||
|
@ -293,7 +293,7 @@ static int l2cap_send_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_
|
||||
return hci_send_acl_packet_buffer(len);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
static int l2cap_send_le_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, ...){
|
||||
|
||||
if (!hci_can_send_acl_packet_now(handle)){
|
||||
@ -515,7 +515,7 @@ static void l2cap_run(void){
|
||||
break;
|
||||
case COMMAND_REJECT:
|
||||
l2cap_send_signaling_packet(handle, COMMAND_REJECT, sig_id, result, 0, NULL);
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
case COMMAND_REJECT_LE:
|
||||
l2cap_send_le_signaling_packet(handle, COMMAND_REJECT, sig_id, result, 0, NULL);
|
||||
break;
|
||||
@ -636,7 +636,7 @@ static void l2cap_run(void){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// send l2cap con paramter update if necessary
|
||||
hci_connections_get_iterator(&it);
|
||||
while(btstack_linked_list_iterator_has_next(&it)){
|
||||
@ -1530,7 +1530,7 @@ void l2cap_register_fixed_channel(btstack_packet_handler_t the_packet_handler, u
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
|
||||
|
||||
#if 0
|
||||
|
@ -59,7 +59,7 @@ static const char *l2cap_signaling_commands_format[] = {
|
||||
"D", // 0x09 echo response: Data
|
||||
"2", // 0x0a information request: InfoType {1=Connectionless MTU, 2=Extended features supported}
|
||||
"22D", // 0x0b information response: InfoType, Result, Data
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
// skip 6 not supported signaling pdus, see below
|
||||
"2222", // 0x12 connection parameter update request: interval min, interval max, slave latency, timeout multipler
|
||||
"2", // 0x13 connection parameter update response: result
|
||||
@ -148,7 +148,7 @@ uint16_t l2cap_create_signaling_classic(uint8_t * acl_buffer, hci_con_handle_t h
|
||||
return l2cap_create_signaling_internal(acl_buffer, handle, 1, cmd, identifier, argptr);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
uint16_t l2cap_create_signaling_le(uint8_t * acl_buffer, hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, va_list argptr){
|
||||
return l2cap_create_signaling_internal(acl_buffer, handle, 5, cmd, identifier, argptr);
|
||||
}
|
||||
|
@ -4,15 +4,15 @@
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_BZERO
|
||||
#define HAVE_TIME
|
||||
#define SDP_DES_DUMP
|
||||
#define HAVE_BLE
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_BLE
|
||||
|
||||
#define ENABLE_LOG_DEBUG
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define HAVE_HCI_DUMP
|
||||
|
||||
#define HAVE_SDP_EXTRA_QUERIES
|
||||
#define ENABLE_SDP_EXTRA_QUERIES
|
||||
|
||||
#define HCI_ACL_PAYLOAD_SIZE 52
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 4
|
||||
|
@ -68,7 +68,7 @@ extern "C" {
|
||||
#include "classic/sdp.h"
|
||||
|
||||
// BLE
|
||||
#ifdef HAVE_BLE
|
||||
#ifdef ENABLE_BLE
|
||||
#include "ble/gatt_client.h"
|
||||
#include "ble/sm.h"
|
||||
#endif
|
||||
@ -183,7 +183,7 @@ for struct_names in list_of_structs:
|
||||
for struct_name in struct_names:
|
||||
writeln(f, replacePlaceholder(header_template, struct_name))
|
||||
writeln(f, "")
|
||||
writeln(f, "#ifdef HAVE_BLE")
|
||||
writeln(f, "#ifdef ENABLE_BLE")
|
||||
for struct_names in list_of_le_structs:
|
||||
writeln(f, "// "+ ", ".join(struct_names))
|
||||
for struct_name in struct_names:
|
||||
@ -200,7 +200,7 @@ for struct_names in list_of_structs:
|
||||
for struct_name in struct_names:
|
||||
writeln(f, replacePlaceholder(code_template, struct_name))
|
||||
writeln(f, "")
|
||||
writeln(f, "#ifdef HAVE_BLE")
|
||||
writeln(f, "#ifdef ENABLE_BLE")
|
||||
for struct_names in list_of_le_structs:
|
||||
for struct_name in struct_names:
|
||||
writeln(f, replacePlaceholder(code_template, struct_name))
|
||||
@ -213,7 +213,7 @@ writeln(f, "void btstack_memory_init(void){")
|
||||
for struct_names in list_of_structs:
|
||||
for struct_name in struct_names:
|
||||
writeln(f, replacePlaceholder(init_template, struct_name))
|
||||
writeln(f, "#ifdef HAVE_BLE")
|
||||
writeln(f, "#ifdef ENABLE_BLE")
|
||||
for struct_names in list_of_le_structs:
|
||||
for struct_name in struct_names:
|
||||
writeln(f, replacePlaceholder(init_template, struct_name))
|
||||
|
Loading…
x
Reference in New Issue
Block a user