Module: Subduino

Defined in:
lib/subduino.rb,
lib/subduino/parse.rb,
lib/subduino/store.rb,
lib/subduino/ard_io.rb,
lib/subduino/ard_ps.rb,
lib/subduino/serial.rb,
lib/subduino/version.rb,
lib/subduino/parse/lux.rb,
lib/subduino/parse/bool.rb,
lib/subduino/parse/flow.rb,
lib/subduino/parse/temp.rb,
lib/subduino/parse/energy.rb,
lib/subduino/parse/presence.rb,
lib/subduino/parse/pressure.rb,
lib/subduino/scaffold/generator.rb

Overview

Subduino Persistent Store

Uses redis to store.
Maybe Tokyo/PG support in the future...

Defined Under Namespace

Modules: Parse Classes: ArdIO, ArdPS, Generator, Serial, Store

Constant Summary collapse

Opts =
{ :log_interval => 30 }
Log =
Logger.new(const_defined?("DEBUG") ? STDOUT : "subduino-debug.log")
VERSION =
'0.5.0'

Class Method Summary collapse

Class Method Details

.start(&proc) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/subduino.rb', line 40

def self.start(&proc)
  trap(:TERM) { stop! }
  trap(:INT)  { stop! }
  # Start some threads...
  Log.info "[IO] Boot!"
  ArdIO.read &proc
  Log.info "[PubSub] Boot!"
  ArdPS.read

  # Be a daemon. Should be a better way..
  # EM.run do; end
end

.stop!Object



53
54
55
56
57
58
59
# File 'lib/subduino.rb', line 53

def self.stop!
  Log.info "[IO] Shutting I/O down..."
  ArdIO.stop!
  Log.info "[PubSub] Shutting PubSub down..."
  ArdPS.stop!
  exit 0
end