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

Commit d6878ea5 authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi Committed by Abhishek Pandit-Subedi
Browse files

floss: Implement sdp topshim

Bug: 189497381
Tag: #floss
Test: Build + test on ChromeOS with later changes
Change-Id: Ib0138f38f12a1d04ff71645d02d25b91a612d4d0
parent 4e65d4e0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -106,10 +106,13 @@ rust_bindgen {
        "--allowlist-function=bt_.*",
        "--allowlist-function=bthh_.*",
        "--allowlist-function=btgatt_.*",
        "--allowlist-function=btsdp.*",
        "--allowlist-function=hal_util_.*",
        "--allowlist-type=bt_.*",
        "--allowlist-type=bthh_.*",
        "--allowlist-type=btgatt_.*",
        "--allowlist-type=bluetooth_sdp.*",
        "--allowlist-type=btsdp.*",
        "--enable-cxx-namespaces",
        "--opaque-type=std::.*",
        "--with-derive-default",
+1 −1
Original line number Diff line number Diff line
@@ -6,6 +6,6 @@

// Profiles

// Hid host profile
#include "hardware/bt_gatt.h"
#include "hardware/bt_hh.h"
#include "hardware/bt_sdp.h"
+2 −2
Original line number Diff line number Diff line
@@ -35,8 +35,8 @@ fn main() {
        .clang_args(clang_args)
        .enable_cxx_namespaces()
        .size_t_is_usize(true)
        .allowlist_type("(bt_|bthh_|btgatt_).*")
        .allowlist_function("(bt_|bthh_|btgatt_).*")
        .allowlist_type("(bt_|bthh_|btgatt_|btsdp|bluetooth_sdp).*")
        .allowlist_function("(bt_|bthh_|btgatt_|btsdp).*")
        .allowlist_function("hal_util_.*")
        // We must opaque out std:: in order to prevent bindgen from choking
        .opaque_type("std::.*")
+10 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ pub enum BtStatus {
    Unknown = 0xff,
}

fn ascii_to_string(data: &[u8], length: usize) -> String {
pub fn ascii_to_string(data: &[u8], length: usize) -> String {
    // We need to reslice data because from_utf8 tries to interpret the
    // whole slice and not just what is before the null terminated portion
    let ascii = data
@@ -523,6 +523,7 @@ pub enum SupportedProfiles {
    HidHost,
    A2dp,
    Gatt,
    Sdp,
}

impl From<SupportedProfiles> for Vec<u8> {
@@ -531,6 +532,7 @@ impl From<SupportedProfiles> for Vec<u8> {
            SupportedProfiles::HidHost => "hidhost",
            SupportedProfiles::A2dp => "a2dp",
            SupportedProfiles::Gatt => "gatt",
            SupportedProfiles::Sdp => "sdp",
        }
        .bytes()
        .chain("\0".bytes())
@@ -632,6 +634,13 @@ macro_rules! deref_ffi_address {
    };
}

#[macro_export]
macro_rules! deref_const_ffi_address {
    ($ffi_addr:ident) => {
        *($ffi_addr as *const RawAddress)
    };
}

#[macro_export]
macro_rules! cast_to_ffi_address {
    ($raw_addr:expr) => {
+1 −0
Original line number Diff line number Diff line
@@ -2,3 +2,4 @@ pub mod a2dp;
pub mod avrcp;
pub mod gatt;
pub mod hid_host;
pub mod sdp;
Loading