C# Class CyrusBuilt.MonoPi.Components.Relays.RelayBase

Base class for relay abstraction components.
Inheritance: IRelay
ファイルを表示 Open project: cyrusbuilt/MonoPi

Public Methods

Method Description
Close ( ) : void

Closes the dry contacts on the relay.

Dispose ( ) : void

Releases all resource used by the CyrusBuilt.MonoPi.Components.Relays.RelayBase object.

Call Dispose when you are finished using the CyrusBuilt.MonoPi.Components.Relays.RelayBase. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Relays.RelayBase in an unusable state. After calling CyrusBuilt.MonoPi.Components.Relays.RelayBase.Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Relays.RelayBase so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Relays.RelayBase was occupying.

HasProperty ( String key ) : System.Boolean

Determines whether this instance has property the specified key.

IsState ( RelayState state ) : System.Boolean

Determines whether this relay's state matches the specified state.

Open ( ) : void

Opens the dry contacts on the relay.

Pulse ( ) : void

Pulses the relay on and off.

Pulse ( Int32 millis ) : void

Pulses the relay on for the specified number of milliseconds, then back off again.

ToString ( ) : string

Returns a String that represents the current CyrusBuilt.MonoPi.Components.Relays.RelayBase.

Toggle ( ) : void

Toggles the state of the relay (closed, then open).

Protected Methods

Method Description
Dispose ( System.Boolean disposing ) : void

Releaseses all resources used this object.

OnPulseStart ( EventArgs e ) : void

Raises the pulse start event.

OnPulseStop ( EventArgs e ) : void

Raises the pulse stop event.

OnStateChanged ( RelayStateChangedEventArgs e ) : void

Raises the state changed event.

RelayBase ( ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Relays.RelayBase class. This is the default constructor.

RelayBase ( IGpio pin ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Relays.RelayBase class with the pin being used to control the relay.

Method Details

Close() public method

Closes the dry contacts on the relay.
public Close ( ) : void
return void

Dispose() public method

Releases all resource used by the CyrusBuilt.MonoPi.Components.Relays.RelayBase object.
Call Dispose when you are finished using the CyrusBuilt.MonoPi.Components.Relays.RelayBase. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Relays.RelayBase in an unusable state. After calling CyrusBuilt.MonoPi.Components.Relays.RelayBase.Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Relays.RelayBase so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Relays.RelayBase was occupying.
public Dispose ( ) : void
return void

Dispose() protected method

Releaseses all resources used this object.
protected Dispose ( System.Boolean disposing ) : void
disposing System.Boolean /// Set true if disposing managed resources in addition to unmanaged. ///
return void

HasProperty() public method

Determines whether this instance has property the specified key.
public HasProperty ( String key ) : System.Boolean
key String /// The key name of the property to check for. ///
return System.Boolean

IsState() public method

Determines whether this relay's state matches the specified state.
public IsState ( RelayState state ) : System.Boolean
state RelayState /// The state to check for. ///
return System.Boolean

OnPulseStart() protected method

Raises the pulse start event.
protected OnPulseStart ( EventArgs e ) : void
e System.EventArgs /// The event arguments. ///
return void

OnPulseStop() protected method

Raises the pulse stop event.
protected OnPulseStop ( EventArgs e ) : void
e System.EventArgs /// The event arguments. ///
return void

OnStateChanged() protected method

Raises the state changed event.
protected OnStateChanged ( RelayStateChangedEventArgs e ) : void
e RelayStateChangedEventArgs /// The event arguments. ///
return void

Open() public method

Opens the dry contacts on the relay.
public Open ( ) : void
return void

Pulse() public method

Pulses the relay on and off.
public Pulse ( ) : void
return void

Pulse() public method

Pulses the relay on for the specified number of milliseconds, then back off again.
/// Cannot pulse using a pin that is not configured as an output. ///
public Pulse ( Int32 millis ) : void
millis System.Int32 /// The number of milliseconds to wait before switching back off. ///
return void

RelayBase() protected method

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Relays.RelayBase class. This is the default constructor.
protected RelayBase ( ) : System
return System

RelayBase() protected method

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Relays.RelayBase class with the pin being used to control the relay.
/// cannot null. ///
protected RelayBase ( IGpio pin ) : System
pin IGpio /// The output pin being used to control the relay. ///
return System

ToString() public method

Returns a String that represents the current CyrusBuilt.MonoPi.Components.Relays.RelayBase.
public ToString ( ) : string
return string

Toggle() public method

Toggles the state of the relay (closed, then open).
public Toggle ( ) : void
return void