Class: Idevice::FileRelayClient
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from LibHelpers
included
#initialize
Class Method Details
.attach(opts = {}) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/idevice/file_relay.rb', line 39
def self.attach(opts={})
_attach_helper("com.apple.mobile.file_relay", opts) do |idevice,ldsvc,p_frc|
err = C.file_relay_client_new(idevice, ldsvc, p_frc)
raise FileRelayError, "File Relay error: #{err}" if err != :SUCCESS
frc = p_frc.read_pointer
raise FileRelayError, "file_relay_client_new returned a NULL client" if frc.null?
return new(frc)
end
end
|
.release(ptr) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/idevice/file_relay.rb', line 31
def self.release(ptr)
C::Freelock.synchronize do
unless ptr.null?
C.file_relay_client_free(ptr)
end
end
end
|
Instance Method Details
#request_sources(*sources, &block) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/idevice/file_relay.rb', line 49
def request_sources(*sources, &block)
FFI::MemoryPointer.null_terminated_array_of_strings(sources) do |p_sources|
FFI::MemoryPointer.new(:pointer) do |p_conn|
err = C.file_relay_request_sources(self, p_sources, p_conn)
raise FileRelayError, "File Relay error: #{err}" if err != :SUCCESS
conn = p_conn.read_pointer
raise FileRelayError, "file_relay_request_sources returned a NULL connection" if conn.null?
iconn = IdeviceConnection.new(conn)
ret = iconn.receive_all(nil, &block)
return ret
end
end
end
|