Loading system/stack/btm/btm_ble_bgconn.cc +29 −1 Original line number Diff line number Diff line Loading @@ -319,6 +319,34 @@ void btm_ble_remove_from_white_list_complete(uint8_t* p, if (*p == HCI_SUCCESS) ++btm_cb.ble_ctr_cb.white_list_avail_size; } void btm_send_hci_create_connection( uint16_t scan_int, uint16_t scan_win, uint8_t init_filter_policy, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t addr_type_own, uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len) { if (controller_get_interface()->supports_ble_extended_advertising()) { EXT_CONN_PHY_CFG phy_cfg; phy_cfg.scan_int = scan_int; phy_cfg.scan_win = scan_win; phy_cfg.conn_int_min = conn_int_min; phy_cfg.conn_int_max = conn_int_max; phy_cfg.conn_latency = conn_latency; phy_cfg.sup_timeout = conn_timeout; phy_cfg.min_ce_len = min_ce_len; phy_cfg.max_ce_len = max_ce_len; btsnd_hcic_ble_ext_create_conn(init_filter_policy, addr_type_own, addr_type_peer, bda_peer, 0x01 /* LE 1M PHY */, &phy_cfg); } else { btsnd_hcic_ble_create_ll_conn(scan_int, scan_win, init_filter_policy, addr_type_peer, bda_peer, addr_type_own, conn_int_min, conn_int_max, conn_latency, conn_timeout, min_ce_len, max_ce_len); } } /******************************************************************************* * * Function btm_ble_start_auto_conn Loading Loading @@ -364,7 +392,7 @@ bool btm_ble_start_auto_conn(bool start) { } #endif btsnd_hcic_ble_create_ll_conn( btm_send_hci_create_connection( scan_int, /* uint16_t scan_int */ scan_win, /* uint16_t scan_win */ 0x01, /* uint8_t white_list */ Loading system/stack/btm/btm_ble_int.h +5 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,11 @@ extern void btm_ble_white_list_init(uint8_t white_list_size); /* background connection function */ extern bool btm_ble_suspend_bg_conn(void); extern bool btm_ble_resume_bg_conn(void); extern void btm_send_hci_create_connection( uint16_t scan_int, uint16_t scan_win, uint8_t init_filter_policy, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t addr_type_own, uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len); extern bool btm_ble_start_auto_conn(bool start); extern bool btm_ble_start_select_conn(bool start); extern bool btm_ble_renew_bg_conn_params(bool add, BD_ADDR bd_addr); Loading system/stack/hcic/hciblecmds.cc +42 −0 Original line number Diff line number Diff line Loading @@ -741,3 +741,45 @@ void btsnd_hcic_ble_set_extended_scan_enable(uint8_t enable, btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); } void btsnd_hcic_ble_ext_create_conn(uint8_t init_filter_policy, uint8_t addr_type_own, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t initiating_phys, EXT_CONN_PHY_CFG* phy_cfg) { BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); uint8_t* pp = (uint8_t*)(p + 1); int phy_cnt = std::bitset<std::numeric_limits<uint8_t>::digits>(initiating_phys) .count(); /* param_len = initial_params + size_per_channel * num_of_channels */ uint8_t param_len = 10 + (16 * phy_cnt); p->len = HCIC_PREAMBLE_SIZE + param_len; p->offset = 0; UINT16_TO_STREAM(pp, HCI_LE_EXTENDED_CREATE_CONNECTION); UINT8_TO_STREAM(pp, param_len); UINT8_TO_STREAM(pp, init_filter_policy); UINT8_TO_STREAM(pp, addr_type_own); UINT8_TO_STREAM(pp, addr_type_peer); BDADDR_TO_STREAM(pp, bda_peer); UINT8_TO_STREAM(pp, initiating_phys); for (int i = 0; i < phy_cnt; i++) { UINT16_TO_STREAM(pp, phy_cfg[i].scan_int); UINT16_TO_STREAM(pp, phy_cfg[i].scan_win); UINT16_TO_STREAM(pp, phy_cfg[i].conn_int_min); UINT16_TO_STREAM(pp, phy_cfg[i].conn_int_max); UINT16_TO_STREAM(pp, phy_cfg[i].conn_latency); UINT16_TO_STREAM(pp, phy_cfg[i].sup_timeout); UINT16_TO_STREAM(pp, phy_cfg[i].min_ce_len); UINT16_TO_STREAM(pp, phy_cfg[i].max_ce_len); } btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); } system/stack/include/hcidefs.h +1 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,7 @@ (0x003B | HCI_GRP_BLE_CMDS) #define HCI_LE_SET_EXTENDED_SCAN_PARAMETERS (0x0041 | HCI_GRP_BLE_CMDS) #define HCI_LE_SET_EXTENDED_SCAN_ENABLE (0x0042 | HCI_GRP_BLE_CMDS) #define HCI_LE_EXTENDED_CREATE_CONNECTION (0x0043 | HCI_GRP_BLE_CMDS) /* LE Get Vendor Capabilities Command OCF */ #define HCI_BLE_VENDOR_CAP_OCF (0x0153 | HCI_GRP_VENDOR_SPECIFIC) Loading system/stack/include/hcimsgs.h +15 −0 Original line number Diff line number Diff line Loading @@ -812,6 +812,21 @@ extern void btsnd_hcic_ble_set_extended_scan_enable(uint8_t enable, uint16_t duration, uint16_t period); struct EXT_CONN_PHY_CFG { uint16_t scan_int; uint16_t scan_win; uint16_t conn_int_min; uint16_t conn_int_max; uint16_t conn_latency; uint16_t sup_timeout; uint16_t min_ce_len; uint16_t max_ce_len; }; extern void btsnd_hcic_ble_ext_create_conn( uint8_t init_filter_policy, uint8_t addr_type_own, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t initiating_phys, EXT_CONN_PHY_CFG* phy_cfg); extern void btsnd_hcic_ble_add_device_resolving_list( uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t irk_peer[HCIC_BLE_IRK_SIZE], uint8_t irk_local[HCIC_BLE_IRK_SIZE]); Loading Loading
system/stack/btm/btm_ble_bgconn.cc +29 −1 Original line number Diff line number Diff line Loading @@ -319,6 +319,34 @@ void btm_ble_remove_from_white_list_complete(uint8_t* p, if (*p == HCI_SUCCESS) ++btm_cb.ble_ctr_cb.white_list_avail_size; } void btm_send_hci_create_connection( uint16_t scan_int, uint16_t scan_win, uint8_t init_filter_policy, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t addr_type_own, uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len) { if (controller_get_interface()->supports_ble_extended_advertising()) { EXT_CONN_PHY_CFG phy_cfg; phy_cfg.scan_int = scan_int; phy_cfg.scan_win = scan_win; phy_cfg.conn_int_min = conn_int_min; phy_cfg.conn_int_max = conn_int_max; phy_cfg.conn_latency = conn_latency; phy_cfg.sup_timeout = conn_timeout; phy_cfg.min_ce_len = min_ce_len; phy_cfg.max_ce_len = max_ce_len; btsnd_hcic_ble_ext_create_conn(init_filter_policy, addr_type_own, addr_type_peer, bda_peer, 0x01 /* LE 1M PHY */, &phy_cfg); } else { btsnd_hcic_ble_create_ll_conn(scan_int, scan_win, init_filter_policy, addr_type_peer, bda_peer, addr_type_own, conn_int_min, conn_int_max, conn_latency, conn_timeout, min_ce_len, max_ce_len); } } /******************************************************************************* * * Function btm_ble_start_auto_conn Loading Loading @@ -364,7 +392,7 @@ bool btm_ble_start_auto_conn(bool start) { } #endif btsnd_hcic_ble_create_ll_conn( btm_send_hci_create_connection( scan_int, /* uint16_t scan_int */ scan_win, /* uint16_t scan_win */ 0x01, /* uint8_t white_list */ Loading
system/stack/btm/btm_ble_int.h +5 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,11 @@ extern void btm_ble_white_list_init(uint8_t white_list_size); /* background connection function */ extern bool btm_ble_suspend_bg_conn(void); extern bool btm_ble_resume_bg_conn(void); extern void btm_send_hci_create_connection( uint16_t scan_int, uint16_t scan_win, uint8_t init_filter_policy, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t addr_type_own, uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len); extern bool btm_ble_start_auto_conn(bool start); extern bool btm_ble_start_select_conn(bool start); extern bool btm_ble_renew_bg_conn_params(bool add, BD_ADDR bd_addr); Loading
system/stack/hcic/hciblecmds.cc +42 −0 Original line number Diff line number Diff line Loading @@ -741,3 +741,45 @@ void btsnd_hcic_ble_set_extended_scan_enable(uint8_t enable, btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); } void btsnd_hcic_ble_ext_create_conn(uint8_t init_filter_policy, uint8_t addr_type_own, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t initiating_phys, EXT_CONN_PHY_CFG* phy_cfg) { BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); uint8_t* pp = (uint8_t*)(p + 1); int phy_cnt = std::bitset<std::numeric_limits<uint8_t>::digits>(initiating_phys) .count(); /* param_len = initial_params + size_per_channel * num_of_channels */ uint8_t param_len = 10 + (16 * phy_cnt); p->len = HCIC_PREAMBLE_SIZE + param_len; p->offset = 0; UINT16_TO_STREAM(pp, HCI_LE_EXTENDED_CREATE_CONNECTION); UINT8_TO_STREAM(pp, param_len); UINT8_TO_STREAM(pp, init_filter_policy); UINT8_TO_STREAM(pp, addr_type_own); UINT8_TO_STREAM(pp, addr_type_peer); BDADDR_TO_STREAM(pp, bda_peer); UINT8_TO_STREAM(pp, initiating_phys); for (int i = 0; i < phy_cnt; i++) { UINT16_TO_STREAM(pp, phy_cfg[i].scan_int); UINT16_TO_STREAM(pp, phy_cfg[i].scan_win); UINT16_TO_STREAM(pp, phy_cfg[i].conn_int_min); UINT16_TO_STREAM(pp, phy_cfg[i].conn_int_max); UINT16_TO_STREAM(pp, phy_cfg[i].conn_latency); UINT16_TO_STREAM(pp, phy_cfg[i].sup_timeout); UINT16_TO_STREAM(pp, phy_cfg[i].min_ce_len); UINT16_TO_STREAM(pp, phy_cfg[i].max_ce_len); } btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); }
system/stack/include/hcidefs.h +1 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,7 @@ (0x003B | HCI_GRP_BLE_CMDS) #define HCI_LE_SET_EXTENDED_SCAN_PARAMETERS (0x0041 | HCI_GRP_BLE_CMDS) #define HCI_LE_SET_EXTENDED_SCAN_ENABLE (0x0042 | HCI_GRP_BLE_CMDS) #define HCI_LE_EXTENDED_CREATE_CONNECTION (0x0043 | HCI_GRP_BLE_CMDS) /* LE Get Vendor Capabilities Command OCF */ #define HCI_BLE_VENDOR_CAP_OCF (0x0153 | HCI_GRP_VENDOR_SPECIFIC) Loading
system/stack/include/hcimsgs.h +15 −0 Original line number Diff line number Diff line Loading @@ -812,6 +812,21 @@ extern void btsnd_hcic_ble_set_extended_scan_enable(uint8_t enable, uint16_t duration, uint16_t period); struct EXT_CONN_PHY_CFG { uint16_t scan_int; uint16_t scan_win; uint16_t conn_int_min; uint16_t conn_int_max; uint16_t conn_latency; uint16_t sup_timeout; uint16_t min_ce_len; uint16_t max_ce_len; }; extern void btsnd_hcic_ble_ext_create_conn( uint8_t init_filter_policy, uint8_t addr_type_own, uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t initiating_phys, EXT_CONN_PHY_CFG* phy_cfg); extern void btsnd_hcic_ble_add_device_resolving_list( uint8_t addr_type_peer, BD_ADDR bda_peer, uint8_t irk_peer[HCIC_BLE_IRK_SIZE], uint8_t irk_local[HCIC_BLE_IRK_SIZE]); Loading