Module: AutomateEm::ModuleCore

Includes:
Constants, Status, Utilities
Included in:
Device, Service
Defined in:
lib/automate-em/device/device.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

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



47
48
49
# File 'lib/automate-em/device/device.rb', line 47

def base
  @base
end

#systemsObject (readonly)

Returns the value of attribute systems.



46
47
48
# File 'lib/automate-em/device/device.rb', line 46

def systems
  @systems
end

Instance Method Details

#clear_active_timersObject



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

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

#join_system(system) ⇒ Object



16
17
18
19
20
# File 'lib/automate-em/device/device.rb', line 16

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

#leave_system(system) ⇒ Object



22
23
24
25
26
27
# File 'lib/automate-em/device/device.rb', line 22

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

#loggerObject



39
40
41
42
43
44
# File 'lib/automate-em/device/device.rb', line 39

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
# File 'lib/automate-em/device/device.rb', line 11

def setbase(base)
	@base = base
end