Loading system/stack/acl/acl.h +2 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ typedef struct { uint8_t num_read_pages; uint8_t switch_role_failed_attempts; uint8_t switch_role_state; uint8_t sca; /* Sleep clock accuracy */ } tACL_CONN; typedef uint8_t tBTM_PM_STATE; Loading Loading @@ -120,6 +121,7 @@ typedef struct { friend void btm_acl_encrypt_change(uint16_t handle, uint8_t status, uint8_t encr_enable); friend void btm_acl_init(void); friend void btm_acl_process_sca_cmpl_pkt(uint8_t evt_len, uint8_t* p); friend void btm_acl_role_changed(uint8_t hci_status, const RawAddress& bd_addr, uint8_t new_role); friend void btm_acl_update_conn_addr(uint16_t conn_handle, Loading system/stack/acl/btm_acl.cc +78 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,41 @@ bool btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC* p_dev_rec, return st; } #endif void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data) { uint16_t handle; uint8_t acl_idx; uint8_t sca; uint8_t status; tACL_CONN* p; STREAM_TO_UINT8(status, data); if (status != HCI_SUCCESS) { BTM_TRACE_DEBUG("%s, Peer SCA Command complete failed 0x%02x\n", __func__, status); return; } STREAM_TO_UINT16(handle, data); STREAM_TO_UINT8(sca, data); acl_idx = btm_handle_to_acl_index(handle); if (acl_idx >= MAX_L2CAP_LINKS) { BTM_TRACE_DEBUG( "%s, Peer SCA Command complete: failed to find handle 0x%04x\n", __func__, handle); return; } p = &btm_cb.acl_cb_.acl_db[acl_idx]; p->sca = sca; BTM_TRACE_DEBUG( "%s, Peer SCA Command complete: handle: 0x%04x, sca: 0x%02x\n", __func__, handle, sca); } /******************************************************************************* * * Function btm_acl_created Loading Loading @@ -317,6 +352,7 @@ void btm_acl_created(const RawAddress& bda, DEV_CLASS dc, BD_NAME bdn, p->link_role = link_role; p->link_up_issued = false; p->remote_addr = bda; p->sca = 0xFF; btm_set_link_policy(p, btm_cb.acl_cb_.btm_def_link_policy); p->transport = transport; Loading Loading @@ -1343,6 +1379,48 @@ uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda, return HCI_INVALID_HANDLE; } /******************************************************************************* * * Function BTM_RequestPeerSCA * * Description This function is called to request sleep clock accuracy * from peer device * ******************************************************************************/ void BTM_RequestPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) { tACL_CONN* p; BTM_TRACE_DEBUG("BTM_RequestPeerSCA"); p = internal_.btm_bda_to_acl(remote_bda, transport); if (p == (tACL_CONN*)NULL) { BTM_TRACE_DEBUG("BTM_RequestPeerSCA: no connection"); return; } btsnd_hcic_req_peer_sca(p->hci_handle); } /******************************************************************************* * * Function BTM_GetPeerSCA * * Description This function is called to get peer sleep clock accuracy * * Returns SCA or 0xFF if SCA was never previously requested, request * is not supported by peer device or ACL does not exist * ******************************************************************************/ uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) { tACL_CONN* p; BTM_TRACE_DEBUG("BTM_GetPeerSCA"); p = internal_.btm_bda_to_acl(remote_bda, transport); if (p != (tACL_CONN*)NULL) { return (p->sca); } /* If here, no BD Addr found */ return (0xFF); } /******************************************************************************* * * Function btm_process_clk_off_comp_evt Loading system/stack/btm/btm_int.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ extern tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, extern void btm_pm_reset(void); extern void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data); /* Internal functions provided by btm_sco.cc ******************************************* */ Loading system/stack/btu/btu_hcif.cc +4 −0 Original line number Diff line number Diff line Loading @@ -440,6 +440,10 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id, BT_HDR* p_msg) { btm_le_on_advertising_set_terminated(p, hci_evt_len); break; case HCI_BLE_REQ_PEER_SCA_CPL_EVT: btm_acl_process_sca_cmpl_pkt(ble_evt_len, p); break; case HCI_BLE_CIS_EST_EVT: case HCI_BLE_CREATE_BIG_CPL_EVT: case HCI_BLE_TERM_BIG_CPL_EVT: Loading system/stack/include/btm_api.h +24 −0 Original line number Diff line number Diff line Loading @@ -741,6 +741,30 @@ tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat, uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda, tBT_TRANSPORT transport); /******************************************************************************* * * Function BTM_RequestPeerSCA * * Description This function is called to request sleep clock accuracy * from peer device * ******************************************************************************/ extern void BTM_RequestPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport); /******************************************************************************* * * Function BTM_GetPeerSCA * * Description This function is called to get peer sleep clock accuracy * * Returns SCA or 0xFF if SCA was never previously requested, request * is not supported by peer device or ACL does not exist * ******************************************************************************/ extern uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport); /******************************************************************************* * * Function BTM_DeleteStoredLinkKey Loading Loading
system/stack/acl/acl.h +2 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ typedef struct { uint8_t num_read_pages; uint8_t switch_role_failed_attempts; uint8_t switch_role_state; uint8_t sca; /* Sleep clock accuracy */ } tACL_CONN; typedef uint8_t tBTM_PM_STATE; Loading Loading @@ -120,6 +121,7 @@ typedef struct { friend void btm_acl_encrypt_change(uint16_t handle, uint8_t status, uint8_t encr_enable); friend void btm_acl_init(void); friend void btm_acl_process_sca_cmpl_pkt(uint8_t evt_len, uint8_t* p); friend void btm_acl_role_changed(uint8_t hci_status, const RawAddress& bd_addr, uint8_t new_role); friend void btm_acl_update_conn_addr(uint16_t conn_handle, Loading
system/stack/acl/btm_acl.cc +78 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,41 @@ bool btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC* p_dev_rec, return st; } #endif void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data) { uint16_t handle; uint8_t acl_idx; uint8_t sca; uint8_t status; tACL_CONN* p; STREAM_TO_UINT8(status, data); if (status != HCI_SUCCESS) { BTM_TRACE_DEBUG("%s, Peer SCA Command complete failed 0x%02x\n", __func__, status); return; } STREAM_TO_UINT16(handle, data); STREAM_TO_UINT8(sca, data); acl_idx = btm_handle_to_acl_index(handle); if (acl_idx >= MAX_L2CAP_LINKS) { BTM_TRACE_DEBUG( "%s, Peer SCA Command complete: failed to find handle 0x%04x\n", __func__, handle); return; } p = &btm_cb.acl_cb_.acl_db[acl_idx]; p->sca = sca; BTM_TRACE_DEBUG( "%s, Peer SCA Command complete: handle: 0x%04x, sca: 0x%02x\n", __func__, handle, sca); } /******************************************************************************* * * Function btm_acl_created Loading Loading @@ -317,6 +352,7 @@ void btm_acl_created(const RawAddress& bda, DEV_CLASS dc, BD_NAME bdn, p->link_role = link_role; p->link_up_issued = false; p->remote_addr = bda; p->sca = 0xFF; btm_set_link_policy(p, btm_cb.acl_cb_.btm_def_link_policy); p->transport = transport; Loading Loading @@ -1343,6 +1379,48 @@ uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda, return HCI_INVALID_HANDLE; } /******************************************************************************* * * Function BTM_RequestPeerSCA * * Description This function is called to request sleep clock accuracy * from peer device * ******************************************************************************/ void BTM_RequestPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) { tACL_CONN* p; BTM_TRACE_DEBUG("BTM_RequestPeerSCA"); p = internal_.btm_bda_to_acl(remote_bda, transport); if (p == (tACL_CONN*)NULL) { BTM_TRACE_DEBUG("BTM_RequestPeerSCA: no connection"); return; } btsnd_hcic_req_peer_sca(p->hci_handle); } /******************************************************************************* * * Function BTM_GetPeerSCA * * Description This function is called to get peer sleep clock accuracy * * Returns SCA or 0xFF if SCA was never previously requested, request * is not supported by peer device or ACL does not exist * ******************************************************************************/ uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) { tACL_CONN* p; BTM_TRACE_DEBUG("BTM_GetPeerSCA"); p = internal_.btm_bda_to_acl(remote_bda, transport); if (p != (tACL_CONN*)NULL) { return (p->sca); } /* If here, no BD Addr found */ return (0xFF); } /******************************************************************************* * * Function btm_process_clk_off_comp_evt Loading
system/stack/btm/btm_int.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ extern tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, extern void btm_pm_reset(void); extern void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data); /* Internal functions provided by btm_sco.cc ******************************************* */ Loading
system/stack/btu/btu_hcif.cc +4 −0 Original line number Diff line number Diff line Loading @@ -440,6 +440,10 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id, BT_HDR* p_msg) { btm_le_on_advertising_set_terminated(p, hci_evt_len); break; case HCI_BLE_REQ_PEER_SCA_CPL_EVT: btm_acl_process_sca_cmpl_pkt(ble_evt_len, p); break; case HCI_BLE_CIS_EST_EVT: case HCI_BLE_CREATE_BIG_CPL_EVT: case HCI_BLE_TERM_BIG_CPL_EVT: Loading
system/stack/include/btm_api.h +24 −0 Original line number Diff line number Diff line Loading @@ -741,6 +741,30 @@ tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat, uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda, tBT_TRANSPORT transport); /******************************************************************************* * * Function BTM_RequestPeerSCA * * Description This function is called to request sleep clock accuracy * from peer device * ******************************************************************************/ extern void BTM_RequestPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport); /******************************************************************************* * * Function BTM_GetPeerSCA * * Description This function is called to get peer sleep clock accuracy * * Returns SCA or 0xFF if SCA was never previously requested, request * is not supported by peer device or ACL does not exist * ******************************************************************************/ extern uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport); /******************************************************************************* * * Function BTM_DeleteStoredLinkKey Loading