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

Commit f5d79dd6 authored by Pulkit Bhuwalka's avatar Pulkit Bhuwalka
Browse files

Get Bluetooth Class of Device

Modifies the native Bluetooth stack to
 1) return default value from BTA_DM_COD configuration when not set, and
 2) return adapter COD value even before stack start for Java Android
 stack.

Bug: 36015415
Test: Verified fetching of COD both before and after modification of
CoD value and restart of machine.

Change-Id: Ibcf726dcd7bea5d7e27c7a775f8cf7ea3f9e4107
parent a5f8c958
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ interface IBluetooth
    ParcelUuid[] getUuids();
    boolean setName(in String name);
    String getName();
    BluetoothClass getBluetoothClass();
    boolean setBluetoothClass(in BluetoothClass bluetoothClass);

    int getScanMode();
+1 −1
Original line number Diff line number Diff line
@@ -901,7 +901,7 @@ bt_status_t btif_get_adapter_property(bt_property_type_t type) {

  /* Allow get_adapter_property only for BDADDR and BDNAME if BT is disabled */
  if (!btif_is_enabled() && (type != BT_PROPERTY_BDADDR) &&
      (type != BT_PROPERTY_BDNAME))
      (type != BT_PROPERTY_BDNAME) && (type != BT_PROPERTY_CLASS_OF_DEVICE))
    return BT_STATUS_NOT_READY;

  req.read_req.bd_addr = RawAddress::kEmpty;
+6 −0
Original line number Diff line number Diff line
@@ -2418,6 +2418,12 @@ bt_status_t btif_dm_get_adapter_property(bt_property_t* prop) {
      prop->len = sizeof(uint32_t);
    } break;

    case BT_PROPERTY_CLASS_OF_DEVICE: {
      DEV_CLASS dev_class = BTA_DM_COD;
      memcpy(prop->val, dev_class, sizeof(DEV_CLASS));
      prop->len = sizeof(DEV_CLASS);
    } break;

    default:
      prop->len = 0;
      return BT_STATUS_FAIL;