Clean-up
This commit is contained in:
parent
91159c3643
commit
4617c69206
@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct DCB
|
||||
{
|
||||
internal Int32 DCBlength;
|
||||
internal Int32 BaudRate;
|
||||
internal Int32 PackedValues;
|
||||
internal Int16 wReserved;
|
||||
internal Int16 XonLim;
|
||||
internal Int16 XoffLim;
|
||||
internal Byte ByteSize;
|
||||
internal Byte Parity;
|
||||
internal Byte StopBits;
|
||||
internal Byte XonChar;
|
||||
internal Byte XoffChar;
|
||||
internal Byte ErrorChar;
|
||||
internal Byte EofChar;
|
||||
internal Byte EvtChar;
|
||||
internal Int16 wReserved1;
|
||||
|
||||
internal void Init(bool parity, bool outCts, bool outDsr, int dtr, bool inDsr, bool txc, bool xOut,
|
||||
bool xIn, int rts)
|
||||
{
|
||||
DCBlength = 28; PackedValues = 0x8001;
|
||||
if (parity) PackedValues |= 0x0002;
|
||||
if (outCts) PackedValues |= 0x0004;
|
||||
if (outDsr) PackedValues |= 0x0008;
|
||||
PackedValues |= ((dtr & 0x0003) << 4);
|
||||
if (inDsr) PackedValues |= 0x0040;
|
||||
if (txc) PackedValues |= 0x0080;
|
||||
if (xOut) PackedValues |= 0x0100;
|
||||
if (xIn) PackedValues |= 0x0200;
|
||||
PackedValues |= ((rts & 0x0003) << 12);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -32,9 +32,6 @@ namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
|
||||
internal const UInt32 GENERIC_READ = 0x80000000;
|
||||
internal const UInt32 GENERIC_WRITE = 0x40000000;
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean CloseHandle(IntPtr hObject);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean GetHandleInformation(IntPtr hObject, out UInt32 lpdwFlags);
|
||||
|
||||
@ -43,18 +40,6 @@ namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
|
||||
/// Manipulating the communications settings.
|
||||
/// </summary>
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean GetCommState(IntPtr hFile, ref DCB lpDCB);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean GetCommTimeouts(IntPtr hFile, out COMMTIMEOUTS lpCommTimeouts);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean BuildCommDCBAndTimeouts(String lpDef, ref DCB lpDCB, ref COMMTIMEOUTS lpCommTimeouts);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean SetCommState(IntPtr hFile, [In] ref DCB lpDCB);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern Boolean SetCommTimeouts(IntPtr hFile, [In] ref COMMTIMEOUTS lpCommTimeouts);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user