Class Contact<TLine>
A two-state input over any line, with its polarity said once: a button, a float switch, a reed switch, a limit switch. IsAsserted() answers whether it is closed, pressed, or tripped, whatever level that takes on the wire.
public sealed class Contact<TLine> where TLine : IInputLine
Type Parameters
TLineThe line the part is wired to.
- Inheritance
-
Contact<TLine>
- Inherited Members
Constructors
Contact(TLine, PinPolarity)
Wraps a line.
public Contact(TLine line, PinPolarity polarity)
Parameters
lineTLineThe line the part is wired to.
polarityPinPolarityHow the part is wired.
Properties
Polarity
How the part is wired.
public PinPolarity Polarity { get; }
Property Value
Methods
IsAsserted()
Reads the line and reports whether the part is asserted.
public bool IsAsserted()
Returns
- bool
Whether it is closed, pressed, or tripped.
Exceptions
- Exception
Whatever the line throws when it cannot be read.
Level()
Reads the raw level on the line.
public PinLevel Level()
Returns
- PinLevel
The level.
Exceptions
- Exception
Whatever the line throws when it cannot be read.
Release()
Hands the line back.
public TLine Release()
Returns
- TLine
The line.