Sha256: c201681b14378942b7475f0051a132ddb283fe85a663f7859c78a04ffa0be8f4
Contents?: true
Size: 1.2 KB
Versions: 4
Compression:
Stored size: 1.2 KB
Contents
require 'di' require 'ADB' require 'stf/client' require 'stf/log/log' module Stf class StopDebugSessionInteractor include Log include ADB def execute(remote_connect_url) remote_devices = DI[:stf].get_user_devices device = remote_devices.find {|d| d.remoteConnect == true && d.remoteConnectUrl.eql?(remote_connect_url)} # try to disconnect anyway execute_adb_with 30, "disconnect #{remote_connect_url}" if device.nil? logger.error "Device #{remote_connect_url} is not available" return false end success = false 1..10.times do begin success = DI[:stf].stop_debug(device.serial) break if success rescue end logger.error 'Can\'t stop debug session. Retrying' end 1..10.times do begin success = DI[:stf].remove_device(device.serial) break if success rescue end logger.error 'Can\'t remove device from user devices. Retrying' end if success logger.info "Successfully removed #{remote_connect_url}" else logger.error "Error removing #{remote_connect_url}" end success end end end
Version data entries
4 entries across 4 versions & 1 rubygems