mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-24 13:43:38 +00:00
don't set local name - done by BTdaemon since 885
This commit is contained in:
parent
8a485f27d7
commit
855942a4c2
@ -30,7 +30,7 @@ rfcomm: rfcomm.c
|
||||
@USE_LDID@ export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $@
|
||||
|
||||
clean:
|
||||
rm -f test mitm rfcomm inquiry l2cap-server obex
|
||||
rm -f test mitm rfcomm inquiry l2cap-server l2cap-throughput obex
|
||||
|
||||
install:
|
||||
echo "nothing to be done"
|
||||
|
@ -79,7 +79,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
case BTSTACK_EVENT_STATE:
|
||||
// bt stack activated, get started - set local name
|
||||
if (packet[2] == HCI_STATE_WORKING) {
|
||||
bt_send_cmd(&hci_write_local_name, "BTstack-Test");
|
||||
bt_send_cmd(&hci_write_authentication_enable, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -162,10 +162,6 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
break;
|
||||
|
||||
case HCI_EVENT_COMMAND_COMPLETE:
|
||||
// use pairing yes/no
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {
|
||||
bt_send_cmd(&hci_write_authentication_enable, 0);
|
||||
}
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_authentication_enable) ) {
|
||||
bt_send_cmd(&hci_write_class_of_device, 0x2540);
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ bd_addr_t addr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t packet[PACKET_SIZE];
|
||||
uint32_t counter = 0;
|
||||
|
||||
timer_source_t timer;
|
||||
|
||||
void update_packet(){
|
||||
net_store_32( packet, 0, counter++);
|
||||
}
|
||||
@ -62,6 +64,11 @@ void prepare_packet(){
|
||||
for (i=4;i<PACKET_SIZE;i++)
|
||||
packet[i] = i-4;
|
||||
}
|
||||
void timer_handler(struct timer *ts){
|
||||
bt_send_cmd(&hci_read_bd_addr);
|
||||
run_loop_set_timer(&timer, 3000);
|
||||
run_loop_add_timer(&timer);
|
||||
};
|
||||
|
||||
void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
|
||||
@ -92,7 +99,10 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
// bt stack activated, get started
|
||||
if (packet[2] == HCI_STATE_WORKING) {
|
||||
if (serverMode) {
|
||||
printf("Waiting for incoming L2CAP connection on PSM %04x...\n", PSM_TEST);
|
||||
printf("Waiting for incoming L2CAP connection on PSM %04x...\n", PSM_TEST);
|
||||
timer.process = timer_handler;
|
||||
run_loop_set_timer(&timer, 3000);
|
||||
// run_loop_add_timer(&timer);
|
||||
} else {
|
||||
bt_send_cmd(&hci_write_authentication_enable, 0);
|
||||
}
|
||||
@ -105,7 +115,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
bt_send_cmd(&hci_write_class_of_device, 0x38010c);
|
||||
}
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_class_of_device) ) {
|
||||
bt_send_cmd(&l2cap_create_channel, addr, PSM_TEST);
|
||||
bt_send_cmd(&l2cap_create_channel_mtu, addr, PSM_TEST, PACKET_SIZE);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -201,7 +211,7 @@ int main (int argc, const char * argv[]){
|
||||
return err;
|
||||
}
|
||||
bt_register_packet_handler(packet_handler);
|
||||
bt_send_cmd(&l2cap_register_service, 0xdead, 250);
|
||||
bt_send_cmd(&l2cap_register_service, PSM_TEST, PACKET_SIZE);
|
||||
bt_send_cmd(&btstack_set_power_mode, HCI_POWER_ON );
|
||||
|
||||
// banner
|
||||
|
@ -93,9 +93,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
switch(packet[0]){
|
||||
|
||||
case BTSTACK_EVENT_STATE:
|
||||
// bt stack activated, get started - set local name
|
||||
// bt stack activated, get started - set COD
|
||||
if (packet[2] == HCI_STATE_WORKING) {
|
||||
bt_send_cmd(&hci_write_local_name, NAME);
|
||||
bt_send_cmd(&hci_write_class_of_device, 0x7A020C); // used on iPhone
|
||||
}
|
||||
break;
|
||||
|
||||
@ -177,10 +177,6 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
|
||||
case HCI_EVENT_COMMAND_COMPLETE:
|
||||
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {
|
||||
bt_send_cmd(&hci_write_class_of_device, 0x7A020C); // used on iPhone
|
||||
}
|
||||
|
||||
// use pairing yes/no
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_class_of_device) ) {
|
||||
bt_send_cmd(&hci_write_authentication_enable, 0);
|
||||
|
@ -313,9 +313,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
break;
|
||||
|
||||
case BTSTACK_EVENT_STATE:
|
||||
// bt stack activated, get started - set local name
|
||||
// bt stack activated, get started - use authentication yes/no
|
||||
if (packet[2] == HCI_STATE_WORKING) {
|
||||
bt_send_cmd(&hci_write_local_name, "BTstack");
|
||||
bt_send_cmd(&hci_write_authentication_enable, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -362,11 +362,6 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
break;
|
||||
|
||||
case HCI_EVENT_COMMAND_COMPLETE:
|
||||
// use pairing yes/no
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {
|
||||
bt_send_cmd(&hci_write_authentication_enable, 1);
|
||||
}
|
||||
|
||||
// connect to RFCOMM device (PSM 0x03) at addr
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_authentication_enable) ) {
|
||||
bt_send_cmd(&l2cap_create_channel, addr, 0x03);
|
||||
|
@ -83,9 +83,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
break;
|
||||
|
||||
case BTSTACK_EVENT_STATE:
|
||||
// bt stack activated, get started - set local name
|
||||
// bt stack activated, get started - disable pairing
|
||||
if (packet[2] == HCI_STATE_WORKING) {
|
||||
bt_send_cmd(&hci_write_local_name, "BTstack-Test");
|
||||
bt_send_cmd(&hci_write_authentication_enable, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -144,11 +144,6 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
break;
|
||||
|
||||
case HCI_EVENT_COMMAND_COMPLETE:
|
||||
// use pairing yes/no
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {
|
||||
bt_send_cmd(&hci_write_authentication_enable, 0);
|
||||
}
|
||||
|
||||
// connect to HID device (PSM 0x13) at addr
|
||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_authentication_enable) ) {
|
||||
bt_send_cmd(&l2cap_create_channel, addr, 0x13);
|
||||
|
Loading…
x
Reference in New Issue
Block a user