Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be6176dd authored by Myles Watson's avatar Myles Watson
Browse files

Bluetooth: Export AsyncFdWatcher for reuse

Test: Bluetooth starts/stops
Change-Id: I1dcd8684fd150b5eb27c75e5d7803070009e0bf5
parent 5fcb802c
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ cc_library_shared {
    name: "android.hardware.bluetooth@1.0-impl",
    relative_install_path: "hw",
    srcs: [
        "async_fd_watcher.cc",
        "bluetooth_hci.cc",
        "bluetooth_address.cc",
        "vendor_interface.cc",
@@ -33,12 +32,28 @@ cc_library_shared {
        "liblog",
        "libutils",
    ],
    static_libs: [
        "android.hardware.bluetooth-async",
    ],
}

cc_library_static {
    name: "android.hardware.bluetooth-async",
    srcs: [
        "async_fd_watcher.cc",
    ],
    export_include_dirs: ["."],
    shared_libs: [
        "libbase",
        "libcutils",
        "liblog",
        "libutils",
    ],
}

cc_test {
    name: "bluetooth-vendor-interface-unit-tests",
    srcs: [
        "async_fd_watcher.cc",
        "test/async_fd_watcher_unittest.cc",
    ],
    local_include_dirs: [
@@ -48,6 +63,9 @@ cc_test {
        "libbase",
        "liblog",
    ],
    static_libs: [
        "android.hardware.bluetooth-async",
    ],
}

cc_test_host {
+2 −4
Original line number Diff line number Diff line
@@ -29,8 +29,7 @@
namespace android {
namespace hardware {
namespace bluetooth {
namespace V1_0 {
namespace implementation {
namespace async {

int AsyncFdWatcher::WatchFdForNonBlockingReads(
    int file_descriptor, const ReadCallback& on_read_fd_ready_callback) {
@@ -167,8 +166,7 @@ void AsyncFdWatcher::ThreadRoutine() {
  }
}

} // namespace implementation
} // namespace V1_0
} // namespace async
} // namespace bluetooth
} // namespace hardware
} // namespace android
+2 −4
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@
namespace android {
namespace hardware {
namespace bluetooth {
namespace V1_0 {
namespace implementation {
namespace async {

using ReadCallback = std::function<void(int)>;
using TimeoutCallback = std::function<void(void)>;
@@ -62,8 +61,7 @@ class AsyncFdWatcher {
};


} // namespace implementation
} // namespace V1_0
} // namespace async
} // namespace bluetooth
} // namespace hardware
} // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ namespace bluetooth {
namespace V1_0 {
namespace implementation {

using android::hardware::bluetooth::async::AsyncFdWatcher;

class AsyncFdWatcherSocketTest : public ::testing::Test {
 public:
  static const uint16_t kPort = 6111;
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class VendorInterface {

  void *lib_handle_;
  bt_vendor_interface_t *lib_interface_;
  AsyncFdWatcher fd_watcher_;
  async::AsyncFdWatcher fd_watcher_;
  int uart_fd_;
  PacketReadCallback packet_read_cb_;
  InitializeCompleteCallback initialize_complete_cb_;