Class: Aq::Controllers::Aquatronica

Inherits:
Aq::Controller show all
Defined in:
lib/aq/controllers/aquatronica.rb

Constant Summary collapse

TIMER_BITMASK =
0x80
STATUS_BITMASK =
0x7F
MANUAL =
120

Instance Attribute Summary

Attributes inherited from Aq::Controller

#status, #status_fetch_time, #url

Instance Method Summary collapse

Methods inherited from Aq::Controller

#fetch_status, #initialize, #number_or_string

Constructor Details

This class inherits a constructor from Aq::Controller

Instance Method Details

#manual?(outlet) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/aq/controllers/aquatronica.rb', line 24

def manual? outlet
  outlet.to_i & STATUS_BITMASK == MANUAL
end

#on?(outlet) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/aq/controllers/aquatronica.rb', line 20

def on? outlet
  outlet.to_i & TIMER_BITMASK != 0
end

#parse_status(raw_status) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/aq/controllers/aquatronica.rb', line 12

def parse_status(raw_status)
  parsed_status = Nokogiri::XML raw_status
  aq_status = {:general => read_general(parsed_status), :probes => read_probes(parsed_status), 
               :outlets => read_outlets(parsed_status), :power => {}}
    
  return aq_status
end

#status_pageObject



8
9
10
# File 'lib/aq/controllers/aquatronica.rb', line 8

def status_page
  'rtMon.xml'
end