C# 클래스 CyrusBuilt.MonoPi.Devices.RCSwitch.RCSwitchDevice

A device abstraction for an RC (remote control) switched power outlets.
상속: DeviceBase, IRCSwitch
파일 보기 프로젝트 열기: cyrusbuilt/MonoPi

공개 메소드들

메소드 설명
Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

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

GetSwitchGroupAddress ( String address ) : BitSet

Convenience method for converting a string like "11011" to a CyrusBuilt.MonoPi.BitSet.

RCSwitchDevice ( IRaspiGpio transmitPin ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.Devices.RCSwitch.RCSwitchDevice class with the pin to use to transmit codes with.

Send ( char codeWord ) : void

Transmits the specified code word to the device.

Send ( long code, Int32 length ) : void

Transmits the specified code word to the device.

SendTriState ( char codeWord ) : void

Sends a code word.

SwitchOff ( AddressCode address, ChannelCode channel ) : void

Switch a remote switch off (Type B with two rotary/sliding switches).

SwitchOff ( BitSet switchGroupAddress, RCSwitchDevNum device ) : void

Switch a remote switch off (Type A with 10 pole DIP switches).

SwitchOn ( AddressCode address, ChannelCode channel ) : void

Switch a remote switch on (Type B with two rotary/sliding switches).

SwitchOn ( BitSet switchGroupAddress, RCSwitchDevNum device ) : void

Switch a remote switch on (Type A with 10 pole DIP switches).

비공개 메소드들

메소드 설명
Dec2BinWzeroFill ( long dec, Int32 bitLength ) : char[]

Converts a decimal value into its binary representation.

GetCodeWordA ( BitSet groupAddress, ChannelCode chan, System.Boolean status ) : String

Returns a 13 character array, representing the code word to be sent. A code word consists of 9 address bits, 3 data bits, and on sync bit but in our case, only the first 8 address bits and the last 2 data bits are used. A code bit can have 4 different states: "F" (floating), "1" (high), "0" (low), and "S" (synchronous bit).

+-------------------------------+--------------------------------+-----------------------------------------+-----------------------------------------+----------------------+------------+ | 4 bits address (switch group) | 4 bits address (switch number) | 1 bit address (not used, so never mind) | 1 bit address (not used, so never mind) | 2 data bits (on|off) | 1 sync bit | | 1=0FFF 2=F0FF 3=FF0F 4=FFF0 | 1=0FFF 2=F0FF 3=FF0F 4=FFF0 | F | F | on=FF off=F0 | S | +-------------------------------+--------------------------------+-----------------------------------------+-----------------------------------------+----------------------+------------+

GetCodeWordB ( AddressCode address, ChannelCode chan, System.Boolean status ) : String

Returns a 13 character array, representing the code word to be sent. A code word consists of 9 address bits, 3 data bits, and on sync bit but in our case, only the first 8 address bits and the last 2 data bits are used. A code bit can have 4 different states: "F" (floating), "1" (high), "0" (low), and "S" (synchronous bit).

+-------------------------------+--------------------------------+-----------------------------------------+-----------------------------------------+----------------------+------------+ | 4 bits address (switch group) | 4 bits address (switch number) | 1 bit address (not used, so never mind) | 1 bit address (not used, so never mind) | 2 data bits (on|off) | 1 sync bit | | 1=0FFF 2=F0FF 3=FF0F 4=FFF0 | 1=0FFF 2=F0FF 3=FF0F 4=FFF0 | F | F | on=FF off=F0 | S | +-------------------------------+--------------------------------+-----------------------------------------+-----------------------------------------+----------------------+------------+

Send0 ( ) : void

Sends a "0" bit.

_
Waveform Protocol 1: | |___

_
Waveform Protocol 2: | |__

Send1 ( ) : void

Sends a "1" bit.

___
Waveform Protocol 1: | |_

__
Waveform Protocol 2: | |_

SendSync ( ) : void

Sends a "Sync" bit.

_
Waveform Protocol 1: | |_______________________________
_
Waveform Protocol 2: | |__________

SendT0 ( ) : void

Sends a tri-state "0" bit.

_ _
Waveform: | |___| |___

SendT1 ( ) : void

Sends a tri-state "1" bit.

___ ___
Waveform: | |_| |_

SendTF ( ) : void

Sends a tri-state "F" bit.

_ ___
Waveform: | |___| |_

Transmit ( Int32 highPulses, Int32 lowPulses ) : void

Trasmits the specified number of high and low pulses

메소드 상세

Dispose() 공개 메소드

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Call Dispose when you are finished using the CyrusBuilt.MonoPi.Devices.RCSwitch.RCSwitchDevice. The Dispose method leaves the CyrusBuilt.MonoPi.Devices.RCSwitch.RCSwitchDevice in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.Devices.RCSwitch.RCSwitchDevice so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Devices.RCSwitch.RCSwitchDevice was occupying.
public Dispose ( ) : void
리턴 void

GetSwitchGroupAddress() 공개 정적인 메소드

Convenience method for converting a string like "11011" to a CyrusBuilt.MonoPi.BitSet.
/// cannot be a null or empty string. /// /// must contain exactly 5 bits. ///
public static GetSwitchGroupAddress ( String address ) : BitSet
address String /// The a string containing the address bits in sequence. ///
리턴 BitSet

RCSwitchDevice() 공개 메소드

Initializes a new instance of the CyrusBuilt.MonoPi.Devices.RCSwitch.RCSwitchDevice class with the pin to use to transmit codes with.
/// cannot be null. /// /// is not an output pin. ///
public RCSwitchDevice ( IRaspiGpio transmitPin ) : System
transmitPin IRaspiGpio /// The native pin to use to transmit codes. ///
리턴 System

Send() 공개 메소드

Transmits the specified code word to the device.
public Send ( char codeWord ) : void
codeWord char /// The code word to transmit. ///
리턴 void

Send() 공개 메소드

Transmits the specified code word to the device.
public Send ( long code, Int32 length ) : void
code long /// A long represents the bits of the address. ///
length System.Int32 /// The length of bits (count) to send. ///
리턴 void

SendTriState() 공개 메소드

Sends a code word.
public SendTriState ( char codeWord ) : void
codeWord char /// The code word to send. ///
리턴 void

SwitchOff() 공개 메소드

Switch a remote switch off (Type B with two rotary/sliding switches).
public SwitchOff ( AddressCode address, ChannelCode channel ) : void
address AddressCode /// The address of the switch group. ///
channel ChannelCode /// The channel (switch) itself. ///
리턴 void

SwitchOff() 공개 메소드

Switch a remote switch off (Type A with 10 pole DIP switches).
/// cannot be null. /// /// cannot have more than 5 bits. ///
public SwitchOff ( BitSet switchGroupAddress, RCSwitchDevNum device ) : void
switchGroupAddress BitSet /// Code of the switch group (refers to DIP switches 1 - 5, where /// "1" = on and "0" = off, if all DIP switches are on it's "11111"). ///
device RCSwitchDevNum /// The switch device number. ///
리턴 void

SwitchOn() 공개 메소드

Switch a remote switch on (Type B with two rotary/sliding switches).
public SwitchOn ( AddressCode address, ChannelCode channel ) : void
address AddressCode /// The address of the switch group. ///
channel ChannelCode /// The channel (switch) itself. ///
리턴 void

SwitchOn() 공개 메소드

Switch a remote switch on (Type A with 10 pole DIP switches).
/// cannot be null. /// /// cannot have more than 5 bits. ///
public SwitchOn ( BitSet switchGroupAddress, RCSwitchDevNum device ) : void
switchGroupAddress BitSet /// Code of the switch group (refers to DIP switches 1 - 5, where /// "1" = on and "0" = off, if all DIP switches are on it's "11111"). ///
device RCSwitchDevNum /// The switch device number. ///
리턴 void