class GPhoto2::RadioCameraWidget

Public Instance Methods

choices() click to toggle source

@return [Array<String>]

# File lib/gphoto2/camera_widgets/radio_camera_widget.rb, line 4
def choices
  count_choices.times.map { |i| get_choice(i) }
end

Protected Instance Methods

get_value() click to toggle source
# File lib/gphoto2/camera_widgets/radio_camera_widget.rb, line 10
def get_value
  val_ptr = FFI::MemoryPointer.new(:pointer)

  rc = gp_widget_get_value(ptr, val_ptr)
  GPhoto2.check!(rc)

  val_ptr = val_ptr.read_pointer
  val_ptr.null? ? nil : val_ptr.read_string
end
set_value(value) click to toggle source
# File lib/gphoto2/camera_widgets/radio_camera_widget.rb, line 20
def set_value(value)
  val = FFI::MemoryPointer.from_string(value.to_s)
  rc = gp_widget_set_value(ptr, val)
  GPhoto2.check!(rc)
end

Private Instance Methods

count_choices() click to toggle source
# File lib/gphoto2/camera_widgets/radio_camera_widget.rb, line 28
def count_choices
  rc = gp_widget_count_choices(ptr)
  GPhoto2.check!(rc)
  rc
end
get_choice(i) click to toggle source
# File lib/gphoto2/camera_widgets/radio_camera_widget.rb, line 34
def get_choice(i)
  val_ptr = FFI::MemoryPointer.new(:pointer)

  rc = gp_widget_get_choice(ptr, i, val_ptr)
  GPhoto2.check!(rc)

  val_ptr = val_ptr.read_pointer
  val_ptr.null? ? nil : val_ptr.read_string
end