class GPhoto2::PortInfo
Public Class Methods
find(port)
click to toggle source
@param [String] port @return [GPhoto2::PortInfo]
# File lib/gphoto2/port_info.rb, line 8 def self.find(port) port_info_list = PortInfoList.new index = port_info_list.lookup_path(port) port_info_list[index] end
new(port_info_list, index)
click to toggle source
@param [GPhoto2::PortInfoList] port_info_list @param [Integer] index
# File lib/gphoto2/port_info.rb, line 16 def initialize(port_info_list, index) @port_info_list = port_info_list @index = index new end
Public Instance Methods
name()
click to toggle source
@return [String]
# File lib/gphoto2/port_info.rb, line 23 def name get_name end
path()
click to toggle source
@return [String]
# File lib/gphoto2/port_info.rb, line 28 def path get_path end
type()
click to toggle source
@return [GPPortType]
# File lib/gphoto2/port_info.rb, line 33 def type get_type end
Private Instance Methods
get_name()
click to toggle source
# File lib/gphoto2/port_info.rb, line 46 def get_name name_ptr = FFI::MemoryPointer.new(:pointer) rc = gp_port_info_get_name(ptr, name_ptr) GPhoto2.check!(rc) name_ptr = name_ptr.read_pointer name_ptr.null? ? nil : name_ptr.read_string end
get_path()
click to toggle source
# File lib/gphoto2/port_info.rb, line 56 def get_path path_ptr = FFI::MemoryPointer.new(:pointer) rc = gp_port_info_get_path(ptr, path_ptr) GPhoto2.check!(rc) path_ptr = path_ptr.read_pointer path_ptr.null? ? nil : path_ptr.read_string end
get_type()
click to toggle source
# File lib/gphoto2/port_info.rb, line 66 def get_type # assume GPPortType is an int type = FFI::MemoryPointer.new(:int) rc = gp_port_info_get_type(ptr, type) GPhoto2.check!(rc) GPPortType[type.read_int] end
new()
click to toggle source
# File lib/gphoto2/port_info.rb, line 39 def new ptr = FFI::MemoryPointer.new(GPPortInfo) rc = gp_port_info_list_get_info(@port_info_list.ptr, @index, ptr) GPhoto2.check!(rc) @ptr = GPPortInfo.new(ptr.read_pointer) end