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

Commit dde70384 authored by John Lai's avatar John Lai Committed by Gerrit Code Review
Browse files

Merge changes Ie541a199,I9de66afb into main

* changes:
  floss: Add LE discoverable mode
  floss: Increase btmanagerd version to 0.5.0
parents faef61d0 0d32ddd5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ use crate::ClientContext;
use crate::{console_yellow, print_info};

use bt_topshim::btif::Uuid;
use bt_topshim::profiles::gatt::LePhy;
use bt_topshim::profiles::gatt::{LeDiscMode, LePhy};
use btstack::bluetooth_adv::{AdvertiseData, AdvertiserId, AdvertisingSetParameters};
use btstack::bluetooth_gatt::IBluetoothGatt;

@@ -28,6 +28,7 @@ pub(crate) struct AdvSet {
impl AdvSet {
    pub(crate) fn new(is_legacy: bool) -> Self {
        let params = AdvertisingSetParameters {
            discoverable: LeDiscMode::GeneralDiscoverable,
            connectable: false,
            scannable: false,
            is_legacy,
+3 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ use bt_topshim::profiles::a2dp::{
    A2dpCodecSampleRate, PresentationPosition,
};
use bt_topshim::profiles::avrcp::PlayerMetadata;
use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LePhy};
use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LeDiscMode, LePhy};
use bt_topshim::profiles::hfp::{EscoCodingFormat, HfpCodecBitId, HfpCodecFormat};
use bt_topshim::profiles::hid_host::BthhReportType;
use bt_topshim::profiles::sdp::{
@@ -88,6 +88,7 @@ impl_dbus_arg_enum!(BtTransport);
impl_dbus_arg_enum!(GattStatus);
impl_dbus_arg_enum!(GattWriteRequestStatus);
impl_dbus_arg_enum!(GattWriteType);
impl_dbus_arg_enum!(LeDiscMode);
impl_dbus_arg_enum!(LePhy);
impl_dbus_arg_enum!(ProfileConnectionState);
impl_dbus_arg_enum!(ScanType);
@@ -1267,6 +1268,7 @@ impl IAdvertisingSetCallback for IAdvertisingSetCallbackDBus {

#[dbus_propmap(AdvertisingSetParameters)]
struct AdvertisingSetParametersDBus {
    discoverable: LeDiscMode,
    connectable: bool,
    scannable: bool,
    is_legacy: bool,
+1 −1
Original line number Diff line number Diff line
[package]
name = "manager_service"
version = "0.4.0"
version = "0.5.0"
edition = "2018"
build = "build.rs"

+3 −1
Original line number Diff line number Diff line
use bt_topshim::btif::{BtStatus, BtTransport, Uuid, Uuid128Bit};
use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LePhy};
use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LeDiscMode, LePhy};

use btstack::bluetooth_adv::{
    AdvertiseData, AdvertisingSetParameters, IAdvertisingSetCallback, ManfId,
@@ -381,6 +381,7 @@ impl_dbus_arg_enum!(AdvertisingStatus);
impl_dbus_arg_enum!(GattStatus);
impl_dbus_arg_enum!(GattWriteRequestStatus);
impl_dbus_arg_enum!(GattWriteType);
impl_dbus_arg_enum!(LeDiscMode);
impl_dbus_arg_enum!(LePhy);
impl_dbus_arg_enum!(ScanType);
impl_dbus_arg_enum!(SuspendMode);
@@ -570,6 +571,7 @@ impl IAdvertisingSetCallback for AdvertisingSetCallbackDBus {

#[dbus_propmap(AdvertisingSetParameters)]
struct AdvertisingSetParametersDBus {
    discoverable: LeDiscMode,
    connectable: bool,
    scannable: bool,
    is_legacy: bool,
+10 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
use btif_macros::{btif_callback, btif_callbacks_dispatcher};

use bt_topshim::btif::{RawAddress, Uuid};
use bt_topshim::profiles::gatt::{AdvertisingStatus, Gatt, GattAdvCallbacks, LePhy};
use bt_topshim::profiles::gatt::{AdvertisingStatus, Gatt, GattAdvCallbacks, LeDiscMode, LePhy};

use itertools::Itertools;
use log::{debug, error, info, warn};
@@ -28,6 +28,8 @@ pub type ManfId = u16;
/// Advertising parameters for each BLE advertising set.
#[derive(Debug, Default, Clone)]
pub struct AdvertisingSetParameters {
    /// Discoverable modes.
    pub discoverable: LeDiscMode,
    /// Whether the advertisement will be connectable.
    pub connectable: bool,
    /// Whether the advertisement will be scannable.
@@ -228,6 +230,13 @@ impl Into<bt_topshim::profiles::gatt::AdvertiseParameters> for AdvertisingSetPar
            props |= 0x40;
        }

        match self.discoverable {
            LeDiscMode::GeneralDiscoverable => {
                props |= 0x04;
            }
            _ => {}
        }

        let interval = clamp(self.interval, INTERVAL_MIN, INTERVAL_MAX - INTERVAL_DELTA);

        bt_topshim::profiles::gatt::AdvertiseParameters {
Loading