You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.9 KiB
74 lines
1.9 KiB
using System.ComponentModel;
|
|
|
|
using Library = RJCP.IO.Ports;
|
|
|
|
namespace MultiTerm.Protocols.Serial;
|
|
|
|
public enum Handshake
|
|
{
|
|
//
|
|
// Summary:
|
|
// No handshaking.
|
|
[Description("None")]
|
|
None = 0x0,
|
|
//
|
|
// Summary:
|
|
// Software handshaking.
|
|
[Description("XON")]
|
|
XOn = 0x1,
|
|
//
|
|
// Summary:
|
|
// Hardware handshaking (RTS/CTS).
|
|
[Description("RTS")]
|
|
Rts = 0x2,
|
|
//
|
|
// Summary:
|
|
// Hardware handshaking (DTR/DSR) (uncommon).
|
|
[Description("DTR")]
|
|
Dtr = 0x4,
|
|
//
|
|
// Summary:
|
|
// RTS and Software handshaking.
|
|
[Description("RTS XON")]
|
|
RtsXOn = 0x3,
|
|
//
|
|
// Summary:
|
|
// DTR and Software handshaking (uncommon).
|
|
[Description("DTR XON")]
|
|
DtrXOn = 0x5,
|
|
//
|
|
// Summary:
|
|
// Hardware handshaking with RTS/CTS and DTR/DSR (uncommon).
|
|
[Description("DTR RTS")]
|
|
DtrRts = 0x6,
|
|
//
|
|
// Summary:
|
|
// Hardware handshaking with RTS/CTS and DTR/DSR and Software handshaking (uncommon).
|
|
[Description("DTR RTS XON")]
|
|
DtrRtsXOn = 0x7
|
|
}
|
|
|
|
internal class HandshakeLibraryEquivalentConverter : ILibraryEquivalentConverter<Handshake, Library.Handshake>
|
|
{
|
|
public Library.Handshake ConvertToLibraryType(Handshake obj)
|
|
{
|
|
return obj switch
|
|
{
|
|
Handshake.None => Library.Handshake.None,
|
|
Handshake.XOn => Library.Handshake.XOn,
|
|
Handshake.Rts => Library.Handshake.Rts,
|
|
Handshake.Dtr => Library.Handshake.Dtr,
|
|
Handshake.RtsXOn => Library.Handshake.RtsXOn,
|
|
Handshake.DtrXOn => Library.Handshake.DtrXOn,
|
|
Handshake.DtrRts => Library.Handshake.DtrRts,
|
|
Handshake.DtrRtsXOn => Library.Handshake.DtrRtsXOn,
|
|
_ => throw new NotImplementedException(),
|
|
};
|
|
}
|
|
|
|
public Handshake ConvertToLocalType(Library.Handshake obj)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
|