mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 13:20:39 +00:00
pts: fix compile
This commit is contained in:
parent
66a3021620
commit
13e6e052f6
@ -39,6 +39,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ble/att_db.h"
|
||||
#include "btstack_defines.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
|
@ -49,21 +49,20 @@
|
||||
|
||||
#include "btstack_config.h"
|
||||
|
||||
#include "btstack_run_loop.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "hci.h"
|
||||
#include "hci_dump.h"
|
||||
|
||||
#include "l2cap.h"
|
||||
|
||||
#include "ble/sm.h"
|
||||
#include "ble/ad_parser.h"
|
||||
#include "ble/att_db.h"
|
||||
#include "ble/att_server.h"
|
||||
#include "gap.h"
|
||||
#include "ble/le_device_db.h"
|
||||
#include "ble/sm.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "gap.h"
|
||||
#include "hci.h"
|
||||
#include "hci_dump.h"
|
||||
#include "l2cap.h"
|
||||
#include "stdin_support.h"
|
||||
#include "ble/ad_parser.h"
|
||||
|
||||
// test profile
|
||||
#include "ble_central_test.h"
|
||||
@ -1598,29 +1597,33 @@ static void ui_process_command(char buffer){
|
||||
}
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
if (ui_digits_for_passkey){
|
||||
return ui_process_digits_for_passkey(buffer);
|
||||
ui_process_digits_for_passkey(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui_uint16_request){
|
||||
return ui_process_uint16_request(buffer);
|
||||
ui_process_uint16_request(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui_uuid128_request){
|
||||
return ui_process_uuid128_request(buffer);
|
||||
ui_process_uuid128_request(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui_value_request){
|
||||
return ui_process_data_request(buffer);
|
||||
ui_process_data_request(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
ui_process_command(buffer);
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static int get_oob_data_callback(uint8_t addres_type, bd_addr_t addr, uint8_t * oob_data){
|
||||
|
@ -49,19 +49,18 @@
|
||||
|
||||
#include "btstack_config.h"
|
||||
|
||||
#include "btstack_run_loop.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "hci.h"
|
||||
#include "hci_dump.h"
|
||||
|
||||
#include "l2cap.h"
|
||||
|
||||
#include "ble/sm.h"
|
||||
#include "ble/att_db.h"
|
||||
#include "ble/att_server.h"
|
||||
#include "gap.h"
|
||||
#include "ble/le_device_db.h"
|
||||
#include "ble/sm.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "gap.h"
|
||||
#include "hci.h"
|
||||
#include "hci_dump.h"
|
||||
#include "l2cap.h"
|
||||
#include "stdin_support.h"
|
||||
|
||||
#define HEARTBEAT_PERIOD_MS 1000
|
||||
@ -573,7 +572,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
break;
|
||||
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
if (!advertisements_enabled == 0 && gap_discoverable){
|
||||
if (advertisements_enabled && gap_discoverable){
|
||||
todos = ENABLE_ADVERTISEMENTS;
|
||||
}
|
||||
att_attributes_init();
|
||||
@ -711,13 +710,13 @@ static void update_auth_req(void){
|
||||
sm_set_authentication_requirements(auth_req);
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
// passkey input
|
||||
if (ui_digits_for_passkey){
|
||||
if (buffer < '0' || buffer > '9') return 0;
|
||||
if (buffer < '0' || buffer > '9') return;
|
||||
printf("%c", buffer);
|
||||
fflush(stdout);
|
||||
ui_passkey = ui_passkey * 10 + buffer - '0';
|
||||
@ -726,7 +725,7 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
printf("\nSending Passkey '%06x'\n", ui_passkey);
|
||||
sm_passkey_input(handle, ui_passkey);
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (buffer){
|
||||
@ -930,7 +929,7 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static int get_oob_data_callback(uint8_t addres_type, bd_addr_t addr, uint8_t * oob_data){
|
||||
|
@ -55,15 +55,15 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "hci_cmd.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "classic/sdp_util.h"
|
||||
|
||||
#include "hci.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "classic/sdp_server.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "hci.h"
|
||||
#include "hci_cmd.h"
|
||||
#include "hci_dump.h"
|
||||
#include "l2cap.h"
|
||||
#include "classic/sdp_server.h"
|
||||
#include "pan.h"
|
||||
#include "stdin_support.h"
|
||||
|
||||
@ -92,6 +92,7 @@
|
||||
|
||||
// prototypes
|
||||
static void show_usage(void);
|
||||
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
|
||||
// Configuration for PTS
|
||||
static bd_addr_t pts_addr = {0x00,0x1b,0xDC,0x07,0x32,0xEF};
|
||||
@ -595,14 +596,14 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
switch (buffer){
|
||||
case 'p':
|
||||
printf("Connecting to PTS at %s...\n", bd_addr_to_str(pts_addr));
|
||||
bnep_connect(pts_addr, bnep_l2cap_psm, bnep_src_uuid, bnep_dest_uuid);
|
||||
bnep_connect(&packet_handler, pts_addr, bnep_l2cap_psm, bnep_src_uuid, bnep_dest_uuid);
|
||||
break;
|
||||
case 'e':
|
||||
printf("Sending general ethernet packet\n");
|
||||
@ -657,7 +658,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************** PANU client routines *********************/
|
||||
@ -707,12 +707,12 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
printf("BNEP channel open failed, status %02x\n", packet[2]);
|
||||
} else {
|
||||
// data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), remote_address (48)
|
||||
uuid_source = little_endian_read_16(packet, 3);
|
||||
uuid_dest = little_endian_read_16(packet, 5);
|
||||
mtu = little_endian_read_16(packet, 7);
|
||||
bnep_cid = channel;
|
||||
bnep_cid = little_endian_read_16(packet, 3);
|
||||
uuid_source = little_endian_read_16(packet, 5);
|
||||
uuid_dest = little_endian_read_16(packet, 7);
|
||||
mtu = little_endian_read_16(packet, 9);
|
||||
//bt_flip_addr(event_addr, &packet[9]);
|
||||
memcpy(&event_addr, &packet[9], sizeof(bd_addr_t));
|
||||
memcpy(&event_addr, &packet[11], sizeof(bd_addr_t));
|
||||
printf("BNEP connection open succeeded to %s source UUID 0x%04x dest UUID: 0x%04x, max frame size %u\n", bd_addr_to_str(event_addr), uuid_source, uuid_dest, mtu);
|
||||
}
|
||||
break;
|
||||
@ -823,8 +823,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
/* Initialise BNEP */
|
||||
bnep_init();
|
||||
bnep_register_packet_handler(packet_handler);
|
||||
bnep_register_service(bnep_local_service_uuid, 1691); /* Minimum L2CAP MTU for bnep is 1691 bytes */
|
||||
bnep_register_service(&packet_handler, bnep_local_service_uuid, 1691); /* Minimum L2CAP MTU for bnep is 1691 bytes */
|
||||
|
||||
/* Initialize SDP and add PANU record */
|
||||
sdp_init();
|
||||
|
@ -473,13 +473,12 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
// passkey input
|
||||
if (ui_digits_for_passkey){
|
||||
if (buffer < '0' || buffer > '9') return 0;
|
||||
printf("%c", buffer);
|
||||
fflush(stdout);
|
||||
ui_passkey = ui_passkey * 10 + buffer - '0';
|
||||
@ -488,7 +487,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
printf("\nSending Passkey '%06u'\n", ui_passkey);
|
||||
hci_send_cmd(&hci_user_passkey_request_reply, remote, ui_passkey);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (ui_chars_for_pin){
|
||||
printf("%c", buffer);
|
||||
@ -499,7 +497,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
} else {
|
||||
ui_pin[ui_pin_offset++] = buffer;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (buffer){
|
||||
@ -689,7 +686,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sdp_create_dummy_service(uint8_t *service, const char *name){
|
||||
|
@ -54,16 +54,16 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "hci_cmd.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "classic/sdp_util.h"
|
||||
|
||||
#include "hci.h"
|
||||
#include "l2cap.h"
|
||||
#include "classic/hfp_ag.h"
|
||||
#include "classic/rfcomm.h"
|
||||
#include "classic/sdp_server.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "classic/hfp_ag.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "hci.h"
|
||||
#include "hci_cmd.h"
|
||||
#include "l2cap.h"
|
||||
#include "stdin_support.h"
|
||||
|
||||
|
||||
@ -339,7 +339,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
read(ds->fd, &cmd, 1);
|
||||
switch (cmd){
|
||||
case 'a':
|
||||
@ -563,8 +563,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
show_usage();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,13 +173,13 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
read(ds->fd, &cmd, 1);
|
||||
|
||||
if (cmd >= '0' && cmd <= '9'){
|
||||
printf("DTMF Code: %c\n", cmd);
|
||||
hfp_hf_send_dtmf_code(device_addr, cmd);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (cmd){
|
||||
@ -455,8 +455,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
show_usage();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,28 +41,28 @@
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "hci_cmd.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "classic/sdp_util.h"
|
||||
|
||||
#include "hci.h"
|
||||
#include "l2cap.h"
|
||||
#include "classic/sdp_server.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "classic/sdp_server.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "hci.h"
|
||||
#include "hci_cmd.h"
|
||||
#include "hsp_ag.h"
|
||||
#include "l2cap.h"
|
||||
#include "stdin_support.h"
|
||||
|
||||
static uint32_t hsp_service_buffer[150/4]; // implicit alignment to 4-byte memory address
|
||||
@ -94,7 +94,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
@ -144,7 +144,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Audio Gateway routines
|
||||
|
@ -43,34 +43,32 @@
|
||||
|
||||
#include "btstack_config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <net/if_arp.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "hci_cmd.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "classic/sdp_server.h"
|
||||
#include "classic/sdp_util.h"
|
||||
|
||||
#include "hci.h"
|
||||
#include "hci_cmd.h"
|
||||
#include "hsp_hs.h"
|
||||
#include "l2cap.h"
|
||||
#include "rfcomm.h"
|
||||
#include "sdp.h"
|
||||
#include "debug.h"
|
||||
#include "hsp_hs.h"
|
||||
#include "stdin_support.h"
|
||||
|
||||
|
||||
const uint32_t hsp_service_buffer[150/4]; // implicit alignment to 4-byte memory address
|
||||
const uint8_t rfcomm_channel_nr = 1;
|
||||
const char hsp_hs_service_name[] = "Headset Test";
|
||||
@ -108,7 +106,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
@ -159,8 +157,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
show_usage();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
|
@ -65,7 +65,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
switch (buffer){
|
||||
@ -74,7 +74,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t pan_service_buffer[200];
|
||||
@ -120,6 +119,6 @@ int btstack_main(int argc, const char * argv[]){
|
||||
// turn on!
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
|
||||
btstack_stdin_setup(stdin_process);
|
||||
btstack_stdin_setup(&stdin_process);
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,12 +49,12 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hci_cmd.h"
|
||||
#include "btstack_run_loop.h"
|
||||
|
||||
#include "hci.h"
|
||||
#include "gap.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "gap.h"
|
||||
#include "hci.h"
|
||||
#include "hci_cmd.h"
|
||||
#include "hci_dump.h"
|
||||
#include "l2cap.h"
|
||||
#include "stdin_support.h"
|
||||
@ -120,7 +120,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
switch (buffer){
|
||||
@ -131,7 +131,7 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
case 's':
|
||||
printf("Send L2CAP Data\n");
|
||||
l2cap_send(local_cid, (uint8_t *) "0123456789", 10);
|
||||
break;
|
||||
break;
|
||||
case 'e':
|
||||
printf("Send L2CAP ECHO Request\n");
|
||||
l2cap_send_echo_request(handle, (uint8_t *) "Hello World!", 13);
|
||||
@ -148,7 +148,6 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user