idevice 1.1.5.8 → 1.1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWMwMTkyNmExNWI5OTIyMzEzMjE2OGYyYWMzZTg1YmNiNzNjM2Y2Mw==
4
+ YWUwNzQ4ZWVhNGIwMmI4NzlmMjI0MzQxNTgzNjRhMjg2YmY4NmM2Zg==
5
5
  data.tar.gz: !binary |-
6
- MDA4NDRkYjc4YzVlYzNlZTI4ZTA3YmU4ZTZjZGZjMTAzOWUwYWM1ZA==
6
+ ZTllZGIzOWU1NjAxMjAzMjcwZDYxZjQ5MGI3MWNlNTM1OGZiYTlhMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWY5NjZjNzIzYWEwMjRkNTViZmNiNTYxZjdmNjQ3M2E1NmM2ZDU0MGZhYjEy
10
- YjBmN2E1ZmVjMjdkYzNiNGVjZmQ2Zjk1NWQ2OTg5ODAxNDkzNTA5OTA2NjA3
11
- ODcyMzQzZGIzZGE1ZWVjYjliNzAxNDQzNzI0ZjQyNWVmZGZkMWY=
9
+ NGFiMTdhNDJhZGNkOTJhYjY5ZGRhZjQ0MzUzMWM1ODU0NTRjZWRiMDA3ZDdh
10
+ YjRhNzE2YjE5ODhhZmZiYzEzOTU2YmYyMjBjNDNiYWJhZjdkMzE3NmViM2Qz
11
+ NjM5NmEyZTZlNDA2YTdmYzc4YWQ4OTRmZDM2M2Q0ZDM2NGE5M2E=
12
12
  data.tar.gz: !binary |-
13
- ODJjOGE3NzBhNTk5ZWNjODk5M2ViMTU4NDVlOGRkNWVmMmE3Y2MxOTUxOTU2
14
- NTg2YWFmMTM0ZDBjNmFkZjBiYjllMzNjNzE4MTVmZWMyMDM1MDRhMTkwZWM1
15
- YTE4ZjQ0OWQxOWM4OTgzM2VlNGVhZjcwZDE1NWEyN2ExMTA4NjY=
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Idevice
2
- VERSION = "1.1.5.8"
2
+ VERSION = "1.1.5.9"
3
3
  end
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.8
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-08 00:00:00.000000000 Z
11
+ date: 2014-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi