Renamed namespaces

This commit is contained in:
Benjamin Höglinger-Stelzer 2022-09-26 21:00:43 +02:00
parent f9a76b68da
commit 2424f26755
16 changed files with 117 additions and 81 deletions

View File

@ -1,13 +1,41 @@
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort;
/// <summary>
/// Byte type with enumeration constants for ASCII control codes.
/// </summary>
public enum ASCII : byte
{ {
/// <summary> NULL = 0x00,
/// Byte type with enumeration constants for ASCII control codes. SOH = 0x01,
/// </summary> STH = 0x02,
public enum ASCII : byte ETX = 0x03,
{ EOT = 0x04,
NULL = 0x00, SOH = 0x01, STH = 0x02, ETX = 0x03, EOT = 0x04, ENQ = 0x05, ACK = 0x06, BELL = 0x07, ENQ = 0x05,
BS = 0x08, HT = 0x09, LF = 0x0A, VT = 0x0B, FF = 0x0C, CR = 0x0D, SO = 0x0E, SI = 0x0F, DC1 = 0x11, ACK = 0x06,
DC2 = 0x12, DC3 = 0x13, DC4 = 0x14, NAK = 0x15, SYN = 0x16, ETB = 0x17, CAN = 0x18, EM = 0x19, BELL = 0x07,
SUB = 0x1A, ESC = 0x1B, FS = 0x1C, GS = 0x1D, RS = 0x1E, US = 0x1F, SP = 0x20, DEL = 0x7F BS = 0x08,
} HT = 0x09,
LF = 0x0A,
VT = 0x0B,
FF = 0x0C,
CR = 0x0D,
SO = 0x0E,
SI = 0x0F,
DC1 = 0x11,
DC2 = 0x12,
DC3 = 0x13,
DC4 = 0x14,
NAK = 0x15,
SYN = 0x16,
ETB = 0x17,
CAN = 0x18,
EM = 0x19,
SUB = 0x1A,
ESC = 0x1B,
FS = 0x1C,
GS = 0x1D,
RS = 0x1E,
US = 0x1F,
SP = 0x20,
DEL = 0x7F
} }

View File

@ -1,22 +1,25 @@
using System; using System;
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort;
/// <summary>
/// Exception used for all errors.
/// </summary>
public class CommPortException : ApplicationException
{ {
/// <summary>
/// Exception used for all errors.
/// </summary>
public class CommPortException : ApplicationException
{
/// <summary> /// <summary>
/// Constructor for raising direct exceptions /// Constructor for raising direct exceptions
/// </summary> /// </summary>
/// <param name="desc">Description of error</param> /// <param name="desc">Description of error</param>
public CommPortException(string desc) : base(desc) { } public CommPortException(string desc) : base(desc)
{
}
/// <summary> /// <summary>
/// Constructor for re-raising exceptions from receive thread /// Constructor for re-raising exceptions from receive thread
/// </summary> /// </summary>
/// <param name="e">Inner exception raised on receive thread</param> /// <param name="e">Inner exception raised on receive thread</param>
public CommPortException(Exception e) : base("Receive Thread Exception", e) { } public CommPortException(Exception e) : base("Receive Thread Exception", e)
{
} }
} }

View File

@ -1,25 +1,27 @@
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort;
/// <summary>
/// Standard handshake methods
/// </summary>
public enum Handshake
{ {
/// <summary>
/// Standard handshake methods
/// </summary>
public enum Handshake
{
/// <summary> /// <summary>
/// No handshaking /// No handshaking
/// </summary> /// </summary>
None, None,
/// <summary> /// <summary>
/// Software handshaking using Xon / Xoff /// Software handshaking using Xon / Xoff
/// </summary> /// </summary>
XonXoff, XonXoff,
/// <summary> /// <summary>
/// Hardware handshaking using CTS / RTS /// Hardware handshaking using CTS / RTS
/// </summary> /// </summary>
CtsRts, CtsRts,
/// <summary> /// <summary>
/// Hardware handshaking using DSR / DTR /// Hardware handshaking using DSR / DTR
/// </summary> /// </summary>
DsrDtr DsrDtr
}
} }

View File

@ -1,25 +1,27 @@
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort;
/// <summary>
/// Uses for RTS or DTR pins
/// </summary>
public enum HsOutput
{ {
/// <summary>
/// Uses for RTS or DTR pins
/// </summary>
public enum HsOutput
{
/// <summary> /// <summary>
/// Pin is asserted when this station is able to receive data. /// Pin is asserted when this station is able to receive data.
/// </summary> /// </summary>
Handshake = 2, Handshake = 2,
/// <summary> /// <summary>
/// Pin is asserted when this station is transmitting data (RTS on NT, 2000 or XP only). /// Pin is asserted when this station is transmitting data (RTS on NT, 2000 or XP only).
/// </summary> /// </summary>
Gate = 3, Gate = 3,
/// <summary> /// <summary>
/// Pin is asserted when this station is online (port is open). /// Pin is asserted when this station is online (port is open).
/// </summary> /// </summary>
Online = 1, Online = 1,
/// <summary> /// <summary>
/// Pin is never asserted. /// Pin is never asserted.
/// </summary> /// </summary>
None = 0 None = 0
};
} }

View File

@ -1,6 +1,6 @@
using PInvokeSerialPort.Win32PInvoke; using Nefarius.Peripherals.SerialPort.Win32PInvoke;
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort
{ {
/// <summary> /// <summary>
/// Represents the status of the modem control input signals. /// Represents the status of the modem control input signals.

View File

@ -5,7 +5,7 @@
<Authors>Ebrahim Byagowi, Benjamin Höglinger-Stelzer</Authors> <Authors>Ebrahim Byagowi, Benjamin Höglinger-Stelzer</Authors>
<PackageProjectUrl>https://github.com/nefarius/PInvokeSerialPort</PackageProjectUrl> <PackageProjectUrl>https://github.com/nefarius/PInvokeSerialPort</PackageProjectUrl>
<RepositoryUrl>https://github.com/nefarius/PInvokeSerialPort</RepositoryUrl> <RepositoryUrl>https://github.com/nefarius/PInvokeSerialPort</RepositoryUrl>
<PackageId>Nefarius.PInvokeSerialPort</PackageId> <PackageId>Nefarius.Peripherals.SerialPort</PackageId>
<Description>P/Invoke wrapper for Win32API serial port</Description> <Description>P/Invoke wrapper for Win32API serial port</Description>
<Copyright>Copyright 2012-2017 Ebrahim Byagowi, 2018-2022 Benjamin Höglinger-Stelzer</Copyright> <Copyright>Copyright 2012-2017 Ebrahim Byagowi, 2018-2022 Benjamin Höglinger-Stelzer</Copyright>
<PackageIconUrl>https://raw.githubusercontent.com/Nefarius/PInvokeSerialPort/master/ProjectIcon.png</PackageIconUrl> <PackageIconUrl>https://raw.githubusercontent.com/Nefarius/PInvokeSerialPort/master/ProjectIcon.png</PackageIconUrl>
@ -14,6 +14,7 @@
<OutputPath>$(SolutionDir)bin\</OutputPath> <OutputPath>$(SolutionDir)bin\</OutputPath>
<PackageIcon>NSS-128x128.png</PackageIcon> <PackageIcon>NSS-128x128.png</PackageIcon>
<PackageIconUrl /> <PackageIconUrl />
<LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,4 +1,4 @@
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort
{ {
/// <summary> /// <summary>
/// Parity settings /// Parity settings

View File

@ -1,7 +1,7 @@
using System.Text; using System.Text;
using PInvokeSerialPort.Win32PInvoke; using Nefarius.Peripherals.SerialPort.Win32PInvoke;
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort
{ {
/// <summary> /// <summary>
/// Represents the current condition of the port queues. /// Represents the current condition of the port queues.

View File

@ -2,9 +2,9 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using PInvokeSerialPort.Win32PInvoke; using Nefarius.Peripherals.SerialPort.Win32PInvoke;
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort
{ {
/// <summary> /// <summary>
/// PInvokeSerialPort main class. /// PInvokeSerialPort main class.

View File

@ -1,4 +1,4 @@
namespace PInvokeSerialPort namespace Nefarius.Peripherals.SerialPort
{ {
/// <summary> /// <summary>
/// Stop bit settings /// Stop bit settings

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PInvokeSerialPort.Win32PInvoke namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct COMMPROP internal struct COMMPROP

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PInvokeSerialPort.Win32PInvoke namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct COMMTIMEOUTS internal struct COMMTIMEOUTS

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PInvokeSerialPort.Win32PInvoke namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct COMSTAT internal struct COMSTAT

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PInvokeSerialPort.Win32PInvoke namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct DCB internal struct DCB

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PInvokeSerialPort.Win32PInvoke namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct OVERLAPPED internal struct OVERLAPPED

View File

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace PInvokeSerialPort.Win32PInvoke namespace Nefarius.Peripherals.SerialPort.Win32PInvoke
{ {
internal class Win32Com internal class Win32Com
{ {