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

Commit 37ad1e9c authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Merge "Fix included service parsing (2/3)" am: 0993afe1 am: 4ee914ab

am: f31a34a7

Change-Id: I3aaa860b270976814f89d8dce328d23f3f34df4c
parents 86d85e3d f31a34a7
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -1048,33 +1048,40 @@ public class GattService extends ProfileService {
            {
                case GattDbElement.TYPE_PRIMARY_SERVICE:
                case GattDbElement.TYPE_SECONDARY_SERVICE:
                    if (DBG) Log.d(TAG, "got service with UUID=" + el.uuid);
                    if (DBG) Log.d(TAG, "got service with UUID=" + el.uuid + " id: " + el.id);

                    currSrvc = new BluetoothGattService(el.uuid, el.id, el.type);
                    db_out.add(currSrvc);
                    break;

                case GattDbElement.TYPE_CHARACTERISTIC:
                    if (DBG) Log.d(TAG, "got characteristic with UUID=" + el.uuid);
                    if (DBG)
                        Log.d(TAG, "got characteristic with UUID=" + el.uuid + " id: " + el.id);

                    currChar = new BluetoothGattCharacteristic(el.uuid, el.id, el.properties, 0);
                    currSrvc.addCharacteristic(currChar);
                    break;

                case GattDbElement.TYPE_DESCRIPTOR:
                    if (DBG) Log.d(TAG, "got descriptor with UUID=" + el.uuid);
                    if (DBG) Log.d(TAG, "got descriptor with UUID=" + el.uuid + " id: " + el.id);

                    currChar.addDescriptor(new BluetoothGattDescriptor(el.uuid, el.id, 0));
                    break;

                case GattDbElement.TYPE_INCLUDED_SERVICE:
                    if (DBG) Log.d(TAG, "got included service with UUID=" + el.uuid);
                    if (DBG)
                        Log.d(TAG,
                                "got included service with UUID=" + el.uuid + " id: " + el.id
                                        + " startHandle: " + el.startHandle);

                    currSrvc.addIncludedService(new BluetoothGattService(el.uuid, el.id, el.type));
                    currSrvc.addIncludedService(
                            new BluetoothGattService(el.uuid, el.startHandle, el.type));
                    break;

                default:
                    Log.e(TAG, "got unknown element with type=" + el.type + " and UUID=" + el.uuid);
                    Log.e(TAG,
                            "got unknown element with type=" + el.type + " and UUID=" + el.uuid
                                    + " id: " + el.id);
            }
        }