mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-20 18:40:31 +00:00
example: use AD Flags 0x02 in dual-mode examples
This commit is contained in:
parent
f7e6a692b0
commit
e06798b61b
@ -87,9 +87,16 @@ static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle,
|
||||
static void heartbeat_handler(struct btstack_timer_source *ts);
|
||||
static void beat(void);
|
||||
|
||||
// Flags general discoverable, BR/EDR supported (== not supported flag not set) when ENABLE_GATT_OVER_CLASSIC is enabled
|
||||
#ifdef ENABLE_GATT_OVER_CLASSIC
|
||||
static const uint8_t ad_flags = 0x02;
|
||||
#else
|
||||
static const uint8_t ad_flags = 0x06;
|
||||
#endif
|
||||
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
|
||||
// Flags general discoverable
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, ad_flags,
|
||||
// Name
|
||||
0x0b, BLUETOOTH_DATA_TYPE_COMPLETE_LOCAL_NAME, 'L', 'E', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r',
|
||||
// Incomplete List of 16-bit Service Class UUIDs -- FF10 - only valid for testing!
|
||||
|
@ -77,9 +77,16 @@ static void att_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t
|
||||
static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size);
|
||||
static void streamer(void);
|
||||
|
||||
// Flags general discoverable, BR/EDR supported (== not supported flag not set) when ENABLE_GATT_OVER_CLASSIC is enabled
|
||||
#ifdef ENABLE_GATT_OVER_CLASSIC
|
||||
static const uint8_t ad_flags = 0x02;
|
||||
#else
|
||||
static const uint8_t ad_flags = 0x06;
|
||||
#endif
|
||||
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
|
||||
// Flags general discoverable
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, ad_flags,
|
||||
// Name
|
||||
0x0c, BLUETOOTH_DATA_TYPE_COMPLETE_LOCAL_NAME, 'L', 'E', ' ', 'S', 't', 'r', 'e', 'a', 'm', 'e', 'r',
|
||||
// Incomplete List of 16-bit Service Class UUIDs -- FF10 - only valid for testing!
|
||||
|
@ -84,16 +84,12 @@ static uint8_t gatt_service_buffer[70];
|
||||
/*
|
||||
* @section Advertisements
|
||||
*
|
||||
* @text The Flags attribute in the Advertisement Data indicates if a device is in dual-mode or not.
|
||||
* Flag 0x06 indicates LE General Discoverable, BR/EDR not supported although we're actually using BR/EDR.
|
||||
* In the past, there have been problems with Anrdoid devices when the flag was not set.
|
||||
* Setting it should prevent the remote implementation to try to use GATT over LE/EDR, which is not
|
||||
* implemented by BTstack. So, setting the flag seems like the safer choice (while it's technically incorrect).
|
||||
* @text The Flags attribute in the Advertisement Data indicates if a device is dual-mode or le-only.
|
||||
*/
|
||||
/* LISTING_START(advertisements): Advertisement data: Flag 0x06 indicates LE-only device */
|
||||
/* LISTING_START(advertisements): Advertisement data: Flag 0x02 indicates dual-mode device */
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
|
||||
// Flags general discoverable
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x02,
|
||||
// Name
|
||||
0x0b, BLUETOOTH_DATA_TYPE_COMPLETE_LOCAL_NAME, 'L', 'E', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r',
|
||||
// Incomplete List of 16-bit Service Class UUIDs -- FF10 - only valid for testing!
|
||||
|
@ -75,18 +75,14 @@ int btstack_main(int argc, const char * argv[]);
|
||||
/*
|
||||
* @section Advertisements
|
||||
*
|
||||
* @text The Flags attribute in the Advertisement Data indicates if a device is in dual-mode or not.
|
||||
* Flag 0x06 indicates LE General Discoverable, BR/EDR not supported although we're actually using BR/EDR.
|
||||
* In the past, there have been problems with Anrdoid devices when the flag was not set.
|
||||
* Setting it should prevent the remote implementation to try to use GATT over LE/EDR, which is not
|
||||
* implemented by BTstack. So, setting the flag seems like the safer choice (while it's technically incorrect).
|
||||
* @text The Flags attribute in the Advertisement Data indicates if a device is dual-mode or le-only.
|
||||
*/
|
||||
/* LISTING_START(advertisements): Advertisement data: Flag 0x06 indicates LE-only device */
|
||||
/* LISTING_START(advertisements): Advertisement data: Flag 0x02 indicates dual-mode device */
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, 0x01, 0x06,
|
||||
// Flags general discoverable
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x02,
|
||||
// Name
|
||||
0x0c, 0x09, 'L', 'E', ' ', 'S', 't', 'r', 'e', 'a', 'm', 'e', 'r',
|
||||
0x0c, BLUETOOTH_DATA_TYPE_COMPLETE_LOCAL_NAME, 'L', 'E', ' ', 'S', 't', 'r', 'e', 'a', 'm', 'e', 'r',
|
||||
};
|
||||
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
|
@ -234,7 +234,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_CAN_SEND_NOW:
|
||||
spp_send_packet();
|
||||
// spp_send_packet();
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_CHANNEL_CLOSED:
|
||||
@ -307,6 +307,7 @@ int btstack_main(int argc, const char * argv[])
|
||||
|
||||
gap_ssp_set_io_capability(SSP_IO_CAPABILITY_DISPLAY_YES_NO);
|
||||
gap_set_local_name("SPP Streamer 00:00:00:00:00:00");
|
||||
gap_set_bondable_mode(0);
|
||||
gap_discoverable_control(1);
|
||||
|
||||
spp_create_test_data();
|
||||
|
@ -339,7 +339,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
|
||||
#if (TEST_MODE & TEST_MODE_SEND)
|
||||
case RFCOMM_EVENT_CAN_SEND_NOW:
|
||||
spp_send_packet();
|
||||
// spp_send_packet();
|
||||
break;
|
||||
#endif
|
||||
|
||||
@ -405,6 +405,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
// init SDP
|
||||
gap_ssp_set_io_capability(SSP_IO_CAPABILITY_DISPLAY_YES_NO);
|
||||
gap_set_bondable_mode(0);
|
||||
|
||||
// turn on!
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
|
Loading…
x
Reference in New Issue
Block a user