ffi-gphoto2 0.5.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +11 -0
  3. data/CHANGELOG.md +44 -0
  4. data/README.md +22 -12
  5. data/examples/autofocus.rb +21 -0
  6. data/examples/capture.rb +8 -0
  7. data/examples/continuous_burst.rb +27 -0
  8. data/examples/list_config.rb +1 -0
  9. data/examples/list_files.rb +52 -0
  10. data/ffi-gphoto2.gemspec +9 -8
  11. data/lib/ffi/gphoto2.rb +14 -4
  12. data/lib/ffi/gphoto2/camera_abilities_list.rb +1 -1
  13. data/lib/ffi/gphoto2/camera_file_info.rb +10 -0
  14. data/lib/ffi/gphoto2/camera_file_info_audio.rb +11 -0
  15. data/lib/ffi/gphoto2/camera_file_info_fields.rb +14 -0
  16. data/lib/ffi/gphoto2/camera_file_info_file.rb +15 -0
  17. data/lib/ffi/gphoto2/camera_file_info_preview.rb +13 -0
  18. data/lib/ffi/gphoto2/camera_file_permissions.rb +9 -0
  19. data/lib/ffi/gphoto2/camera_file_status.rb +7 -0
  20. data/lib/ffi/gphoto2/camera_list.rb +1 -1
  21. data/lib/ffi/gphoto2/camera_widget.rb +1 -1
  22. data/lib/ffi/gphoto2_port.rb +21 -1
  23. data/lib/ffi/gphoto2_port/gp_port.rb +17 -0
  24. data/lib/ffi/gphoto2_port/gp_port_info_list.rb +1 -1
  25. data/lib/ffi/gphoto2_port/gp_port_serial_parity.rb +6 -0
  26. data/lib/ffi/gphoto2_port/gp_port_settings.rb +11 -0
  27. data/lib/ffi/gphoto2_port/gp_port_settings_serial.rb +12 -0
  28. data/lib/ffi/gphoto2_port/gp_port_settings_usb.rb +15 -0
  29. data/lib/ffi/gphoto2_port/gp_port_settings_usb_disk_direct.rb +8 -0
  30. data/lib/ffi/gphoto2_port/gp_port_settings_usb_scsi.rb +8 -0
  31. data/lib/gphoto2.rb +24 -4
  32. data/lib/gphoto2/camera.rb +10 -2
  33. data/lib/gphoto2/camera/capture.rb +22 -0
  34. data/lib/gphoto2/camera/configuration.rb +2 -1
  35. data/lib/gphoto2/camera/event.rb +3 -6
  36. data/lib/gphoto2/camera_abilities.rb +9 -0
  37. data/lib/gphoto2/camera_abilities_list.rb +1 -1
  38. data/lib/gphoto2/camera_file.rb +26 -8
  39. data/lib/gphoto2/camera_file_info/camera_file_info.rb +52 -0
  40. data/lib/gphoto2/camera_file_info/file_camera_file_info.rb +30 -0
  41. data/lib/gphoto2/camera_list.rb +1 -1
  42. data/lib/gphoto2/camera_widgets/camera_widget.rb +3 -7
  43. data/lib/gphoto2/camera_widgets/radio_camera_widget.rb +0 -4
  44. data/lib/gphoto2/camera_widgets/text_camera_widget.rb +1 -3
  45. data/lib/gphoto2/entry.rb +0 -4
  46. data/lib/gphoto2/port.rb +61 -0
  47. data/lib/gphoto2/port_info.rb +0 -4
  48. data/lib/gphoto2/port_info_list.rb +1 -1
  49. data/lib/gphoto2/version.rb +1 -1
  50. data/spec/gphoto2/camera_abilities_spec.rb +23 -0
  51. data/spec/gphoto2/camera_file_info/file_camera_file_info_spec.rb +56 -0
  52. data/spec/gphoto2/camera_file_spec.rb +17 -0
  53. data/spec/gphoto2/camera_spec.rb +11 -5
  54. data/spec/gphoto2/port_spec.rb +22 -0
  55. data/spec/gphoto2_spec.rb +18 -0
  56. data/spec/support/shared_examples/camera/capture_examples.rb +13 -0
  57. data/spec/support/shared_examples/camera/configuration_examples.rb +26 -18
  58. data/spec/support/shared_examples/camera_file_info_examples.rb +42 -0
  59. metadata +54 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 83f9c14b8b7006440420e875c32d4a93b809ce28
4
- data.tar.gz: 9e3ccef87bc4565c88c4750e64d09ccde23f3330
2
+ SHA256:
3
+ metadata.gz: 705f84af5e6252107a78d9f76cefe51f3d1f9933c6e48b07ce21b7d507db2841
4
+ data.tar.gz: 3691c97cfc7551b30d3d4aff35cb7c33b5c09d28d81bb073a86210923814fa32
5
5
  SHA512:
6
- metadata.gz: 9d90104862dfccd44685aefa3870d83cde93e23a0aab57df6a7eb5a7feb2d9e712ca8c3125260b36f18b090df6ea8fce60726e913b667617f551180058c12397
7
- data.tar.gz: f8536cef9cf2d3d7c9cfedb71fa0e7079280a7a7a0e7f579e1b886c4cba8e37e9316504e2298f1aabc0358638a3cd7f0ef5d20e5c87eee95ea4e15d82acef454
6
+ metadata.gz: 792e487489753ac550cdbe27330c67aa2b522263ed8632a18fbfa44076e0dddadc44c201ef8c9cfdd1524c2338705760b11d576856d2fd4d266f9f02606a2f32
7
+ data.tar.gz: 276768da7221b07894b389081af32849cb36b926df2e2961a41381391a6fc4311df4d0842b0a4045e56ad7defff4c8366a551e7b65d95d3f9b1567e62780994a
@@ -0,0 +1,11 @@
1
+ sudo: required
2
+ dist: trusty
3
+ language: ruby
4
+ rvm:
5
+ - 2.3.1
6
+ before_install:
7
+ - gem install bundler -v 1.12.5
8
+ - sudo apt-get -qq update
9
+ - sudo apt-get install libgphoto2-6 libgphoto2-port10
10
+ - sudo ln -s /usr/lib/x86_64-linux-gnu/libgphoto2.so{.6,}
11
+ - sudo ln -s /usr/lib/x86_64-linux-gnu/libgphoto2_port.so{.10,}
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## HEAD
4
+
5
+ ## 0.8.0 (2020-06-29)
6
+
7
+ * [FIX] Fix deprecation warning (`warning: rb_safe_level will be removed in
8
+ Ruby 3.0`) by updating to ffi 1.12.0.
9
+ * [CHANGE] Raise minimum Ruby version to 2.0.0, which comes from the dependency
10
+ on ffi 1.12.0 (specifically 1.11.1).
11
+
12
+ ## 0.7.1 (2017-01-02)
13
+
14
+ * [FIX] Load `ffi` before any usage of the bindings.
15
+
16
+ ## 0.7.0 (2016-09-19)
17
+
18
+ * [CHANGE] Raise minimum `libgphoto2` version to 2.5.2. This version introduced
19
+ `gp_port_reset`.
20
+ * [ADD] Add `FFI::GPhoto2Port::GPPort` struct and related functions to do a
21
+ port reset.
22
+
23
+ ## 0.6.1 (2016-08-21)
24
+
25
+ * [FIX] `ManagedStruct.release` actually calls `*_free` functions. Autorelease
26
+ invocations were silently failing with a `TypeError` because the functions
27
+ expected structs, not pointers.
28
+
29
+ ## 0.6.0 (2016-07-11)
30
+
31
+ * [FIX] Use the correct default filename when a `CameraFile` is a preview.
32
+ * [ADD] Add `CameraFileInfo` and related operations. `CameraFile#info` only
33
+ supports files.
34
+ * [FIX] `CameraWidget#label` calls the correct widget label function.
35
+ * [FIX] `Camera#[]=` raises an `ArgumentError` when passed an invalid key
36
+ instead of failing on `nil`.
37
+ * [ADD] Add `CameraAbilities#operations` to always return an `Integer`.
38
+ libgphoto2 does not stay in the defined enum set of `CameraOperations`;
39
+ therefore, it is treated as an integer bit field instead.
40
+ * [CHANGE] Errors are thrown as `GPhoto2::Error` rather than `RuntimeError`.
41
+ Use `#message` and `#code` to extract the the GPhoto2 error message and
42
+ return code, respectively.
43
+ * [ADD] `Camera#trigger` for trigger capture.
44
+ * [FIX] `TextCameraWidget` values can by any object that implements `#to_s`.
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # ffi-gphoto2
2
2
 
3
- **ffi-gphoto2** provides an FFI for common functions in [libgphoto2][1].
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/ffi-gphoto2.svg)](https://badge.fury.io/rb/ffi-gphoto2)
5
+ [![Build Status](https://travis-ci.org/zaeleus/ffi-gphoto2.svg?branch=master)](https://travis-ci.org/zaeleus/ffi-gphoto2)
6
+
7
+ **ffi-gphoto2** provides an FFI for common functions in [libgphoto2][gphoto].
4
8
  It also includes a facade to interact with the library in a more
5
9
  idiomatic Ruby way.
6
10
 
@@ -8,8 +12,9 @@ idiomatic Ruby way.
8
12
 
9
13
  ### Prerequisites
10
14
 
11
- * Ruby >= 1.9
12
- * libgphoto2 >= 2.5.0
15
+ * Ruby >= 2.0
16
+ * libgphoto2 >= 2.5.2
17
+ * libgphoto2_port >= 0.10.1
13
18
 
14
19
  ### Gem
15
20
 
@@ -34,9 +39,17 @@ camera = cameras.first
34
39
  # ...or more conveniently
35
40
  camera = GPhoto2::Camera.first
36
41
 
37
- # ...or even search by model name
42
+ # search by model name
38
43
  camera = GPhoto2::Camera.where(model: /nikon/i).first
39
44
 
45
+ # the above examples require the camera be manually closed when done
46
+ camera.close
47
+
48
+ # pass a block to automatically close the camera
49
+ GPhoto2::Camera.first do |camera|
50
+ # ...
51
+ end
52
+
40
53
  # check camera abilities (see `FFI::GPhoto2::CameraOperation.symbols`)
41
54
  camera.can? :capture_image
42
55
  # => true
@@ -97,14 +110,11 @@ file.save
97
110
 
98
111
  # ...and then delete it from the camera
99
112
  file.delete
100
-
101
- # close the camera
102
- camera.finalize
103
113
  ```
104
114
 
105
- More examples can be found in [`examples/`][2]. YARD documentation can be
106
- generated using the `rake yard` task or [browsed online][3].
115
+ More examples can be found in [`examples/`][examples]. YARD documentation can be
116
+ generated using the `rake yard` task or [browsed online][rubydoc].
107
117
 
108
- [1]: http://www.gphoto.org/
109
- [2]: https://github.com/zaeleus/ffi-gphoto2/tree/master/examples
110
- [3]: http://www.rubydoc.info/gems/ffi-gphoto2/frames
118
+ [gphoto]: http://www.gphoto.org/
119
+ [examples]: https://github.com/zaeleus/ffi-gphoto2/tree/master/examples
120
+ [rubydoc]: http://www.rubydoc.info/gems/ffi-gphoto2/frames
@@ -0,0 +1,21 @@
1
+ require 'gphoto2'
2
+
3
+ # Capture an image only after successfully autofocusing.
4
+ #
5
+ # Typically, if the camera fails to autofocus, updating the `autofocusdrive`
6
+ # key will throw an "Unspecified error (-1)". This catches the exception and
7
+ # continues to autofocus until it is successful.
8
+
9
+ GPhoto2::Camera.first do |camera|
10
+ begin
11
+ camera.update(autofocusdrive: true)
12
+ rescue GPhoto2::Error
13
+ puts "autofocus failed... retrying"
14
+ camera.reload
15
+ retry
16
+ ensure
17
+ camera.update(autofocusdrive: false)
18
+ end
19
+
20
+ camera.capture
21
+ end
@@ -0,0 +1,8 @@
1
+ require 'gphoto2'
2
+
3
+ # Captures a single photo and saves it to the current working directory.
4
+
5
+ GPhoto2::Camera.first do |camera|
6
+ file = camera.capture
7
+ file.save
8
+ end
@@ -0,0 +1,27 @@
1
+ require 'gphoto2'
2
+
3
+ # This example is limited to Nikon cameras with a continuous burst mode.
4
+
5
+ # The number of frames to capture.
6
+ N = 3
7
+
8
+ GPhoto2::Camera.first do |camera|
9
+ # Set the camera to continuous burst mode.
10
+ camera.update(capturemode: 'Burst', burstnumber: N)
11
+
12
+ # Use `#trigger` instead of `#capture` so the data remains in the camera
13
+ # buffer.
14
+ camera.trigger
15
+
16
+ # Wait for the camera to process all the images.
17
+ queue = N.times.map do
18
+ event = camera.wait_for(:file_added)
19
+
20
+ # The event data contains a `CameraFile` when the `:file_added` event is
21
+ # triggered.
22
+ event.data
23
+ end
24
+
25
+ # Save all the images to the current working directory.
26
+ queue.each(&:save)
27
+ end
@@ -14,6 +14,7 @@ def visit(widget, level = 0)
14
14
 
15
15
  indent << ' '
16
16
 
17
+ puts "#{indent}label: #{widget.label}"
17
18
  puts "#{indent}type: #{widget.type}"
18
19
  puts "#{indent}value: #{widget.value}"
19
20
 
@@ -0,0 +1,52 @@
1
+ require 'gphoto2'
2
+
3
+ # Recursively list folder contents with extended metadata.
4
+
5
+ MAGNITUDES = %w[bytes KiB MiB GiB].freeze
6
+
7
+ # @param [Integer] size filesize in bytes
8
+ # @param [Integer[ precision
9
+ # @return [String]
10
+ def format_filesize(size, precision = 1)
11
+ n = 0
12
+
13
+ while size >= 1024.0 && n < MAGNITUDES.size
14
+ size /= 1024.0
15
+ n += 1
16
+ end
17
+
18
+ "%.#{precision}f %s" % [size, MAGNITUDES[n]]
19
+ end
20
+
21
+ # @param [CameraFolder] folder a root directory
22
+ def visit(folder)
23
+ files = folder.files
24
+
25
+ puts "#{folder.path} (#{files.size} files)"
26
+
27
+ files.each do |file|
28
+ info = file.info
29
+
30
+ name = file.name
31
+ # Avoid using `File#size` here to prevent having to load the data along
32
+ # with it.
33
+ size = format_filesize(info.size)
34
+ mtime = info.mtime.utc.iso8601
35
+
36
+ if info.has_field?(:width) && info.has_field?(:height)
37
+ dimensions = "#{info.width}x#{info.height}"
38
+ else
39
+ dimensions = '-'
40
+ end
41
+
42
+ puts "#{name.ljust(30)} #{size.rjust(12)} #{dimensions.rjust(12)} #{mtime}"
43
+ end
44
+
45
+ puts
46
+
47
+ folder.folders.each { |child| visit(child) }
48
+ end
49
+
50
+ GPhoto2::Camera.first do |camera|
51
+ visit(camera.filesystem)
52
+ end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.homepage = 'https://github.com/zaeleus/ffi-gphoto2'
10
10
 
11
11
  spec.authors = ['Michael Macias']
12
- spec.email = ['mamacias@go.olemiss.edu']
12
+ spec.email = ['zaeleus@gmail.com']
13
13
 
14
14
  spec.version = GPhoto2::VERSION
15
15
  spec.license = 'MIT'
@@ -19,13 +19,14 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.requirements << 'libgphoto2 >= 2.5.0'
23
- spec.required_ruby_version = '>= 1.9'
22
+ spec.requirements << 'libgphoto2 >= 2.5.2'
23
+ spec.requirements << 'libgphoto2_port >= 0.10.1'
24
+ spec.required_ruby_version = '>= 2.0'
24
25
 
25
- spec.add_development_dependency 'bundler', '~> 1.3'
26
- spec.add_development_dependency 'rake'
27
- spec.add_development_dependency 'rspec', '~> 3.2.0'
28
- spec.add_development_dependency 'yard', '~> 0.8.7'
26
+ spec.add_development_dependency 'bundler', '~> 2.0'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.9.0'
29
+ spec.add_development_dependency 'yard', '~> 0.9.0'
29
30
 
30
- spec.add_dependency 'ffi', '~> 1.9.0'
31
+ spec.add_dependency 'ffi', '~> 1.12.0'
31
32
  end
@@ -1,3 +1,4 @@
1
+ require 'ffi'
1
2
  require 'ffi/gphoto2_port'
2
3
 
3
4
  module FFI
@@ -11,7 +12,10 @@ module FFI
11
12
  require 'ffi/gphoto2/camera_driver_status'
12
13
  require 'ffi/gphoto2/camera_event_type'
13
14
  require 'ffi/gphoto2/camera_file_access_type'
15
+ require 'ffi/gphoto2/camera_file_info_fields'
14
16
  require 'ffi/gphoto2/camera_file_operation'
17
+ require 'ffi/gphoto2/camera_file_permissions'
18
+ require 'ffi/gphoto2/camera_file_status'
15
19
  require 'ffi/gphoto2/camera_file_type'
16
20
  require 'ffi/gphoto2/camera_folder_operation'
17
21
  require 'ffi/gphoto2/camera_operation'
@@ -23,15 +27,19 @@ module FFI
23
27
  require 'ffi/gphoto2/camera_abilities'
24
28
  require 'ffi/gphoto2/camera_abilities_list'
25
29
  require 'ffi/gphoto2/camera_file'
30
+ require 'ffi/gphoto2/camera_file_info_audio'
31
+ require 'ffi/gphoto2/camera_file_info_file'
32
+ require 'ffi/gphoto2/camera_file_info_preview'
33
+ require 'ffi/gphoto2/camera_file_info'
26
34
  require 'ffi/gphoto2/camera_file_path'
35
+ require 'ffi/gphoto2/entry'
27
36
  require 'ffi/gphoto2/camera_list'
28
37
  require 'ffi/gphoto2/camera_widget'
29
- require 'ffi/gphoto2/entry'
30
38
  require 'ffi/gphoto2/gp_context'
31
39
 
32
40
  # gphoto2/gphoto2-abilities-list.h
33
41
  attach_function :gp_abilities_list_new, [:pointer], :int
34
- attach_function :gp_abilities_list_free, [CameraAbilitiesList.by_ref], :int
42
+ attach_function :gp_abilities_list_free, [:pointer], :int
35
43
  attach_function :gp_abilities_list_load, [CameraAbilitiesList.by_ref, GPContext.by_ref], :int
36
44
  attach_function :gp_abilities_list_detect, [CameraAbilitiesList.by_ref, GPhoto2Port::GPPortInfoList.by_ref, CameraList.by_ref, GPContext.by_ref], :int
37
45
  attach_function :gp_abilities_list_lookup_model, [CameraAbilitiesList.by_ref, :string], :int
@@ -47,10 +55,12 @@ module FFI
47
55
  attach_function :gp_camera_get_config, [Camera.by_ref, :pointer, GPContext.by_ref], :int
48
56
  attach_function :gp_camera_set_config, [Camera.by_ref, CameraWidget.by_ref, GPContext.by_ref], :int
49
57
  attach_function :gp_camera_capture, [Camera.by_ref, CameraCaptureType, CameraFilePath.by_ref, GPContext.by_ref], :int, blocking: true
58
+ attach_function :gp_camera_trigger_capture, [Camera.by_ref, GPContext.by_ref], :int, blocking: true
50
59
  attach_function :gp_camera_capture_preview, [Camera.by_ref, CameraFile.by_ref, GPContext.by_ref], :int, blocking: true
51
60
  attach_function :gp_camera_wait_for_event, [Camera.by_ref, :int, :pointer, :pointer, GPContext.by_ref], :int
52
61
  attach_function :gp_camera_folder_list_files, [Camera.by_ref, :string, CameraList.by_ref, GPContext.by_ref], :int
53
62
  attach_function :gp_camera_folder_list_folders, [Camera.by_ref, :string, CameraList.by_ref, GPContext.by_ref], :int
63
+ attach_function :gp_camera_file_get_info, [Camera.by_ref, :string, :string, CameraFileInfo.by_ref, GPContext.by_ref], :int
54
64
  attach_function :gp_camera_file_get, [Camera.by_ref, :string, :string, CameraFileType, CameraFile.by_ref, GPContext.by_ref], :int, blocking: true
55
65
  attach_function :gp_camera_file_delete, [Camera.by_ref, :string, :string, GPContext.by_ref], :int
56
66
 
@@ -61,12 +71,12 @@ module FFI
61
71
 
62
72
  # gphoto2/gphoto2-file.h
63
73
  attach_function :gp_file_new, [:pointer], :int
64
- attach_function :gp_file_free, [CameraFile.by_ref], :int
74
+ attach_function :gp_file_free, [:pointer], :int
65
75
  attach_function :gp_file_get_data_and_size, [CameraFile.by_ref, :pointer, :pointer], :int
66
76
 
67
77
  # gphoto2/gphoto2-list.h
68
78
  attach_function :gp_list_new, [:pointer], :int
69
- attach_function :gp_list_free, [CameraList.by_ref], :int
79
+ attach_function :gp_list_free, [:pointer], :int
70
80
  attach_function :gp_list_count, [CameraList.by_ref], :int
71
81
  attach_function :gp_list_get_name, [CameraList.by_ref, :int, :pointer], :int
72
82
  attach_function :gp_list_get_value, [CameraList.by_ref, :int, :pointer], :int
@@ -5,7 +5,7 @@ module FFI
5
5
  class CameraAbilitiesList < FFI::ManagedStruct
6
6
  # libgphoto2/gphoto2-abilities-list.c
7
7
  layout :count, :int,
8
- :abilities, :pointer # CameraAbilities*
8
+ :abilities, CameraAbilities.by_ref
9
9
 
10
10
  def self.release(ptr)
11
11
  FFI::GPhoto2.gp_abilities_list_free(ptr)
@@ -0,0 +1,10 @@
1
+ module FFI
2
+ module GPhoto2
3
+ class CameraFileInfo < FFI::Struct
4
+ # libgphoto2/gphoto2-filesys.h
5
+ layout :preview, CameraFileInfoPreview,
6
+ :file, CameraFileInfoFile,
7
+ :audio, CameraFileInfoAudio
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module FFI
2
+ module GPhoto2
3
+ class CameraFileInfoAudio < FFI::Struct
4
+ # gphoto2/gphoto2-filesys.h
5
+ layout :fields, CameraFileInfoFields,
6
+ :status, CameraFileStatus,
7
+ :size, :uint64,
8
+ :type, [:char, 64]
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module FFI
2
+ module GPhoto2
3
+ # gphoto2/gphoto2-filesys.h
4
+ CameraFileInfoFields = enum :none, 0,
5
+ :type, 1 << 0,
6
+ :size, 1 << 2,
7
+ :width, 1 << 3,
8
+ :height, 1 << 4,
9
+ :permissions, 1 << 5,
10
+ :status, 1 << 6,
11
+ :mtime, 1 << 7,
12
+ :all, 0xff
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module FFI
2
+ module GPhoto2
3
+ class CameraFileInfoFile < FFI::Struct
4
+ # gphoto2/gphoto2-filesys.h
5
+ layout :fields, CameraFileInfoFields,
6
+ :status, CameraFileStatus,
7
+ :size, :uint64,
8
+ :type, [:char, 64],
9
+ :width, :uint32,
10
+ :height, :uint32,
11
+ :permissions, CameraFilePermissions,
12
+ :mtime, :time_t
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module FFI
2
+ module GPhoto2
3
+ class CameraFileInfoPreview < FFI::Struct
4
+ # gphoto2/gphoto2-filesys.h
5
+ layout :fields, CameraFileInfoFields,
6
+ :status, CameraFileStatus,
7
+ :size, :uint64,
8
+ :type, [:char, 64],
9
+ :width, :uint32,
10
+ :height, :uint32
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module FFI
2
+ module GPhoto2
3
+ # gphoto2/gphoto2-filesys.h
4
+ CameraFilePermissions = enum :none, 0,
5
+ :read, 1 << 0,
6
+ :delete, 1 << 1,
7
+ :all, 0xff
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module FFI
2
+ module GPhoto2
3
+ # gphoto2/gphoto2-filesys.h
4
+ CameraFileStatus = enum :not_downloaded,
5
+ :downloaded
6
+ end
7
+ end