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

Commit 9e8bcb14 authored by Yun-hao Chung's avatar Yun-hao Chung Committed by Gerrit Code Review
Browse files

Merge changes I6759daf9,Ic0734dd8

* changes:
  Floss: Wire A2DP Sink missing callbacks to floss topshim
  Floss: Wire avrcp ctrl interface to floss topshim
parents 55fa7b64 8be89bba
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ rust_bindgen {
        "--allowlist-type=btsdp.*",
        "--allowlist-type=btsock_.*",
        "--allowlist-type=bthf_.*",
        "--allowlist-type=btrc_.*",
        "--allowlist-type=sock_connect_signal_t",
        "--enable-cxx-namespaces",
        "--opaque-type=std::.*",
+1 −0
Original line number Diff line number Diff line
@@ -9,5 +9,6 @@
#include "hardware/bt_gatt.h"
#include "hardware/bt_hf_client.h"
#include "hardware/bt_hh.h"
#include "hardware/bt_rc.h"
#include "hardware/bt_sdp.h"
#include "hardware/bt_sock.h"
+20 −3
Original line number Diff line number Diff line
@@ -31,9 +31,26 @@ namespace rust {
namespace internal {
static A2dpSinkIntf* g_a2dp_sink_if;

static void connection_state_cb(const RawAddress&, btav_connection_state_t, const btav_error_t&) {}
static void audio_state_cb(const RawAddress&, btav_audio_state_t) {}
static void audio_config_cb(const RawAddress&, uint32_t, uint8_t) {}
static A2dpError to_rust_error(const btav_error_t& error) {
  A2dpError a2dp_error = {
      .status = error.status,
      .error_code = error.error_code,
      .error_msg = error.error_msg.value_or(""),
  };
  return a2dp_error;
}

static void connection_state_cb(
    const RawAddress& addr, btav_connection_state_t state, const btav_error_t& error) {
  A2dpError a2dp_error = to_rust_error(error);
  rusty::sink_connection_state_callback(addr, state, a2dp_error);
}
static void audio_state_cb(const RawAddress& addr, btav_audio_state_t state) {
  rusty::sink_audio_state_callback(addr, state);
}
static void audio_config_cb(const RawAddress& addr, uint32_t sample_rate, uint8_t channel_count) {
  rusty::sink_audio_config_callback(addr, sample_rate, channel_count);
}

btav_sink_callbacks_t g_a2dp_sink_callbacks = {
    sizeof(btav_sink_callbacks_t),
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ fn main() {
        .size_t_is_usize(true)
        .blocklist_function("RawAddress_.*")
        .blocklist_function(".*Uuid_.*")
        .allowlist_type("(bt_|bthh_|btgatt_|btsdp|bluetooth_sdp|btsock_|bthf_).*")
        .allowlist_type("(bt_|bthh_|btgatt_|btsdp|bluetooth_sdp|btsock_|bthf_|btrc_).*")
        .allowlist_type("sock_connect_signal_t")
        .allowlist_function("(bt_|bthh_|btgatt_|btsdp).*")
        .allowlist_function("hal_util_.*")
+2 −0
Original line number Diff line number Diff line
@@ -705,6 +705,7 @@ pub enum SupportedProfiles {
    Sdp,
    Socket,
    HfClient,
    AvrcpCtrl,
}

impl From<SupportedProfiles> for Vec<u8> {
@@ -717,6 +718,7 @@ impl From<SupportedProfiles> for Vec<u8> {
            SupportedProfiles::Sdp => "sdp",
            SupportedProfiles::Socket => "socket",
            SupportedProfiles::HfClient => "handsfree_client",
            SupportedProfiles::AvrcpCtrl => "avrcp_ctrl",
        }
        .bytes()
        .chain("\0".bytes())
Loading