Module: Tellstick

Defined in:
lib/tellstick/proxy_io.rb,
lib/tellstick/tellstick.rb,
lib/tellstick/protocol/nexa.rb,
lib/tellstick/code_converter.rb,
lib/tellstick/protocol/proove.rb,
lib/tellstick/protocol/waveman.rb,
lib/tellstick/protocol/plain_text.rb,
lib/tellstick/protocol/rising_sun.rb,
lib/tellstick/protocol/not_connected.rb,
lib/tellstick/protocol/null_protocol.rb,
lib/tellstick/protocol/protocol_loader.rb

Overview

TriggerSwitchD, executes commands to activate/deactive remote switches. © Copyright 2010 Pontus Strömdahl, AdhocSkill.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>.

Defined Under Namespace

Modules: Nexa, NotConnected, NullProtocol, PlainText, Proove, ProtocolLoader, RisingSun, Waveman Classes: CodeConverter, ProxyIO, Tellstick

Class Method Summary collapse

Class Method Details

.create(output, protocol_name = "plain_text") ⇒ Object

takes any kind of IO, but specifically TellstickIO, as output and the name of the transmission protocol. It returns an instance of Tellstick.

The protocol is mixed into Tellstick with the methods:

  • turn_on

  • turn_off

  • teach (if the protocol supports it)



36
37
38
39
40
41
42
43
44
45
# File 'lib/tellstick/tellstick.rb', line 36

def create(output,protocol_name="plain_text")
  protocol = load(protocol_name)
  dongle = Tellstick.new(output)
  if connection_not_needed_for(output) or output.connected?
    dongle.extend protocol
  else
    dongle.extend NotConnected
  end
  dongle
end