Class: Spectrum

Inherits:
Stb show all
Defined in:
lib/platform/stb/spectrum/spectrum.rb

Overview

Adds to or modifies the Stb platform with Spectrum-specific functionality.

Direct Known Subclasses

Spectrum1080, Spectrum720

Instance Attribute Summary

Attributes inherited from Platform

#id, #keys, #remotes, #roi, #screens

Instance Method Summary collapse

Methods inherited from Stb

#in_standby?, #password, #username

Methods included from RoiHelper

#roi_resolution

Methods inherited from Platform

#alt_parental_controls_pin, #app_version, #audio_level, #audio_level_left, #audio_level_right, #audio_present?, #capture_audio, #capture_frames, #capture_screen, #device_type_is?, #device_type_not?, #entitlements, #has_power?, #height, #high_def?, #ip_address, #is_generic?, #lock, #mac_address, #model, #name, #parental_controls_pin, #password, #platform, #power_cycle, #power_off, #power_on, #press_key, #record_audio, #record_video, #remote_type=, #remote_type_is?, #reset_video, #resolution, #save_last_screen_captured, #slot, #snmp_get, #snmp_set, #software_version, #stop_audio, #stop_video, #upload_screenshot, #username, #width

Constructor Details

#initialize(*args) ⇒ Spectrum

Public: Initializes a Spectrum device.



12
13
14
15
16
17
18
# File 'lib/platform/stb/spectrum/spectrum.rb', line 12

def initialize(*args)
  super(*args)
  @screens = SpectrumScreens.new(self)
  @roi = SpectrumRois.new(self)
  @remotes = SpectrumRemotes.new
  set_keys(SpectrumKeys.new)
end

Instance Method Details

#init?Boolean

Public: Initializes the Spectrum STB and brings it to the Live TV screen.

Returns a Boolean true if the device was initialized, otherwise false.

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
# File 'lib/platform/stb/spectrum/spectrum.rb', line 23

def init?
  if super
    self.press_key.EXIT(:sleep_time => 3.sec)  # exit the banner which prevents us from doing some operations
    true
  else
    false
  end
end

#power_on?Boolean

Public: Ensures Spectrum device has power.

Returns a Boolean true if the device powered on successfully, otherwise false.

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/platform/stb/spectrum/spectrum.rb', line 35

def power_on?
  logger.info('Ensuring Spectrum device has soft power')
  # Navigate to the guide to ensure a non-black screen
  self.press_key.EXIT(:sleep_time => 1.sec)
  self.press_key.EXIT(:sleep_time => 1.sec)    
  self.press_key.GUIDE  
  if self.in_standby?
    # The device is in standby
    self.press_key.POWER
    return !self.in_standby?(:timeout => 30.sec)
  end
  true
end