This commit is contained in:
Milanka Ringwald 2015-07-10 17:16:45 +02:00
commit b8aaad02eb
5 changed files with 28 additions and 14 deletions

View File

@ -1552,7 +1552,7 @@ void bnep_register_packet_handler(void (*handler)(void * connection, uint8_t pac
app_packet_handler = handler;
}
int bnep_connect(void * connection, bd_addr_t addr, uint16_t l2cap_psm, uint16_t uuid_dest)
int bnep_connect(void * connection, bd_addr_t addr, uint16_t l2cap_psm, uint16_t uuid_src, uint16_t uuid_dest)
{
bnep_channel_t *channel;
log_info("BNEP_CONNECT addr %s", bd_addr_to_str(addr));
@ -1562,7 +1562,7 @@ int bnep_connect(void * connection, bd_addr_t addr, uint16_t l2cap_psm, uint16_t
return -1;
}
channel->uuid_source = SDP_PANU;
channel->uuid_source = uuid_src;
channel->uuid_dest = uuid_dest;
l2cap_create_channel_internal(connection, bnep_packet_handler, addr, l2cap_psm, l2cap_max_mtu());

View File

@ -242,7 +242,7 @@ void bnep_register_packet_handler(void (*handler)(void * connection, uint8_t pac
/**
* @brief Creates BNEP connection (channel) to a given server on a remote device with baseband address. A new baseband connection will be initiated if necessary.
*/
int bnep_connect(void * connection, bd_addr_t addr, uint16_t l2cap_psm, uint16_t uuid_dest);
int bnep_connect(void * connection, bd_addr_t addr, uint16_t l2cap_psm, uint16_t uuid_src, uint16_t uuid_dest);
/**
* @brief Disconnects BNEP channel with given identifier.

View File

@ -7,8 +7,8 @@
#define SDP_DES_DUMP
#define HAVE_BLE
// #define ENABLE_LOG_INFO
// #define ENABLE_LOG_ERROR
#define ENABLE_LOG_INFO
#define ENABLE_LOG_ERROR
#define HCI_ACL_PAYLOAD_SIZE 52
@ -28,3 +28,6 @@
#define MAX_NO_DB_MEM_SERVICES 1
#define HAVE_MALLOC
// DeLock 4.0 Dongle (Broadcom BCM20702A0)
#define USB_VENDOR_ID 0x0a5c
#define USB_PRODUCT_ID 0x21e8

View File

@ -21,7 +21,7 @@ VPATH += ${BTSTACK_ROOT}/platforms/libusb
CFLAGS += $(shell pkg-config libusb-1.0 --cflags)
LDFLAGS += $(shell pkg-config libusb-1.0 --libs)
EXAMPLES = hfp_hf_test hfp_ag_test ble_peripheral_test ble_central_test l2cap_test ancs_client classic_test bnep_test hsp_ag_test hsp_hs_test
EXAMPLES = hfp_hf_test hfp_ag_test ble_peripheral_test ble_central_test l2cap_test classic_test bnep_test hsp_ag_test hsp_hs_test
all: ${BTSTACK_ROOT}/include/btstack/version.h ${EXAMPLES}

View File

@ -77,6 +77,16 @@ static bd_addr_t other_addr = { 0,0,0,0,0,0};
// broadcast
static bd_addr_t broadcast_addr = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
// Outgoing: Must match PTS TSPX_UUID_src_addresss
static uint16_t bnep_src_uuid = 0x1115;
// Outgoing: Must match PTS TSPX_UUID_dest_address
static uint32_t bnep_dest_uuid = 0x1116;
// Incoming: Must macht PTS TSPX_UUID_dest_address
static uint16_t bnep_local_service_uuid = 0x1116;
// Sample network protocol type filter set:
// Ethernet type/length values the range 0x0000 - 0x05dc (Length), 0x05dd - 0x05ff (Reserved in IEEE 802.3)
// Ethernet type 0x0600-0xFFFF
@ -88,12 +98,10 @@ static bnep_net_filter_t network_protocol_filter [3] = {{0x0000, 0x05dc}, {0x05d
static bnep_multi_filter_t multicast_filter [1] = {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}};
// state
static bd_addr_t local_addr;
//static uint16_t bnep_protocol_uuid = 0x000f;
static uint16_t bnep_l2cap_psm = 0x000f;
static uint32_t bnep_remote_uuid = SDP_PANU;
//static uint16_t bnep_version = 0;
static uint16_t bnep_cid = 0;
static uint8_t network_buffer[BNEP_MTU_MIN];
@ -247,7 +255,9 @@ static void send_some_ipv6_packet_2(void){
static void show_usage(void){
printf("\n--- Bluetooth BNEP Test Console ---\n");
printf("Local UUID %04x, remote UUID %04x, \n", SDP_PANU, bnep_remote_uuid);
printf("Source UUID %04x (== TSPX_UUID_src_address)\n", bnep_src_uuid);
printf("Destination UUID %04x (== TSPX_UUID_dest_address)\n", bnep_dest_uuid);
printf("Local service UUID %04x (== TSPX_UUID_dest_address)\n", bnep_local_service_uuid);
printf("---\n");
printf("p - connect to PTS\n");
printf("e - send general Ethernet packet\n");
@ -275,7 +285,7 @@ static int stdin_process(struct data_source *ds){
switch (buffer){
case 'p':
printf("Connecting to PTS at %s...\n", bd_addr_to_str(pts_addr));
bnep_connect(NULL, pts_addr, bnep_l2cap_psm, bnep_remote_uuid);
bnep_connect(NULL, pts_addr, bnep_l2cap_psm, bnep_src_uuid, bnep_dest_uuid);
break;
case 'e':
printf("Sending general ethernet packet\n");
@ -287,11 +297,11 @@ static int stdin_process(struct data_source *ds){
break;
case 's':
printf("Sending src only compressed ethernet packet\n");
send_ethernet_packet(1,0);
send_ethernet_packet(0,1);
break;
case 'd':
printf("Sending dst only ethernet packet\n");
send_ethernet_packet(0,1);
send_ethernet_packet(1,0);
break;
case 'f':
printf("Setting network protocol filter\n");
@ -343,6 +353,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
/* BT Stack activated, get started */
if (packet[2] == HCI_STATE_WORKING) {
printf("BNEP Test ready\n");
show_usage();
}
break;
@ -420,7 +431,7 @@ int btstack_main(int argc, const char * argv[]){
/* Initialise BNEP */
bnep_init();
bnep_register_packet_handler(packet_handler);
bnep_register_service(NULL, SDP_PANU, 1691); /* Minimum L2CAP MTU for bnep is 1691 bytes */
bnep_register_service(NULL, bnep_local_service_uuid, 1691); /* Minimum L2CAP MTU for bnep is 1691 bytes */
/* Turn on the device */
hci_power_control(HCI_POWER_ON);