Update flux interfaces

This commit is contained in:
Rebecca Wallander
2023-04-13 21:04:49 +02:00
parent 4476f3ac41
commit 62233ca4f6
2 changed files with 141 additions and 21 deletions

View File

@@ -1,3 +1,41 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : IFluxImage.cs
// Author(s) : Rebecca Wallander <sakcheen+github@gmail.com>
//
// Component : Flux image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines the interface to be implemented by flux image plugins.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Rebecca Wallander
// ****************************************************************************/
using Aaru.CommonTypes.Enums;
namespace Aaru.CommonTypes.Interfaces;
@@ -10,33 +48,57 @@ public interface IFluxImage : IBaseImage
/// 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>
/// <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>
uint CapturesLength(uint head, ushort track, byte subTrack);
/// <param name="length">The number of captures</param>
ErrorNumber CapturesLength(uint head, ushort track, byte subTrack, out uint length);
/// <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>
/// <summary>Reads the resolution (sample rate) of a index signal capture in picoseconds.</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="resolution">The resolution of the index capture in picoseconds</param>
ErrorNumber ReadFluxIndexResolution(uint head, ushort track, byte subTrack, uint captureIndex,
out ulong resolution);
/// <summary>Reads the resolution (sample rate) of a data signal capture in picoseconds.</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 resolution of the data capture in picoseconds</param>
ErrorNumber ReadFluxDataResolution(uint head, ushort track, byte subTrack, uint captureIndex, out ulong resolution);
/// <summary>Reads the resolution (sample rate) of a flux capture in picoseconds.</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="indexResolution">The resolution of the index capture in picoseconds</param>
/// <param name="dataResolution">The resolution of the data capture in picoseconds</param>
ErrorNumber ReadFluxResolution(uint head, ushort track, byte subTrack, uint captureIndex, out ulong indexResolution,
out ulong dataResolution);
/// <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="indexResolution">The resolution (sample rate) of the index capture in picoseconds</param>
/// <param name="dataResolution">The resolution (sample rate) of the data capture 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);
ErrorNumber ReadFluxCapture(uint head, ushort track, byte subTrack, uint captureIndex, out ulong indexResolution,
out ulong dataResolution, out byte[] indexBuffer, out byte[] dataBuffer);
/// <summary>Reads a capture's index stream</summary>
/// <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>
@@ -45,7 +107,7 @@ public interface IFluxImage : IBaseImage
/// <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>
/// <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>

View File

@@ -1,3 +1,41 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : IWritableFluxImage.cs
// Author(s) : Rebecca Wallander <sakcheen+github@gmail.com>
//
// Component : Writable flux image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines the interface to be implemented by writable flux image plugins.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Rebecca Wallander
// ****************************************************************************/
using Aaru.CommonTypes.Enums;
namespace Aaru.CommonTypes.Interfaces;
@@ -6,9 +44,8 @@ namespace Aaru.CommonTypes.Interfaces;
/// <summary>Abstract class to implement flux writing plugins.</summary>
public interface IWritableFluxImage : IFluxImage, IWritableImage
{
/// <summary>
/// Writes a flux capture.
/// </summary>
/// <summary>Writes a flux capture.</summary>
/// <returns>Error number</returns>
/// <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>
@@ -16,7 +53,28 @@ public interface IWritableFluxImage : IFluxImage, IWritableImage
/// <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>
ErrorNumber WriteFluxCapture(ulong indexResolution, ulong dataResolution, byte[] indexBuffer, byte[] dataBuffer,
uint head, ushort track, byte subTrack, uint captureIndex);
/// <summary>Writes a capture's index stream.</summary>
/// <returns>Error number</returns>
ErrorNumber WriteFluxCapture(ulong resolution, byte[] index, byte[] data, uint head, ushort track, byte subTrack,
uint captureIndex);
/// <param name="resolution">The capture's resolution (sample rate) in picoseconds</param>
/// <param name="index">Flux representation of the index 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 to read. See also <see cref="CapturesLength" /></param>
ErrorNumber WriteFluxIndexCapture(ulong resolution, byte[] index, uint head, ushort track, byte subTrack,
uint captureIndex);
/// <summary>Writes a capture's data stream.</summary>
/// <returns>Error number</returns>
/// <param name="resolution">The capture's resolution (sample rate) in picoseconds</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 to read. See also <see cref="CapturesLength" /></param>
ErrorNumber WriteFluxDataCapture(ulong resolution, byte[] data, uint head, ushort track, byte subTrack,
uint captureIndex);
}