Module: Idevice::LibHelpers

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/idevice/c.rb', line 60

def self.included(base)
  class << base
  private
    def _attach_helper(svcname, opts={})
      idevice = opts[:idevice] || Idevice.attach(opts)
      ldsvc = opts[:lockdown_service]
      unless ldsvc
        ldclient = opts[:lockdown_client] || LockdownClient.attach(opts.merge(idevice:idevice))
        ldsvc = ldclient.start_service(svcname)
      end

      FFI::MemoryPointer.new(:pointer) do |p_client|
        yield idevice, ldsvc, p_client
      end
    end
  end
end