Class: Hive::Diagnostic::Android::Wifi
- Inherits:
-
Hive::Diagnostic
- Object
- Hive::Diagnostic
- Hive::Diagnostic::Android::Wifi
- Defined in:
- lib/hive/diagnostic/android/wifi.rb
Instance Method Summary collapse
Instance Method Details
#diagnose ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hive/diagnostic/android/wifi.rb', line 12 def diagnose result = "pass" wifi_status = wifi data = {} data[:access_point] = {:value => "#{wifi_status[:"#{key}"]}"} if wifi_status[:access_point].capitalize == "Xxxx" result = self.pass("Kindle returns wifi 'xxxx'", data) return result end config.each do |key, value| result = "fail" if wifi_status[:"#{key}"].capitalize != value.capitalize end if result == "pass" self.pass("#{key.capitalize} : #{wifi_status[:"#{key}"]}", data ) else self.fail("#{key.capitalize} : #{wifi_status[:"#{key}"]}", data ) end end |
#repair(result) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hive/diagnostic/android/wifi.rb', line 34 def repair(result) Hive.logger.info("Start wifi setting and select first access point") begin self.device_api.intent("start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings") # Select first access point available in list system("adb -s #{@serial} shell input keyevent 20") system("adb -s #{@serial} shell input keyevent 23") # Press home button system("adb -s #{@serial} shell input keyevent 3") rescue Hive.logger.error("Unable to resolve wifi issue") end diagnose end |
#wifi ⇒ Object
7 8 9 10 |
# File 'lib/hive/diagnostic/android/wifi.rb', line 7 def wifi wifi_details = self.device_api.wifi_status return {:status => wifi_details[:status].scan(/^[^\/]*/)[0], :access_point => wifi_details[:access_point]} end |