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

Commit ad78590d authored by En-Shuo Hsu's avatar En-Shuo Hsu Committed by Gerrit Code Review
Browse files

Merge "floss: Append HfpCodecCapability"

parents 9636f583 3e7d4887
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ impl IBluetoothMediaCallback for BluetoothMediaCallbackDBus {
        sample_rate: i32,
        bits_per_sample: i32,
        channel_mode: i32,
        hfp_cap: i32,
    ) {
    }

+9 −2
Original line number Diff line number Diff line
@@ -7,7 +7,9 @@ use bt_topshim::profiles::a2dp::{
    PresentationPosition,
};
use bt_topshim::profiles::avrcp::{Avrcp, AvrcpCallbacks, AvrcpCallbacksDispatcher};
use bt_topshim::profiles::hfp::{BthfConnectionState, Hfp, HfpCallbacks, HfpCallbacksDispatcher};
use bt_topshim::profiles::hfp::{
    BthfConnectionState, Hfp, HfpCallbacks, HfpCallbacksDispatcher, HfpCodecCapability,
};

use bt_topshim::topstack;

@@ -48,13 +50,17 @@ pub trait IBluetoothMedia {
}

pub trait IBluetoothMediaCallback {
    ///
    /// Triggered when a Bluetooth audio device is ready to be used. This should
    /// only be triggered once for a device and send an event to clients. If the
    ///  device supports both HFP and A2DP, both should be ready when this is
    /// triggered.
    fn on_bluetooth_audio_device_added(
        &self,
        addr: String,
        sample_rate: i32,
        bits_per_sample: i32,
        channel_mode: i32,
        hfp_cap: i32,
    );

    ///
@@ -127,6 +133,7 @@ impl BluetoothMedia {
                                        cap.sample_rate,
                                        cap.bits_per_sample,
                                        cap.channel_mode,
                                        HfpCodecCapability::UNSUPPORTED.bits(),
                                    );
                                });
                                return;
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,14 @@ impl From<u32> for BthfConnectionState {
    }
}

bitflags! {
    pub struct HfpCodecCapability: i32 {
        const UNSUPPORTED = 0b00;
        const CVSD = 0b01;
        const MSBC = 0b10;
    }
}

#[cxx::bridge(namespace = bluetooth::topshim::rust)]
pub mod ffi {
    #[derive(Debug, Copy, Clone)]