mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-23 19:20:51 +00:00
removed unneccesary code in example
This commit is contained in:
parent
87ea0ea477
commit
5698302b40
4
TODO.txt
4
TODO.txt
@ -2,7 +2,11 @@
|
||||
|
||||
UNTIL 13. August 2009 : Google Open Source Jam
|
||||
- implement L2CAP state machine
|
||||
- outgoing for now only
|
||||
- decide on naming conventions for various layers
|
||||
- decide where L2CAP state machine belongs
|
||||
- decide on l2CAP event/data interface
|
||||
- client does not need to send raw ACL packets
|
||||
- provide demos:
|
||||
- BT Scanner: module info, inquiry, remote name
|
||||
- Terminal app with L2CAP support - Python or Java PC demo
|
||||
|
@ -12,48 +12,38 @@
|
||||
#include "../src/btstack.h"
|
||||
#include "../src/run_loop.h"
|
||||
#include "../src/hci.h"
|
||||
#include "../src/l2cap.h"
|
||||
|
||||
hci_con_handle_t con_handle_out = 0;
|
||||
uint16_t dest_cid;
|
||||
uint16_t local_cid;
|
||||
bd_addr_t addr = {0x00, 0x03, 0xc9, 0x3d, 0x77, 0x43 }; // Think Outside Keyboard
|
||||
|
||||
void acl_handler(uint8_t *packet, uint16_t size){
|
||||
// just dump data
|
||||
// just dump data for now
|
||||
hexdump( packet, size );
|
||||
}
|
||||
|
||||
void event_handler(uint8_t *packet, uint16_t size){
|
||||
// printf("Event type: %x, opcode: %x, other %x\n", packet[0], packet[3] | packet[4] << 8);
|
||||
|
||||
bd_addr_t addr = {0x00, 0x03, 0xc9, 0x3d, 0x77, 0x43 }; // Think Outside Keyboard
|
||||
|
||||
// bt stack activated, get started
|
||||
// bt stack activated, get started - set local name
|
||||
if (packet[0] == HCI_EVENT_BTSTACK_WORKING ||
|
||||
(packet[0] == HCI_EVENT_BTSTACK_STATE && packet[2] == HCI_STATE_WORKING)) {
|
||||
bt_send_cmd(&hci_write_local_name, "BTstack-Test");
|
||||
}
|
||||
|
||||
// set local name
|
||||
// use pairing
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {
|
||||
bt_send_cmd(&hci_write_authentication_enable, 1);
|
||||
}
|
||||
|
||||
// use pairing
|
||||
// connect to HID device (PSM 0x13) at addr
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_authentication_enable) ) {
|
||||
bt_send_cmd(&hci_write_inquiry_mode, 2);
|
||||
}
|
||||
l2cap_create_channel(addr, 0x13, event_handler, acl_handler);
|
||||
}
|
||||
|
||||
|
||||
// inform about pin code request
|
||||
if (packet[0] == HCI_EVENT_PIN_CODE_REQUEST){
|
||||
printf("Please enter PIN 1234 on remote device\n");
|
||||
}
|
||||
|
||||
// connect to device at addr
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_inquiry_mode) ) {
|
||||
l2cap_create_channel(addr, 0x13, event_handler, acl_handler);
|
||||
}
|
||||
|
||||
// inform about new l2cap connection
|
||||
if (packet[0] == HCI_EVENT_L2CAP_CHANNEL_OPENED){
|
||||
printf("Channel successfully opened, handle 0x%02x, local cid 0x%02x\n", READ_BT_16(packet, 2), READ_BT_16(packet, 4));;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user