device_api-android 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e77d3bd4b44ae65dc199357e33267135f49755b
4
- data.tar.gz: f932b652920fe7e0750de2f579ffbf4d066df4b6
3
+ metadata.gz: cc299fd6553b73df6928d551ceb30f7bbfc43e87
4
+ data.tar.gz: 18327f25f6fed8d4c9401ec2ff7d42a75800058d
5
5
  SHA512:
6
- metadata.gz: 7e7069f51f3f3b171789c121a18673e6e149be5d80f371fc7ff12e71aae242c803b748a70faeec1dcf08beacc9578860488fe7dd717d9905519bb8511711b7c6
7
- data.tar.gz: de2ed91ce9f797e4d4afa7eac87af0848c88e4667064069c06ea7ba0eb673733986dde40ca9660a7e003221e731e96eb251968969688d9d7abdc59215c9b8738
6
+ metadata.gz: 1c7268f823bd12658fff01b5c186f83a62a05d5d68e937eaf06bc0245f0777bdafd4672a24365fc3d35681532a29dc9a05441753acbf9296b6e35ded3d58dfb4
7
+ data.tar.gz: fd850b7e8544c44cba97ddbbee27260590164b5fd448c67db0d2c49a6def61b44f1bac420e7db2e90d982dcec2d83de16ec307eabe0cde89050af75012e1ff76
@@ -69,6 +69,11 @@ module DeviceAPI
69
69
  process_dumpsys('(.*):\s+(.*)', lines)
70
70
  end
71
71
 
72
+ def self.get_network_interface(serial, interface)
73
+ result = shell(serial, "ifconfig #{interface}")
74
+ result.stdout
75
+ end
76
+
72
77
  # Get the network information
73
78
  def self.get_network_info(serial)
74
79
  lines = shell(serial, 'netcfg')
@@ -257,16 +257,26 @@ module DeviceAPI
257
257
 
258
258
  # Returns the Wifi IP address
259
259
  def ip_address
260
- network = get_network_info
261
- wlan0 = network.detect { |a| a[:name] == 'wlan0' }
262
- wlan0[:ip] unless wlan0.nil?
260
+ interface = ADB.get_network_interface(serial, 'wlan0')
261
+ if interface.match(/ip (.*) mask/)
262
+ Regexp.last_match[1]
263
+ elsif interface.match(/inet addr:(.*)\s+Bcast/)
264
+ Regexp.last_match[1].strip
265
+ else
266
+ # No match, wifi down?
267
+ end
263
268
  end
264
269
 
265
270
  # Returns the Wifi mac address
266
271
  def wifi_mac_address
267
- network = get_network_info
268
- wifi = network.detect { |a| a[:name] == 'wlan0' }
269
- wifi[:mac] unless wifi.nil?
272
+ interface = ADB.get_network_interface(serial, 'wlan0')
273
+ if interface.match(/HWaddr (.*)/)
274
+ Regexp.last_match[1].strip
275
+ else
276
+ network = get_network_info
277
+ wifi = network.detect { |a| a[:name] == 'wlan0' }
278
+ wifi[:mac] unless wifi.nil?
279
+ end
270
280
  end
271
281
 
272
282
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device_api-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Buckhurst
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-03-30 00:00:00.000000000 Z
14
+ date: 2016-04-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: device_api
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.5.0
82
+ rubygems_version: 2.4.8
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Android Device Management API