canonball 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5aa29b187c7d7d938e8a63c9a05e96ebc05c553
4
- data.tar.gz: f662a4fb55cc1eba51e3f5379658fe5fe4812245
3
+ metadata.gz: 46dff7b0f15b03afe400f1d26b85f97764ffbfc7
4
+ data.tar.gz: 8be9475a5453bb67d48a913ac3a27578ff2fd4b6
5
5
  SHA512:
6
- metadata.gz: 52894e7b5bccd621cdd6efb6b7c0f0c0d29d15accdb14f53e01fdc81afce89b149f556e75d981632cca71038071deef578a2bdfd01bea6bfcd5a54df1cbbe0e0
7
- data.tar.gz: 28554c3ad2ff96adbf85cc52881841e345f1695b40bddb18c95ab3fbdd880bd79ef92316e082a33a585fff1ad88e4cf3af486596b021ec7e6fa179b120b15a39
6
+ metadata.gz: f42f9c56ce250c09f3fe113037a9b9aa10f8282bda3cce9bf6019665b8b7cf7e3efd0f237ddcbf15673e9ef950dde7e09bb43647eb3b53b55eca30ee4ebabd73
7
+ data.tar.gz: c8583358f8b6345569da264ceb899c28a25d8aacaca430b6990ba3ac1ae4d3345d2052bd487b3d203e24a7082033d92ad5176ce179d64b467555a2216e50ac9d
data/lib/canonball.rb CHANGED
@@ -9,7 +9,9 @@ module Canonball
9
9
  attach_function :inialize_sdk, [], :int
10
10
  attach_function :terminate_sdk, [], :int
11
11
  attach_function :open_camera_session, [ :int ], :int
12
- attach_function :close_camera_session, [ :int ], :int
13
- attach_function :take_picture, [ :int ], :int
12
+ attach_function :close_camera_session, [], :int
13
+ attach_function :take_picture, [], :int
14
+ attach_function :press_shutter_button, [], :int
15
+ attach_function :press_shutter_button_non_af, [], :int
14
16
  attach_function :download_files, [ :int, :string], :int
15
17
  end
Binary file
@@ -1,3 +1,3 @@
1
1
  module Canonball
2
- VERSION = "1.2.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/src/canonball.cpp CHANGED
@@ -7,6 +7,9 @@
7
7
 
8
8
  #include "headers/canonball.h"
9
9
 
10
+ EdsCameraRef camera = NULL;
11
+ EdsCameraListRef camera_list = NULL;
12
+
10
13
  int inialize_sdk() {
11
14
  return EdsInitializeSDK();
12
15
  }
@@ -17,33 +20,37 @@ int terminate_sdk() {
17
20
 
18
21
  int open_camera_session(int camera_index) {
19
22
  EdsError error = EDS_ERR_OK;
20
- EdsCameraRef camera = NULL;
21
- EdsCameraListRef camera_list = NULL;
22
23
  if (error == EDS_ERR_OK) error = EdsGetCameraList(&camera_list);
23
24
  if (error == EDS_ERR_OK) error = EdsGetChildAtIndex(camera_list, camera_index, &camera);
24
25
  if (error == EDS_ERR_OK) error = EdsOpenSession(camera);
25
26
  return error;
26
27
  }
27
28
 
28
- int close_camera_session(int camera_index) {
29
+ int close_camera_session() {
29
30
  EdsError error = EDS_ERR_OK;
30
- EdsCameraRef camera = NULL;
31
- EdsCameraListRef camera_list = NULL;
32
- if (error == EDS_ERR_OK) error = EdsGetCameraList(&camera_list);
33
- if (error == EDS_ERR_OK) error = EdsGetChildAtIndex(camera_list, camera_index, &camera);
34
31
  if (error == EDS_ERR_OK) error = EdsCloseSession(camera);
35
32
  if (error == EDS_ERR_OK) error = EdsRelease(camera);
36
33
  if (error == EDS_ERR_OK) error = EdsRelease(camera_list);
37
34
  return error;
38
35
  }
39
36
 
40
- int take_picture(int camera_index) {
37
+ int take_picture() {
41
38
  EdsError error = EDS_ERR_OK;
42
- EdsCameraRef camera = NULL;
43
- EdsCameraListRef camera_list = NULL;
44
- if (error == EDS_ERR_OK) error = EdsGetCameraList(&camera_list);
45
- if (error == EDS_ERR_OK) error = EdsGetChildAtIndex(camera_list, camera_index, &camera);
46
- if (error == EDS_ERR_OK) error = EdsSendCommand(camera , kEdsCameraCommand_TakePicture, 0);
39
+ if (error == EDS_ERR_OK) error = EdsSendCommand(camera , kEdsCameraCommand_TakePicture, 0);
40
+ return error;
41
+ }
42
+
43
+ int press_shutter_button() {
44
+ EdsError error = EDS_ERR_OK;
45
+ if (error == EDS_ERR_OK) error = EdsSendCommand(camera , kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_Completely);
46
+ if (error == EDS_ERR_OK) error = EdsSendCommand(camera , kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_OFF);
47
+ return error;
48
+ }
49
+
50
+ int press_shutter_button_non_af() {
51
+ EdsError error = EDS_ERR_OK;
52
+ if (error == EDS_ERR_OK) error = EdsSendCommand(camera , kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_Completely_NonAF);
53
+ if (error == EDS_ERR_OK) error = EdsSendCommand(camera , kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_OFF);
47
54
  return error;
48
55
  }
49
56
 
@@ -60,10 +67,8 @@ int download_file(EdsDirectoryItemRef file_pointer, std::string folder){
60
67
  return error;
61
68
  }
62
69
 
63
- int download_files(int camera_index, const char* folder) {
70
+ int download_files(int sd_card_index, const char* folder) {
64
71
  EdsError error = EDS_ERR_OK;
65
- EdsCameraRef camera = NULL;
66
- EdsCameraListRef camera_list = NULL;
67
72
 
68
73
  EdsUInt32 folder_count = 0;
69
74
  EdsVolumeRef sd_card = NULL;
@@ -71,9 +76,7 @@ int download_files(int camera_index, const char* folder) {
71
76
  EdsDirectoryItemInfo folder_info;
72
77
 
73
78
  // Get DCIM folder
74
- if (error == EDS_ERR_OK) error = EdsGetCameraList(&camera_list);
75
- if (error == EDS_ERR_OK) error = EdsGetChildAtIndex(camera_list, camera_index, &camera);
76
- if (error == EDS_ERR_OK) error = EdsGetChildAtIndex(camera, 0, &sd_card);
79
+ if (error == EDS_ERR_OK) error = EdsGetChildAtIndex(camera, sd_card_index, &sd_card);
77
80
 
78
81
  if (error == EDS_ERR_OK) error = EdsGetChildCount( sd_card, &folder_count);
79
82
  for(int i = 0; i < folder_count; i++){
@@ -23,14 +23,22 @@ extern "C" {
23
23
  }
24
24
 
25
25
  extern "C" {
26
- int close_camera_session(int camera_index);
26
+ int close_camera_session();
27
27
  }
28
28
 
29
29
  extern "C" {
30
- int take_picture(int camera_index);
30
+ int take_picture();
31
31
  }
32
32
 
33
33
  extern "C" {
34
- int download_files(int camera_index, const char* folder);
34
+ int press_shutter_button();
35
+ }
36
+
37
+ extern "C" {
38
+ int press_shutter_button_non_af();
39
+ }
40
+
41
+ extern "C" {
42
+ int download_files(int sd_card_index, const char* folder);
35
43
  }
36
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canonball
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Christopher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler