mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-21 12:40:42 +00:00
merge fixes from master
This commit is contained in:
parent
32b6d931de
commit
bf85c2858a
@ -85,9 +85,11 @@ static void beat(void);
|
||||
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, 0x01, 0x06,
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
|
||||
// Name
|
||||
0x0b, 0x09, 'L', 'E', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r',
|
||||
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!
|
||||
0x03, BLUETOOTH_DATA_TYPE_INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS, 0x10, 0xff,
|
||||
};
|
||||
const uint8_t adv_data_len = sizeof(adv_data);
|
||||
|
||||
|
@ -72,9 +72,11 @@ static void streamer(void);
|
||||
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, 0x01, 0x06,
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
|
||||
// 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',
|
||||
// Incomplete List of 16-bit Service Class UUIDs -- FF10 - only valid for testing!
|
||||
0x03, BLUETOOTH_DATA_TYPE_INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS, 0x10, 0xff,
|
||||
};
|
||||
const uint8_t adv_data_len = sizeof(adv_data);
|
||||
|
||||
|
@ -75,9 +75,9 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, 0x01, 0x06,
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
|
||||
// Name
|
||||
0x0b, 0x09, 'S', 'M', ' ', 'P', 'a', 'i', 'r', 'i', 'n', 'g',
|
||||
0x0b, BLUETOOTH_DATA_TYPE_COMPLETE_LOCAL_NAME, 'S', 'M', ' ', 'P', 'a', 'i', 'r', 'i', 'n', 'g',
|
||||
};
|
||||
const uint8_t adv_data_len = sizeof(adv_data);
|
||||
|
||||
|
@ -89,10 +89,11 @@ static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
/* LISTING_START(advertisements): Advertisement data: Flag 0x06 indicates LE-only device */
|
||||
const uint8_t adv_data[] = {
|
||||
// Flags general discoverable, BR/EDR not supported
|
||||
0x02, 0x01, 0x06,
|
||||
|
||||
0x02, BLUETOOTH_DATA_TYPE_FLAGS, 0x06,
|
||||
// Name
|
||||
0x0b, 0x09, 'L', 'E', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r',
|
||||
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!
|
||||
0x03, BLUETOOTH_DATA_TYPE_INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS, 0x10, 0xff,
|
||||
};
|
||||
/* LISTING_END */
|
||||
uint8_t adv_data_len = sizeof(adv_data);
|
||||
|
@ -190,7 +190,7 @@ bnep_test: ${CORE_OBJ} ${COMMON_OBJ} bnep.o pan.o bnep_test.c
|
||||
sco_loopback: ${CORE_OBJ} ${COMMON_OBJ} sco_loopback.c
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
iopt: ${CORE_OBJ} ${COMMON_OBJ} pan.o hsp_ag.o hsp_hs.o hfp_ag.o hfp_hf.o hfp_gsm_model.o iopt.c hfp.o ${SDP_CLIENT}
|
||||
iopt: ${CORE_OBJ} ${COMMON_OBJ} pan.o hsp_ag.o hsp_hs.o hfp_ag.o hfp_hf.o hfp_gsm_model.o iopt.c hfp.o a2dp_sink.o a2dp_source.o ${AVDTP_OBJ} avrcp_controller.o avrcp_target.o avrcp.o ${SDP_CLIENT}
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
sm_test: sm_test.h ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_SERVER_OBJ} ${GATT_CLIENT_OBJ} ${SM_OBJ} sm_test.o
|
||||
|
@ -68,10 +68,9 @@
|
||||
|
||||
static void show_usage(void);
|
||||
|
||||
// static bd_addr_t remote = {0x04,0x0C,0xCE,0xE4,0x85,0xD3};
|
||||
// static bd_addr_t remote = {0x84, 0x38, 0x35, 0x65, 0xD1, 0x15};
|
||||
static bd_addr_t remote = {0x00, 0x1b, 0xdc, 0x07, 0x32, 0xef};
|
||||
static bd_addr_t remote_rfcomm = {0x00, 0x00, 0x91, 0xE0, 0xD4, 0xC7};
|
||||
static bd_addr_t remote;
|
||||
static bd_addr_t remote_rfcomm;
|
||||
static const char * remote_addr_string = "00:1B:DC:08:E2:72";
|
||||
|
||||
static uint8_t rfcomm_channel_nr = 1;
|
||||
|
||||
@ -180,6 +179,8 @@ static void continue_remote_names(void){
|
||||
}
|
||||
|
||||
static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
UNUSED(size);
|
||||
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int numResponses;
|
||||
@ -267,6 +268,9 @@ static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
|
||||
UNUSED(channel);
|
||||
UNUSED(packet_type);
|
||||
|
||||
uint16_t psm;
|
||||
uint32_t passkey;
|
||||
|
||||
@ -401,6 +405,10 @@ static void handle_found_service(const char * name, uint8_t port){
|
||||
}
|
||||
|
||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(packet_type);
|
||||
UNUSED(size);
|
||||
|
||||
switch (packet[0]){
|
||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||
handle_found_service(sdp_event_query_rfcomm_service_get_name(packet),
|
||||
@ -492,7 +500,7 @@ static void stdin_process(char c){
|
||||
if (c == '\n'){
|
||||
printf("\nSending Pin '%s'\n", ui_pin);
|
||||
ui_pin[ui_pin_offset] = 0;
|
||||
gap_pin_code_response(remote, ui_pin);
|
||||
gap_pin_code_response(remote, (const char*) ui_pin);
|
||||
} else {
|
||||
ui_pin[ui_pin_offset++] = c;
|
||||
}
|
||||
@ -753,7 +761,9 @@ static void sdp_create_dummy_service(uint8_t *service, const char *name){
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
(void) argv;
|
||||
(void) argc;
|
||||
|
||||
printf("Starting up..\n");
|
||||
|
||||
hci_disable_l2cap_timeout_check();
|
||||
@ -792,6 +802,10 @@ int btstack_main(int argc, const char * argv[]){
|
||||
gap_discoverable_control(0);
|
||||
gap_connectable_control(0);
|
||||
|
||||
// parse human readable Bluetooth address
|
||||
sscanf_bd_addr(remote_addr_string, remote);
|
||||
sscanf_bd_addr(remote_addr_string, remote_rfcomm);
|
||||
|
||||
// turn on!
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
|
||||
|
@ -55,6 +55,10 @@
|
||||
|
||||
static void show_usage(void){
|
||||
printf("\n--- CLI for IOP Testing ---\n");
|
||||
printf("A2DP Sink\n");
|
||||
printf("A2DP Source\n");
|
||||
printf("AVRCP Controller\n");
|
||||
printf("AVRCP Target\n");
|
||||
printf("HSP AG\n");
|
||||
printf("HSP HF\n");
|
||||
printf("HFP AG\n");
|
||||
@ -81,6 +85,12 @@ static uint8_t hsp_ag_service_buffer[200]; // rfcomm 2
|
||||
static uint8_t hsp_hs_service_buffer[200]; // rfcomm 3
|
||||
static uint8_t hfp_ag_service_buffer[200]; // rfcomm 4
|
||||
static uint8_t hfp_hf_service_buffer[200]; // rfcomm 5
|
||||
static uint8_t a2dp_sink_service_buffer[150];
|
||||
static uint8_t a2dp_source_service_buffer[150];
|
||||
static uint8_t avrcp_controller_service_buffer[200];
|
||||
static uint8_t avrcp_target_service_buffer[200];
|
||||
|
||||
#define AVRCP_BROWSING_ENABLED 0
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
int btstack_main(int argc, const char * argv[]){
|
||||
@ -95,7 +105,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
// See https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers if you don't have a USB Vendor ID and need a Bluetooth Vendor ID
|
||||
// device info: BlueKitchen GmbH, product 1, version 1
|
||||
device_id_create_sdp_record(device_id_sdp_service_buffer, 0x10003, DEVICE_ID_VENDOR_ID_SOURCE_BLUETOOTH, BLUETOOTH_COMPANY_ID_BLUEKITCHEN_GMBH, 1, 1);
|
||||
device_id_create_sdp_record(device_id_sdp_service_buffer, 0x10000, DEVICE_ID_VENDOR_ID_SOURCE_BLUETOOTH, BLUETOOTH_COMPANY_ID_BLUEKITCHEN_GMBH, 1, 1);
|
||||
sdp_register_service(device_id_sdp_service_buffer);
|
||||
|
||||
spp_create_sdp_record((uint8_t*) spp_service_buffer, 0x10001, 1, "SPP");
|
||||
@ -117,8 +127,20 @@ int btstack_main(int argc, const char * argv[]){
|
||||
hfp_hf_create_sdp_record((uint8_t *)hfp_hf_service_buffer, 0x10006, 5, "HFP HS", 0, 1);
|
||||
sdp_register_service((uint8_t *)hfp_hf_service_buffer);
|
||||
|
||||
a2dp_sink_create_sdp_record(a2dp_sink_service_buffer, 0x10007, 1, NULL, NULL);
|
||||
sdp_register_service(a2dp_sink_service_buffer);
|
||||
|
||||
avrcp_controller_create_sdp_record(avrcp_controller_service_buffer, 0x10008, AVRCP_BROWSING_ENABLED, 1, NULL, NULL);
|
||||
sdp_register_service(avrcp_controller_service_buffer);
|
||||
|
||||
a2dp_source_create_sdp_record(a2dp_source_service_buffer, 0x10009, 1, NULL, NULL);
|
||||
sdp_register_service(a2dp_source_service_buffer);
|
||||
|
||||
avrcp_target_create_sdp_record(avrcp_target_service_buffer, 0x1000a, AVRCP_BROWSING_ENABLED, 1, NULL, NULL);
|
||||
sdp_register_service(avrcp_target_service_buffer);
|
||||
|
||||
// set CoD for all this
|
||||
gap_set_class_of_device(0x6A0000); // Networking, Capturing, Audio, Telehpony / Misc
|
||||
gap_set_class_of_device(0x6E0000); // Networking, Rendering (Spekaer), Capturing (Microphone), Audio, Telehpony / Misc
|
||||
|
||||
gap_discoverable_control(1);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user