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

Commit e34b9156 authored by Wei Wang's avatar Wei Wang
Browse files

Change service data and manufacturer data to be repeated.

Change-Id: Ie45ca40d3d84d192d65003ea3ac9ad428b281f94
parent f254208a
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -332,14 +332,15 @@ class AdvertiseManager {

        // Combine manufacturer id and manufacturer data.
        private byte[] getManufacturerData(AdvertiseData advertiseData) {
            if (advertiseData.getManufacturerId() < 0) {
            if (advertiseData.getManufacturerSpecificData().size() == 0) {
                return new byte[0];
            }
            byte[] manufacturerData = advertiseData.getManufacturerSpecificData();
            int manufacturerId = advertiseData.getManufacturerSpecificData().keyAt(0);
            byte[] manufacturerData = advertiseData.getManufacturerSpecificData().get(
                    manufacturerId);
            int dataLen = 2 + (manufacturerData == null ? 0 : manufacturerData.length);
            byte[] concated = new byte[dataLen];
            // / First two bytes are manufacturer id in little-endian.
            int manufacturerId = advertiseData.getManufacturerId();
            concated[0] = (byte) (manufacturerId & 0xFF);
            concated[1] = (byte) ((manufacturerId >> 8) & 0xFF);
            if (manufacturerData != null) {
@@ -350,16 +351,16 @@ class AdvertiseManager {

        // Combine service UUID and service data.
        private byte[] getServiceData(AdvertiseData advertiseData) {
            if (advertiseData.getServiceDataUuid() == null) {
            if (advertiseData.getServiceData().isEmpty()) {
                return new byte[0];
            }

            byte[] serviceData = advertiseData.getServiceData();
            ParcelUuid uuid = advertiseData.getServiceData().keySet().iterator().next();
            byte[] serviceData = advertiseData.getServiceData().get(uuid);
            int dataLen = 2 + (serviceData == null ? 0 : serviceData.length);
            byte[] concated = new byte[dataLen];
            // Extract 16 bit UUID value.
            int uuidValue = BluetoothUuid.getServiceIdentifierFromParcelUuid(
                    advertiseData.getServiceDataUuid());
                    uuid);
            // First two bytes are service data UUID in little-endian.
            concated[0] = (byte) (uuidValue & 0xFF);
            concated[1] = (byte) ((uuidValue >> 8) & 0xFF);
+0 −2
Original line number Diff line number Diff line
@@ -388,8 +388,6 @@ public class ScanManager {
            int scanWindowUnit = 8;
            int discardRule = 2;
            int addressType = 0;
            gattClientStartBatchScanNative(client.clientIf, scanMode, scanIntervalUnit,
                    scanWindowUnit, addressType, discardRule);
            logd("Starting BLE batch scan, scanMode -" + scanMode);
            gattClientStartBatchScanNative(client.clientIf, scanMode, scanIntervalUnit,
                    scanWindowUnit, addressType, discardRule);