diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-11-04 20:23:37 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-11-04 20:23:37 +0000 |
commit | 126699071c6669371065fe566bda1b133a162222 (patch) | |
tree | ed7dc3c9c810964abdd278ab2bfd0740bfcfd743 | |
parent | 69fce043c3ff5593ce237a2ee3835489aa48f0fd (diff) | |
parent | c869ade4b47269b16bfd746334cb1a2f46b1cef9 (diff) | |
download | bt-126699071c6669371065fe566bda1b133a162222.tar.gz |
Merge "Revert "topshim: Add btm_sec shim""
-rw-r--r-- | gd/rust/topshim/Android.bp | 6 | ||||
-rw-r--r-- | gd/rust/topshim/BUILD.gn | 1 | ||||
-rw-r--r-- | gd/rust/topshim/btm_sec/btm_sec_shim.cc | 57 | ||||
-rw-r--r-- | gd/rust/topshim/btm_sec/btm_sec_shim.h | 41 | ||||
-rw-r--r-- | gd/rust/topshim/src/btm_sec.rs | 34 | ||||
-rw-r--r-- | gd/rust/topshim/src/lib.rs | 1 |
6 files changed, 0 insertions, 140 deletions
diff --git a/gd/rust/topshim/Android.bp b/gd/rust/topshim/Android.bp index 6a712bf81..1e9677ec0 100644 --- a/gd/rust/topshim/Android.bp +++ b/gd/rust/topshim/Android.bp @@ -52,7 +52,6 @@ cc_library_static { "gatt/gatt_shim.cc", "hfp/hfp_shim.cc", "controller/controller_shim.cc", - "btm_sec/btm_sec_shim.cc", ], generated_headers: ["libbt_topshim_bridge_header", "cxx-bridge-header"], generated_sources: ["libbt_topshim_bridge_code"], @@ -62,12 +61,9 @@ cc_library_static { include_dirs: [ "system/bt", "system/bt/gd/rust/topshim", - "system/bt/internal_include", "system/bt/include", "system/bt/types", - "system/bt/stack/include", ], - cflags: ["-DHAS_NO_BDROID_BUILDCFG"], host_supported: true, } @@ -82,7 +78,6 @@ gensrcs { "src/profiles/hfp.rs", "src/profiles/gatt.rs", "src/controller.rs", - "src/btm_sec.rs", ], output_extension: "rs.h", export_include_dirs: ["."], @@ -99,7 +94,6 @@ gensrcs { "src/profiles/hfp.rs", "src/profiles/gatt.rs", "src/controller.rs", - "src/btm_sec.rs", ], output_extension: "cc", export_include_dirs: ["."], diff --git a/gd/rust/topshim/BUILD.gn b/gd/rust/topshim/BUILD.gn index 03b34def7..bf986cb4b 100644 --- a/gd/rust/topshim/BUILD.gn +++ b/gd/rust/topshim/BUILD.gn @@ -56,7 +56,6 @@ source_set("btif_cxx_bridge_code") { "hfp/hfp_shim.cc", "gatt/gatt_shim.cc", "controller/controller_shim.cc", - "btm_sec/btm_sec_shim.cc", ] deps = [":btif_bridge_header", "//bt/gd:BluetoothGeneratedPackets_h"] diff --git a/gd/rust/topshim/btm_sec/btm_sec_shim.cc b/gd/rust/topshim/btm_sec/btm_sec_shim.cc deleted file mode 100644 index 4046d8360..000000000 --- a/gd/rust/topshim/btm_sec/btm_sec_shim.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "gd/rust/topshim/btm_sec/btm_sec_shim.h" - -#include <memory> - -#include "main/shim/btm_api.h" -#include "src/btm_sec.rs.h" -#include "stack/btm/btm_sec.h" -#include "stack/include/hci_error_code.h" -#include "types/bt_transport.h" - -namespace bluetooth { -namespace topshim { -namespace rust { -namespace internal { -static BtmSecIntf* g_btm_sec_intf; -static RawAddress from_rust_address(const RustRawAddress& raddr) { - RawAddress addr; - addr.FromOctets(raddr.address.data()); - return addr; -} -} // namespace internal - -BtmSecIntf::BtmSecIntf() {} -BtmSecIntf::~BtmSecIntf() {} - -void BtmSecIntf::hci_disconnect(RustRawAddress bt_addr) const { - uint16_t handle = shim::BTM_GetHCIConnHandle(internal::from_rust_address(bt_addr), BT_TRANSPORT_BR_EDR); - btm_sec_disconnect(handle, tHCI_STATUS::HCI_ERR_UNDEFINED); -} - -std::unique_ptr<BtmSecIntf> GetBtmSecInterface() { - if (internal::g_btm_sec_intf) std::abort(); - auto btm_sec_intf = std::make_unique<BtmSecIntf>(); - internal::g_btm_sec_intf = btm_sec_intf.get(); - - return btm_sec_intf; -} - -} // namespace rust -} // namespace topshim -} // namespace bluetooth diff --git a/gd/rust/topshim/btm_sec/btm_sec_shim.h b/gd/rust/topshim/btm_sec/btm_sec_shim.h deleted file mode 100644 index 11403bccb..000000000 --- a/gd/rust/topshim/btm_sec/btm_sec_shim.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef GD_RUST_TOPSHIM_BTM_SEC_SHIM -#define GD_RUST_TOPSHIM_BTM_SEC_SHIM - -#include <memory> - -namespace bluetooth { -namespace topshim { -namespace rust { - -struct RustRawAddress; - -class BtmSecIntf { - public: - BtmSecIntf(); - ~BtmSecIntf(); - - void hci_disconnect(RustRawAddress bt_addr) const; -}; - -std::unique_ptr<BtmSecIntf> GetBtmSecInterface(); - -} // namespace rust -} // namespace topshim -} // namespace bluetooth - -#endif
\ No newline at end of file diff --git a/gd/rust/topshim/src/btm_sec.rs b/gd/rust/topshim/src/btm_sec.rs deleted file mode 100644 index ec7bbcc1f..000000000 --- a/gd/rust/topshim/src/btm_sec.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::btif::RawAddress; - -#[cxx::bridge(namespace = bluetooth::topshim::rust)] -mod ffi { - pub struct RustRawAddress { - address: [u8; 6], - } - - unsafe extern "C++" { - include!("btm_sec/btm_sec_shim.h"); - - type BtmSecIntf; - - fn GetBtmSecInterface() -> UniquePtr<BtmSecIntf>; - fn hci_disconnect(self: &BtmSecIntf, bt_addr: RustRawAddress); - } -} - -pub struct BtmSec { - internal: cxx::UniquePtr<ffi::BtmSecIntf>, -} - -unsafe impl Send for BtmSec {} - -impl BtmSec { - pub fn new() -> BtmSec { - let btm_sec_intf = ffi::GetBtmSecInterface(); - BtmSec { internal: btm_sec_intf } - } - - pub fn hci_disconnect(&mut self, address: [u8; 6]) { - self.internal.hci_disconnect(ffi::RustRawAddress { address }); - } -} diff --git a/gd/rust/topshim/src/lib.rs b/gd/rust/topshim/src/lib.rs index e50a82128..c240ba811 100644 --- a/gd/rust/topshim/src/lib.rs +++ b/gd/rust/topshim/src/lib.rs @@ -8,7 +8,6 @@ extern crate bitflags; pub mod bindings; pub mod btif; -pub mod btm_sec; pub mod controller; pub mod profiles; pub mod topstack; |