Class: Idevice::MisAgentClient

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

Overview

Used to manage provisioning profiles on the device.

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



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

def self.attach(opts={})
  _attach_helper("com.apple.misagent", opts) do |idevice, ldsvc, p_ma|
    err = C.misagent_client_new(idevice, ldsvc, p_ma)
    raise MisAgentError, "misagent error: #{err}" if err != :SUCCESS

    ma = p_ma.read_pointer
    raise MisAgentError, "misagent_client_new returned a NULL misagent_client_t pointer" if ma.null?
    return new(ma)
  end
end

.release(ptr) ⇒ Object



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

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

Instance Method Details

#install(profile_hash) ⇒ Object

Raises:



68
69
70
71
72
73
# File 'lib/idevice/misagent.rb', line 68

def install(profile_hash)
  err = C.misagent_install(self, Plist_t.from_ruby(profile_hash))
  raise MisAgentError, "misagent error: #{err}" if err != :SUCCESS

  return status_code
end

#profilesObject



57
58
59
60
61
62
63
64
65
66
# File 'lib/idevice/misagent.rb', line 57

def profiles
  FFI::MemoryPointer.new(:pointer) do |p_profiles|
    err = C.misagent_copy(self, p_profiles)
    raise MisAgentError, "misagent error: #{err}" if err != :SUCCESS

    profiles = p_profiles.read_pointer.read_plist_t
    raise MisAgentError, "misagent_copy returned null profiles plist_t" if profiles.nil?
    return profiles
  end
end

#remove(profile_ident) ⇒ Object

Raises:



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

def remove(profile_ident)
  err = C.misagent_remove(self, profile_ident)
  raise MisAgentError, "misagent error: #{err}" if err != :SUCCESS

  return status_code
end

#status_codeObject



53
54
55
# File 'lib/idevice/misagent.rb', line 53

def status_code
  C.misagent_get_status_code(self)
end