Method: Odn#measure_tune_guide_mod_mod

Defined in:
lib/platform/stb/odn/odn.rb

#measure_tune_guide_mod_mod(from_channel_type, to_channel_type, from_channel, to_channel, tune_type = 'direct') ⇒ Object

Public: measures tune in guide from MOD to MOD

from_channel_type - type of channel we are starting from to_channel_type - type of channel we are going to tune to from_channel - channel number we are starting from to_channel - channel number we are going to tune to tune_type - type of tune we are performing (direct or guide)

Returns nohting



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/platform/stb/odn/odn.rb', line 141

def measure_tune_guide_mod_mod(from_channel_type, to_channel_type, from_channel, to_channel, tune_type='direct')
  debug_log = false
  fail("From and to channels cannot be the same") if (from_channel == to_channel)
  screenROI = roi.image.guide_info

  logger.info("#{tune_type} tune from channel: #{from_channel} to channel: #{to_channel}")
  #Verify video on from_channel
  fail("Failed to initialize STB") unless init?
  screens.live_tv.navigate?
  screens.live_tv.set_channel(from_channel)
  fail("Tuned to wrong from channel: #{from_channel}") unless verify_expected_channel?(from_channel)
  fail("Could not get video on from_channel: #{from_channel}") unless screens.live_tv.displayed?
  press_key.EXIT

  if (tune_type == 'guide')
    press_key.GUIDE
    sleep(4.sec)
    screens.guide.set_channel?(to_channel)
    sleep(4.sec)
    filename = capture_screen("tmp_stb_#{$stb_id}.jpg")
    screenROI.ref_img = filename
    logger.info("Screen before pressing select", :screenshot => true, :use_last_image => false, :image_suffix => "image")
    press_key.SELECT(:sleep_time => 0.sec)
  else
    sleep(2.sec)
    filename = capture_screen("tmp_stb_#{$stb_id}.jpg")
    screenROI.ref_img = filename
    logger.info("Screen before pressing tuning to channel", :screenshot => true, :use_last_image => false, :image_suffix => "image")
    screens.live_tv.set_channel?(to_channel)
  end
  times[0] = Time.now
  if screenROI.wait_until_not_displayed?(timeout=15000, :priority => :high)
    times[1] = Time.now
  else
    times[1] = times[0]   # failed case
  end
  dataValue = time_diff_milli(times[0], times[1])
  fail("Failed to go to channel #{to_channel}") if (dataValue == 0)
  dataValue = dataValue.to_s
  report_result(:start_time => times[0], :stop_time => times[1])
  logger.duration(dataValue, :message => "#{from_channel_type} to #{to_channel_type} #{tune_type} tune|")
  press_key.EXIT
end