Class: AutomateEm::Logic

Inherits:
Object
  • Object
show all
Includes:
Constants, Status, Utilities
Defined in:
lib/automate-em/logic/logic.rb

Overview

Base class for all control logic classes

Constant Summary

Constants included from Constants

Constants::Off, Constants::On

Instance Attribute Summary

Attributes included from Status

#status

Instance Method Summary collapse

Methods included from Utilities

array_to_str, byte_to_hex, hex_to_byte, schedule, str_to_array, task

Methods included from Status

#[], #[]=, #mark_emit_end, #mark_emit_start, #update_status

Constructor Details

#initialize(system) ⇒ Logic

Returns a new instance of Logic.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/automate-em/logic/logic.rb', line 11

def initialize(system)
	@system = system
	
	#
	# Status variables
	#	NOTE:: if changed then change in device.rb 
	#
	@status = {}
	@status_lock = Object.new.extend(MonitorMixin)
	@status_emit = {}	# status => condition_variable
end

Instance Method Details

#clear_active_timersObject



29
30
31
# File 'lib/automate-em/logic/logic.rb', line 29

def clear_active_timers
	@schedule.clear_jobs unless @schedule.nil?
end

#loggerObject



24
25
26
# File 'lib/automate-em/logic/logic.rb', line 24

def logger
	@system.logger
end