Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,12 @@ public BluetoothGattProxy.IBluetoothGattServiceDelegate GetService(BluetoothGatt
}
}

// A peripheral can list the same service UUID more than once: the instance id is what tells those services apart.
private static bool AreRepresentingTheSameObject(BluetoothGattService native, IBluetoothRemoteService service)
{
return native.Uuid?.ToGuid().Equals(service.Id) ?? false;
return service is AndroidBluetoothRemoteService androidService
&& native.InstanceId == androidService.NativeService.InstanceId
&& (native.Uuid?.ToGuid().Equals(service.Id) ?? false);
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ public BluetoothGattProxy.IBluetoothGattCharacteristicDelegate GetCharacteristic
}
}

// A service can list the same characteristic UUID more than once: the instance id is what tells those characteristics apart.
private static bool AreRepresentingTheSameObject(BluetoothGattCharacteristic native, IBluetoothRemoteCharacteristic shared)
{
return shared is AndroidBluetoothRemoteCharacteristic androidCharacteristic && native.Uuid?.Equals(androidCharacteristic.NativeCharacteristic.Uuid) == true;
return shared is AndroidBluetoothRemoteCharacteristic androidCharacteristic
&& native.InstanceId == androidCharacteristic.NativeCharacteristic.InstanceId
&& native.Uuid?.Equals(androidCharacteristic.NativeCharacteristic.Uuid) == true;
}

#endregion
Expand Down
Loading