mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add packet to close device.
This commit is contained in:
@@ -50,6 +50,13 @@ namespace DiscImageChef.Devices
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (_remote != null)
|
||||
{
|
||||
_remote.Close();
|
||||
_remote.Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (FileHandle == null) return;
|
||||
|
||||
switch (PlatformId)
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace DiscImageChef.Devices.Remote
|
||||
CommandGetFireWireData = 21,
|
||||
ResponseGetFireWireData = 22,
|
||||
CommandGetPcmciaData = 23,
|
||||
ResponseGetPcmciaData = 24
|
||||
ResponseGetPcmciaData = 24,
|
||||
CommandCloseDevice = 25
|
||||
}
|
||||
|
||||
public enum DicNopReason : byte
|
||||
|
||||
@@ -1202,5 +1202,23 @@ namespace DiscImageChef.Devices.Remote
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
var cmdPkt = new DicPacketCmdClose
|
||||
{
|
||||
hdr = new DicPacketHeader
|
||||
{
|
||||
remote_id = Consts.RemoteId, packet_id = Consts.PacketId,
|
||||
len = (uint) Marshal.SizeOf<DicPacketCmdClose>(),
|
||||
version = Consts.PacketVersion,
|
||||
packetType = DicPacketType.CommandCloseDevice
|
||||
}
|
||||
};
|
||||
|
||||
var buf = Marshal.StructureToByteArrayLittleEndian(cmdPkt);
|
||||
|
||||
_socket.Send(buf, SocketFlags.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,4 +306,10 @@ namespace DiscImageChef.Devices.Remote
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65536)]
|
||||
public byte[] cis;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct DicPacketCmdClose
|
||||
{
|
||||
public DicPacketHeader hdr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user