Class: Oschii::DeviceMonitor
- Inherits:
-
Object
- Object
- Oschii::DeviceMonitor
- Defined in:
- lib/oschii/device_monitor.rb
Constant Summary collapse
- BAR =
"--------------------------------------------------"
Instance Attribute Summary collapse
-
#oschii ⇒ Object
readonly
Returns the value of attribute oschii.
Instance Method Summary collapse
-
#initialize(oschii) ⇒ DeviceMonitor
constructor
A new instance of DeviceMonitor.
- #start ⇒ Object
Constructor Details
#initialize(oschii) ⇒ DeviceMonitor
Returns a new instance of DeviceMonitor.
3 4 5 |
# File 'lib/oschii/device_monitor.rb', line 3 def initialize(oschii) @oschii = oschii end |
Instance Attribute Details
#oschii ⇒ Object (readonly)
Returns the value of attribute oschii.
7 8 9 |
# File 'lib/oschii/device_monitor.rb', line 7 def oschii @oschii end |
Instance Method Details
#start ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/oschii/device_monitor.rb', line 11 def start oschii.refresh puts puts " Device: #{oschii.name}" puts " #{oschii.description}" if oschii.description puts " #{oschii.class.name}" puts " IP: #{oschii.ip}" puts "Version: #{oschii.version}" puts " Config: #{oschii.config_name} [#{oschii.config_valid? ? ' OK ' : ' INVALID '}]" puts " #{oschii.config_description}" if oschii.config_description puts if oschii.failsafe_mode? puts " ! IN FAILSAFE MODE !" puts end running = true Thread.new do while running print "\r" print " cycle #{oschii.cycle_time_micros}µs " print "- used mem #{oschii.mem_used_percent.to_s.rjust(2)}% " print "- used files:#{oschii.files_used_percent.to_s.rjust(2)}% " print "- uptime #{oschii.uptime} " oschii.refresh sleep 1 end end gets puts running = false nil end |