void
BluetoothGattService::HandleCharacteristicsDiscovered(
  const BluetoothValue& aValue)
{
  MOZ_ASSERT(aValue.type() ==
             BluetoothValue::TArrayOfBluetoothGattCharAttribute);

  const InfallibleTArray<BluetoothGattCharAttribute>& characteristics =
    aValue.get_ArrayOfBluetoothGattCharAttribute();

  mCharacteristics.Clear();
  for (uint32_t i = 0; i < characteristics.Length(); i++) {
    mCharacteristics.AppendElement(new BluetoothGattCharacteristic(
      GetParentObject(), this, characteristics[i]));
  }

  BluetoothGattServiceBinding::ClearCachedCharacteristicsValue(this);
}