Class: Idevice::WebInspectorClient

Inherits:
C::ManagedOpaquePointer show all
Includes:
LibHelpers
Defined in:
lib/idevice/webinspector.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/webinspector.rb', line 41

def self.attach(opts={})
  _attach_helper("com.apple.webinspector", opts) do |idevice, ldsvc, p_wic|
    err = C.webinspector_client_new(idevice, ldsvc, p_wic)
    raise WebInspectorError, "WebInspector error: #{err}" if err != :SUCCESS

    wic = p_wic.read_pointer
    raise WebInspectorError, "webinspector_client_new returned a NULL client" if wic.null?

    return new(wic)
  end
end

.release(ptr) ⇒ Object


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

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

Instance Method Details

#receive_plistObject


59
60
61
62
63
64
65
# File 'lib/idevice/webinspector.rb', line 59

def receive_plist
  FFI::MemoryPointer.new(:pointer) do |p_plist|
    err = C.webinspector_receive(self, p_plist)
    raise WebInspectorError, "WebInspector error: #{err}" if err != :SUCCESS
    return p_plist.to_pointer.to_plist_t
  end
end

#send_plist(obj) ⇒ Object

Raises:


53
54
55
56
57
# File 'lib/idevice/webinspector.rb', line 53

def send_plist(obj)
  err = C.webinspector_send(self, Plist_t.from_ruby(obj))
  raise WebInspectorError, "WebInspector error: #{err}" if err != :SUCCESS
  return true
end