Add flux image interfaces

This commit is contained in:
Rebecca Wallander
2023-02-06 12:02:18 +01:00
parent a8ed059f63
commit 4476f3ac41
3 changed files with 89 additions and 11 deletions

View File

@@ -33,8 +33,8 @@
<NoWarn>CS1591;CS1574</NoWarn>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<InternalsVisibleTo Include="Aaru.Tests"/>
<InternalsVisibleTo Include="Aaru.Tests.Devices"/>
<InternalsVisibleTo Include="Aaru.Tests" />
<InternalsVisibleTo Include="Aaru.Tests.Devices" />
</ItemGroup>
<PropertyGroup>
<NrtRevisionFormat>$(Version)+{chash:8}</NrtRevisionFormat>
@@ -42,12 +42,12 @@
<NrtShowRevision>true</NrtShowRevision>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0"/>
<PackageReference Include="System.ComponentModel.Annotations" Version="6.0.0-preview.4.21253.7"/>
<PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5"/>
<PackageReference Include="System.Text.Json" Version="7.0.1"/>
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="6.0.0-preview.4.21253.7" />
<PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<Content Include="..\LICENSE.MIT">
@@ -55,9 +55,9 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Localization\Aaru.Localization.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj" />
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj" />
<ProjectReference Include="..\Aaru.Localization\Aaru.Localization.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Localization\Localization.resx">

56
Interfaces/IFluxImage.cs Normal file
View File

@@ -0,0 +1,56 @@
using Aaru.CommonTypes.Enums;
namespace Aaru.CommonTypes.Interfaces;
/// <inheritdoc />
/// <summary>Abstract class to implement flux reading plugins.</summary>
public interface IFluxImage : IBaseImage
{
/// <summary>
/// An image may have more than one capture for a specific head/track/sub-track combination. This returns
/// the amount of captures in the image for the specified head/track/sub-track combination.
/// </summary>
/// <returns>The number of captures</returns>
/// <param name="head">Physical head (0-based)</param>
/// <param name="track">Physical track (position of the heads over the floppy media, 0-based)</param>
/// <param name="subTrack">Physical sub-step of track (e.g. half-track)</param>
uint CapturesLength(uint head, ushort track, byte subTrack);
/// <summary>Reads the resolution (sample rate) of a flux capture in picoseconds</summary>
/// <returns>The resolution of a capture in picoseconds</returns>
/// <param name="head">Physical head (0-based)</param>
/// <param name="track">Physical track (position of the heads over the floppy media, 0-based)</param>
/// <param name="subTrack">Physical sub-step of track (e.g. half-track)</param>
/// <param name="captureIndex">Which capture to read. See also <see cref="CapturesLength" /></param>
ulong ReadFluxResolution(uint head, ushort track, byte subTrack, uint captureIndex);
/// <summary>Reads the entire flux capture with index and data streams, as well as its resolution</summary>
/// <returns>Error number</returns>
/// <param name="head">Physical head (0-based)</param>
/// <param name="track">Physical track (position of the heads over the floppy media, 0-based)</param>
/// <param name="subTrack">Physical sub-step of track (e.g. half-track)</param>
/// <param name="captureIndex">Which capture to read. See also <see cref="CapturesLength" /></param>
/// <param name="resolution">The capture's resolution (sample rate) in picoseconds</param>
/// <param name="indexBuffer">Buffer to store the index stream in</param>
/// <param name="dataBuffer">Buffer to store the data stream in</param>
ErrorNumber ReadFluxCapture(uint head, ushort track, byte subTrack, uint captureIndex, out ulong resolution,
out byte[] indexBuffer, out byte[] dataBuffer);
/// <summary>Reads a capture's index stream</summary>
/// <returns>Error number</returns>
/// <param name="head">Physical head (0-based)</param>
/// <param name="track">Physical track (position of the heads over the floppy media, 0-based)</param>
/// <param name="subTrack">Physical sub-step of track (e.g. half-track)</param>
/// <param name="captureIndex">Which capture to read. See also <see cref="CapturesLength" /></param>
/// <param name="buffer">Buffer to store the data in</param>
ErrorNumber ReadFluxIndexCapture(uint head, ushort track, byte subTrack, uint captureIndex, out byte[] buffer);
/// <summary>Reads a capture's data stream</summary>
/// <returns>Error number</returns>
/// <param name="head">Physical head (0-based)</param>
/// <param name="track">Physical track (position of the heads over the floppy media, 0-based)</param>
/// <param name="subTrack">Physical sub-step of track (e.g. half-track)</param>
/// <param name="captureIndex">Which capture to read. See also <see cref="CapturesLength" /></param>
/// <param name="buffer">Buffer to store the data in</param>
ErrorNumber ReadFluxDataCapture(uint head, ushort track, byte subTrack, uint captureIndex, out byte[] buffer);
}

View File

@@ -0,0 +1,22 @@
using Aaru.CommonTypes.Enums;
namespace Aaru.CommonTypes.Interfaces;
/// <inheritdoc cref="IWritableImage" />
/// <summary>Abstract class to implement flux writing plugins.</summary>
public interface IWritableFluxImage : IFluxImage, IWritableImage
{
/// <summary>
/// Writes a flux capture.
/// </summary>
/// <param name="resolution">The capture's resolution (sample rate) in picoseconds</param>
/// <param name="index">Flux representation of the index signal</param>
/// <param name="data">Flux representation of the data signal</param>
/// <param name="head">Physical head (0-based)</param>
/// <param name="track">Physical track (position of the heads over the floppy media, 0-based)</param>
/// <param name="subTrack">Physical sub-step of track (e.g. half-track)</param>
/// <param name="captureIndex">Which capture slot to write to. See also <see cref="IFluxImage.CapturesLength" /></param>
/// <returns>Error number</returns>
ErrorNumber WriteFluxCapture(ulong resolution, byte[] index, byte[] data, uint head, ushort track, byte subTrack,
uint captureIndex);
}