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 +4 -4
- data/lib/canonball.rb +4 -2
- data/lib/canonball/canonball.so +0 -0
- data/lib/canonball/version.rb +1 -1
- data/src/canonball.cpp +22 -19
- data/src/headers/canonball.h +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46dff7b0f15b03afe400f1d26b85f97764ffbfc7
|
4
|
+
data.tar.gz: 8be9475a5453bb67d48a913ac3a27578ff2fd4b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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, [
|
13
|
-
attach_function :take_picture, [
|
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
|
data/lib/canonball/canonball.so
CHANGED
Binary file
|
data/lib/canonball/version.rb
CHANGED
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(
|
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(
|
37
|
+
int take_picture() {
|
41
38
|
EdsError error = EDS_ERR_OK;
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
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 =
|
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++){
|
data/src/headers/canonball.h
CHANGED
@@ -23,14 +23,22 @@ extern "C" {
|
|
23
23
|
}
|
24
24
|
|
25
25
|
extern "C" {
|
26
|
-
int close_camera_session(
|
26
|
+
int close_camera_session();
|
27
27
|
}
|
28
28
|
|
29
29
|
extern "C" {
|
30
|
-
int take_picture(
|
30
|
+
int take_picture();
|
31
31
|
}
|
32
32
|
|
33
33
|
extern "C" {
|
34
|
-
|
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:
|
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:
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|