Class: Idevice::InstProxyClient

Inherits:
C::ManagedOpaquePointer show all
Includes:
LibHelpers
Defined in:
lib/idevice/installation_proxy.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LibHelpers

included

Methods inherited from C::ManagedOpaquePointer

#initialize

Constructor Details

This class inherits a constructor from Idevice::C::ManagedOpaquePointer

Class Method Details

.attach(opts = {}) ⇒ Object


41
42
43
44
45
46
47
48
49
50
51
# File 'lib/idevice/installation_proxy.rb', line 41

def self.attach(opts={})
  _attach_helper("com.apple.mobile.installation_proxy", opts) do |idevice, ldsvc, p_ip|
    err = C.instproxy_client_new(idevice, ldsvc, p_ip)
    raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

    ip = p_ip.read_pointer
    raise InstProxyError, "instproxy_client_new returned a NULL house_arrest_client_t pointer" if ip.null?

    return new(ip)
  end
end

.release(ptr) ⇒ Object


33
34
35
36
37
38
39
# File 'lib/idevice/installation_proxy.rb', line 33

def self.release(ptr)
  C::Freelock.synchronize do
    unless ptr.null?
      C.instproxy_client_free(ptr)
    end
  end
end

Instance Method Details

#archive(appid, opts = {}, &block) ⇒ Object

Raises:


103
104
105
106
107
108
109
# File 'lib/idevice/installation_proxy.rb', line 103

def archive(appid, opts={}, &block)
  opts ||= {}
  err = C.instproxy_archive(self, appid, opts.to_plist_t, _cb(&block), nil)
  raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

  return true
end

#browse(opts = {}) ⇒ Object


53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/idevice/installation_proxy.rb', line 53

def browse(opts={})
  opts ||= {}
  FFI::MemoryPointer.new(:pointer) do |p_result|
    err = C.instproxy_browse(self, opts.to_plist_t, p_result)
    raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

    result = p_result.read_pointer.read_plist_t
    raise InstProxyError, "instproxy_browse returned a null plist_t" if result.nil?

    return result
  end
end

#install(pkg_path, opts = {}, &block) ⇒ Object

Raises:


66
67
68
69
70
71
72
# File 'lib/idevice/installation_proxy.rb', line 66

def install(pkg_path, opts={}, &block)
  opts ||= {}
  err = C.instproxy_install(self, pkg_path, opts.to_plist_t, _cb(&block), nil)
  raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

  return true
end

#lookup_archives(opts = {}) ⇒ Object


90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/idevice/installation_proxy.rb', line 90

def lookup_archives(opts={})
  opts ||= {}
  FFI::MemoryPointer.new(:pointer) do |p_result|
    err = C.instproxy_lookup_archives(self, opts.to_plist_t, p_result)
    raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

    result = p_result.read_pointer.read_plist_t
    raise InstProxyError, "instproxy_lookup_archives returned a null plist_t" if result.nil?

    return result
  end
end

#remove_archive(appid, opts = {}, &block) ⇒ Object

Raises:


119
120
121
122
123
124
125
# File 'lib/idevice/installation_proxy.rb', line 119

def remove_archive(appid, opts={}, &block)
  opts ||= {}
  err = C.instproxy_remove_archive(self, appid, opts.to_plist_t, _cb(&block), nil)
  raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

  return true
end

#restore(appid, opts = {}, &block) ⇒ Object

Raises:


111
112
113
114
115
116
117
# File 'lib/idevice/installation_proxy.rb', line 111

def restore(appid, opts={}, &block)
  opts ||= {}
  err = C.instproxy_restore(self, appid, opts.to_plist_t, _cb(&block), nil)
  raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

  return true
end

#uninstall(appid, opts = {}, &block) ⇒ Object

Raises:


82
83
84
85
86
87
88
# File 'lib/idevice/installation_proxy.rb', line 82

def uninstall(appid, opts={}, &block)
  opts ||= {}
  err = C.instproxy_uninstall(self, appid, opts.to_plist_t, _cb(&block), nil)
  raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

  return true
end

#upgrade(pkg_path, opts = {}, &block) ⇒ Object

Raises:


74
75
76
77
78
79
80
# File 'lib/idevice/installation_proxy.rb', line 74

def upgrade(pkg_path, opts={}, &block)
  opts ||= {}
  err = C.instproxy_upgrade(self, pkg_path, opts.to_plist_t, _cb(&block), nil)
  raise InstProxyError, "instproxy_client error: #{err}" if err != :SUCCESS

  return true
end