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 +4 -4
- data/lib/device_api/android/adb.rb +5 -0
- data/lib/device_api/android/device.rb +16 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc299fd6553b73df6928d551ceb30f7bbfc43e87
|
4
|
+
data.tar.gz: 18327f25f6fed8d4c9401ec2ff7d42a75800058d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
261
|
-
|
262
|
-
|
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
|
-
|
268
|
-
|
269
|
-
|
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.
|
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-
|
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.
|
82
|
+
rubygems_version: 2.4.8
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Android Device Management API
|