hci.c (787e73a54d891ae70263abdfbcf486b2e33e67c1) hci.c (b4eb44208c0f004b1854916fa565b0e565f94ef8)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2836 unchanged lines hidden (view full) ---

2845
2846#ifdef ENABLE_CLASSIC
2847 // classic name
2848 hci_stack->local_name = default_classic_name;
2849
2850 // Master slave policy
2851 hci_stack->master_slave_policy = 1;
2852
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2836 unchanged lines hidden (view full) ---

2845
2846#ifdef ENABLE_CLASSIC
2847 // classic name
2848 hci_stack->local_name = default_classic_name;
2849
2850 // Master slave policy
2851 hci_stack->master_slave_policy = 1;
2852
2853 // Allow Role Switch
2854 hci_stack->allow_role_switch = 1;
2855
2853 // Errata-11838 mandates 7 bytes for GAP Security Level 1-3, we use 16 as default
2854 hci_stack->gap_required_encyrption_key_size = 16;
2855#endif
2856
2857 // Secure Simple Pairing default: enable, no I/O capabilities, general bonding, mitm not required, auto accept
2858 hci_stack->ssp_enable = 1;
2859 hci_stack->ssp_io_capability = SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT;
2860 hci_stack->ssp_authentication_requirement = SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_GENERAL_BONDING;

--- 91 unchanged lines hidden (view full) ---

2952void gap_set_class_of_device(uint32_t class_of_device){
2953 hci_stack->class_of_device = class_of_device;
2954}
2955
2956void gap_set_default_link_policy_settings(uint16_t default_link_policy_settings){
2957 hci_stack->default_link_policy_settings = default_link_policy_settings;
2958}
2959
2856 // Errata-11838 mandates 7 bytes for GAP Security Level 1-3, we use 16 as default
2857 hci_stack->gap_required_encyrption_key_size = 16;
2858#endif
2859
2860 // Secure Simple Pairing default: enable, no I/O capabilities, general bonding, mitm not required, auto accept
2861 hci_stack->ssp_enable = 1;
2862 hci_stack->ssp_io_capability = SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT;
2863 hci_stack->ssp_authentication_requirement = SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_GENERAL_BONDING;

--- 91 unchanged lines hidden (view full) ---

2955void gap_set_class_of_device(uint32_t class_of_device){
2956 hci_stack->class_of_device = class_of_device;
2957}
2958
2959void gap_set_default_link_policy_settings(uint16_t default_link_policy_settings){
2960 hci_stack->default_link_policy_settings = default_link_policy_settings;
2961}
2962
2963void gap_set_allow_role_switch(bool allow_role_switch){
2964 hci_stack->allow_role_switch = allow_role_switch ? 1 : 0;
2965}
2966
2967uint8_t hci_get_allow_role_switch(void){
2968 return hci_stack->allow_role_switch;
2969}
2970
2960void gap_set_link_supervision_timeout(uint16_t link_supervision_timeout){
2961 hci_stack->link_supervision_timeout = link_supervision_timeout;
2962}
2963
2964void hci_disable_l2cap_timeout_check(void){
2965 disable_l2cap_timeouts = 1;
2966}
2967#endif

--- 598 unchanged lines hidden (view full) ---

3566 hci_connection_t * connection = (hci_connection_t *) it;
3567
3568 switch(connection->state){
3569 case SEND_CREATE_CONNECTION:
3570 switch(connection->address_type){
3571#ifdef ENABLE_CLASSIC
3572 case BD_ADDR_TYPE_ACL:
3573 log_info("sending hci_create_connection");
2971void gap_set_link_supervision_timeout(uint16_t link_supervision_timeout){
2972 hci_stack->link_supervision_timeout = link_supervision_timeout;
2973}
2974
2975void hci_disable_l2cap_timeout_check(void){
2976 disable_l2cap_timeouts = 1;
2977}
2978#endif

--- 598 unchanged lines hidden (view full) ---

3577 hci_connection_t * connection = (hci_connection_t *) it;
3578
3579 switch(connection->state){
3580 case SEND_CREATE_CONNECTION:
3581 switch(connection->address_type){
3582#ifdef ENABLE_CLASSIC
3583 case BD_ADDR_TYPE_ACL:
3584 log_info("sending hci_create_connection");
3574 hci_send_cmd(&hci_create_connection, connection->address, hci_usable_acl_packet_types(), 0, 0, 0, 1);
3585 hci_send_cmd(&hci_create_connection, connection->address, hci_usable_acl_packet_types(), 0, 0, 0, hci_stack->allow_role_switch);
3575 break;
3576#endif
3577 default:
3578#ifdef ENABLE_BLE
3579#ifdef ENABLE_LE_CENTRAL
3580 // track outgoing connection
3581 hci_stack->outgoing_addr_type = connection->address_type;
3582 (void)memcpy(hci_stack->outgoing_addr,

--- 1830 unchanged lines hidden ---
3586 break;
3587#endif
3588 default:
3589#ifdef ENABLE_BLE
3590#ifdef ENABLE_LE_CENTRAL
3591 // track outgoing connection
3592 hci_stack->outgoing_addr_type = connection->address_type;
3593 (void)memcpy(hci_stack->outgoing_addr,

--- 1830 unchanged lines hidden ---