idevice 1.1.5.8 → 1.1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/idevice.rb +60 -0
- data/lib/idevice/idevice.rb +11 -0
- data/lib/idevice/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWUwNzQ4ZWVhNGIwMmI4NzlmMjI0MzQxNTgzNjRhMjg2YmY4NmM2Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTllZGIzOWU1NjAxMjAzMjcwZDYxZjQ5MGI3MWNlNTM1OGZiYTlhMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGFiMTdhNDJhZGNkOTJhYjY5ZGRhZjQ0MzUzMWM1ODU0NTRjZWRiMDA3ZDdh
|
10
|
+
YjRhNzE2YjE5ODhhZmZiYzEzOTU2YmYyMjBjNDNiYWJhZjdkMzE3NmViM2Qz
|
11
|
+
NjM5NmEyZTZlNDA2YTdmYzc4YWQ4OTRmZDM2M2Q0ZDM2NGE5M2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWFhMWEyNDVjMzhhM2ZhMjE3OGQ3ZGE4NjczOWQzZGFmNTJkNjRkMzU1MjMz
|
14
|
+
ZmI3OTVlOTQ0ZDA3ZWUxMmE5NTdhYzAwNDIzMGU1YzI3YWViMjVlMmQyNTE0
|
15
|
+
MDU4NDg3NjEzMzBlODg3NDkwOTdkMGY0YWVmOTRlZTlhNmMxZDc=
|
data/lib/idevice.rb
CHANGED
@@ -65,5 +65,65 @@ module Idevice
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
# listens for event connection and disconnection events
|
70
|
+
def self.subscribe
|
71
|
+
finished = false
|
72
|
+
|
73
|
+
cb = Proc.new do |eventp, junk|
|
74
|
+
unless eventp.nil? or eventp.null?
|
75
|
+
evt = C::DEVICE_EVENTS[eventp.read_int] || :UNKNOWN
|
76
|
+
finished = yield(evt)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
begin
|
81
|
+
C.idevice_event_subscribe(cb, nil)
|
82
|
+
until finished
|
83
|
+
#nop
|
84
|
+
end
|
85
|
+
ensure
|
86
|
+
C.idevice_event_unsubscribe()
|
87
|
+
end
|
88
|
+
nil
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.wait_for_device_add(opts={})
|
92
|
+
udid = opts[:udid]
|
93
|
+
if udid
|
94
|
+
return if device_list.include?(udid)
|
95
|
+
end
|
96
|
+
|
97
|
+
subscribe do |evt|
|
98
|
+
if evt == :DEVICE_ADD
|
99
|
+
if udid
|
100
|
+
self.device_list.include?(udid)
|
101
|
+
else
|
102
|
+
true
|
103
|
+
end
|
104
|
+
else
|
105
|
+
false
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.wait_for_device_remove(opts={})
|
111
|
+
udid = opts[:udid]
|
112
|
+
if udid
|
113
|
+
return unless device_list.include?(udid)
|
114
|
+
end
|
115
|
+
|
116
|
+
subscribe do |evt|
|
117
|
+
if evt == :DEVICE_REMOVE
|
118
|
+
if udid
|
119
|
+
(not self.device_list.include?(udid))
|
120
|
+
else
|
121
|
+
true
|
122
|
+
end
|
123
|
+
else
|
124
|
+
false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
68
128
|
end
|
69
129
|
|
data/lib/idevice/idevice.rb
CHANGED
@@ -188,6 +188,17 @@ module Idevice
|
|
188
188
|
:SSL_ERROR, -6,
|
189
189
|
), :idevice_error_t
|
190
190
|
|
191
|
+
DEVICE_EVENTS = {
|
192
|
+
1 => :DEVICE_ADD,
|
193
|
+
2 => :DEVICE_REMOVE,
|
194
|
+
}
|
195
|
+
|
196
|
+
# async discovery
|
197
|
+
callback :idevice_event_cb_t, [:pointer, :pointer], :void
|
198
|
+
|
199
|
+
attach_function :idevice_event_subscribe, [:idevice_event_cb_t, :pointer], :idevice_error_t
|
200
|
+
attach_function :idevice_event_unsubscribe, [], :idevice_error_t
|
201
|
+
|
191
202
|
# discovery (synchronous)
|
192
203
|
attach_function :idevice_set_debug_level, [:int], :void
|
193
204
|
attach_function :idevice_get_device_list, [:pointer, :pointer], :idevice_error_t
|
data/lib/idevice/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idevice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.5.
|
4
|
+
version: 1.1.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Monti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|