Module: AutomateEm::ModuleCore

Includes:
Constants, Status, Utilities
Included in:
Device, Service
Defined in:
lib/automate-em/module_core.rb

Constant Summary

Constants included from Constants

Constants::Off, Constants::On

Instance Attribute Summary collapse

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

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



50
51
52
# File 'lib/automate-em/module_core.rb', line 50

def base
  @base
end

#systemsObject (readonly)

Returns the value of attribute systems.



49
50
51
# File 'lib/automate-em/module_core.rb', line 49

def systems
  @systems
end

Instance Method Details

#clear_active_timersObject



32
33
34
# File 'lib/automate-em/module_core.rb', line 32

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

#join_system(system) ⇒ Object



19
20
21
22
23
# File 'lib/automate-em/module_core.rb', line 19

def join_system(system)
	@system_lock.synchronize {
		@systems << system
	}
end

#leave_system(system) ⇒ Object



25
26
27
28
29
30
# File 'lib/automate-em/module_core.rb', line 25

def leave_system(system)
	@system_lock.synchronize {
		@systems.delete(system)
		return @systems.length
	}
end

#loggerObject



42
43
44
45
46
47
# File 'lib/automate-em/module_core.rb', line 42

def logger
	@system_lock.synchronize {
		return @systems[0].logger unless @systems.empty?
	}
	System.logger
end

#setbase(base) ⇒ Object

Sets up a link for the user code to the eventmachine class This way the namespace is clean.



11
12
13
14
15
16
# File 'lib/automate-em/module_core.rb', line 11

def setbase(base)
	@base = base
	class << self
		undef setbase
	end
end