Class: Smartware::Interface::UserInterface
- Inherits:
-
Interface
- Object
- Interface
- Smartware::Interface::UserInterface
show all
- Defined in:
- lib/smartware/interfaces/user_interface.rb
Instance Attribute Summary
Attributes inherited from Interface
#config
Instance Method Summary
collapse
Methods inherited from Interface
#error, #model, #repush_events, #shutdown, #status, #version
Constructor Details
#initialize(config, service) ⇒ UserInterface
Returns a new instance of UserInterface.
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/smartware/interfaces/user_interface.rb', line 5
def initialize(config, service)
super
update_status :error, nil
update_status :model, ''
update_status :version, ''
update_status :screenshot_pending, false
@screenshot_data = nil
end
|
Instance Method Details
#delete_calibration ⇒ Object
16
17
18
19
|
# File 'lib/smartware/interfaces/user_interface.rb', line 16
def delete_calibration
Logging.logger.info "Deleting calibration data"
@device.delete_calibration
end
|
#request_screenshot ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/smartware/interfaces/user_interface.rb', line 26
def request_screenshot
Logging.logger.info "Requested screenshot"
EventMachine.defer @device.method(:screenshot), ->(data) do
@screenshot_data = data
update_status :screenshot_pending, true
end
nil
end
|
#restart_ui ⇒ Object
21
22
23
24
|
# File 'lib/smartware/interfaces/user_interface.rb', line 21
def restart_ui
Logging.logger.info "Restarting user interface"
@device.restart_ui
end
|
#retrieve_screenshot ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/smartware/interfaces/user_interface.rb', line 37
def retrieve_screenshot
data = @screenshot_data
@screenshot_data = nil
update_status :screenshot_pending, false
data
end
|