gphoto4ruby 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +4 -0
- data/ext/gphoto2camera.c +50 -2
- data/ext/gphoto2camera.h +1 -1
- data/ext/gphoto4ruby.c +1 -1
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
data/ext/gphoto2camera.c
CHANGED
@@ -421,8 +421,10 @@ VALUE camera_delete(int argc, VALUE *argv, VALUE self) {
|
|
421
421
|
/*
|
422
422
|
* call-seq:
|
423
423
|
* config => hash
|
424
|
+
* config :no_cache => hash
|
424
425
|
*
|
425
426
|
* Returns cached hash of adjustable camera configuration with their values.
|
427
|
+
* Can be run with directive <b>:no_cache</b>
|
426
428
|
*
|
427
429
|
* Examples:
|
428
430
|
*
|
@@ -440,8 +442,54 @@ VALUE camera_delete(int argc, VALUE *argv, VALUE self) {
|
|
440
442
|
* "channel", "encryption"]
|
441
443
|
*
|
442
444
|
*/
|
443
|
-
VALUE camera_get_config(VALUE self) {
|
444
|
-
|
445
|
+
VALUE camera_get_config(int argc, VALUE *argv, VALUE self) {
|
446
|
+
int i;
|
447
|
+
const char *key;
|
448
|
+
GPhoto2Camera *c;
|
449
|
+
CameraWidgetType widgettype;
|
450
|
+
VALUE arr, cfg;
|
451
|
+
|
452
|
+
cfg = rb_iv_get(self, "@configuration");
|
453
|
+
|
454
|
+
switch (argc) {
|
455
|
+
case 1:
|
456
|
+
Check_Type(argv[0], T_SYMBOL);
|
457
|
+
Data_Get_Struct(self, GPhoto2Camera, c);
|
458
|
+
|
459
|
+
if (strcmp(rb_id2name(rb_to_id(argv[0])), "no_cache") == 0) {
|
460
|
+
gp_result_check(gp_camera_get_config(c->camera, &(c->config), c->context));
|
461
|
+
arr = rb_funcall(cfg, rb_intern("keys"), 0);
|
462
|
+
for (i = 0; i < RARRAY(arr)->len; i++) {
|
463
|
+
key = RSTRING(RARRAY(arr)->ptr[i])->ptr;
|
464
|
+
gp_result_check(gp_widget_get_child_by_name(c->config, key, &(c->childConfig)));
|
465
|
+
gp_result_check(gp_widget_get_type(c->childConfig, &widgettype));
|
466
|
+
switch (widgettype) {
|
467
|
+
case GP_WIDGET_RADIO:
|
468
|
+
rb_hash_aset(cfg, RARRAY(arr)->ptr[i], getRadio(c->childConfig));
|
469
|
+
break;
|
470
|
+
case GP_WIDGET_TEXT:
|
471
|
+
rb_hash_aset(cfg, RARRAY(arr)->ptr[i], getText(c->childConfig));
|
472
|
+
break;
|
473
|
+
case GP_WIDGET_RANGE:
|
474
|
+
rb_hash_aset(cfg, RARRAY(arr)->ptr[i], getRange(c->childConfig));
|
475
|
+
break;
|
476
|
+
case GP_WIDGET_TOGGLE:
|
477
|
+
rb_hash_aset(cfg, RARRAY(arr)->ptr[i], getToggle(c->childConfig));
|
478
|
+
break;
|
479
|
+
default:
|
480
|
+
break;
|
481
|
+
}
|
482
|
+
}
|
483
|
+
} else {
|
484
|
+
rb_raise(rb_cGPhoto2ConfigurationError, "Unknown directive '%s'", rb_id2name(rb_to_id(argv[0])));
|
485
|
+
return Qnil;
|
486
|
+
}
|
487
|
+
case 0:
|
488
|
+
return cfg;
|
489
|
+
default:
|
490
|
+
rb_raise(rb_eArgError, "Wrong number of arguments (%d for 0 or 1)", argc);
|
491
|
+
return Qnil;
|
492
|
+
}
|
445
493
|
}
|
446
494
|
|
447
495
|
/*
|
data/ext/gphoto2camera.h
CHANGED
@@ -49,7 +49,7 @@ VALUE camera_capture(int argc, VALUE *argv, VALUE self);
|
|
49
49
|
VALUE camera_save(int argc, VALUE *argv, VALUE self);
|
50
50
|
VALUE camera_delete(int argc, VALUE *argv, VALUE self);
|
51
51
|
|
52
|
-
VALUE camera_get_config(VALUE self);
|
52
|
+
VALUE camera_get_config(int argc, VALUE *argv, VALUE self);
|
53
53
|
VALUE camera_config_merge(VALUE self, VALUE hash);
|
54
54
|
|
55
55
|
VALUE camera_get_value(int argc, VALUE *argv, VALUE self);
|
data/ext/gphoto4ruby.c
CHANGED
@@ -70,7 +70,7 @@ void Init_gphoto4ruby() {
|
|
70
70
|
rb_define_alloc_func(rb_cGPhoto2Camera, camera_allocate);
|
71
71
|
rb_define_module_function(rb_cGPhoto2Camera, "ports", camera_class_ports, 0); /* in gphoto2camera.c */
|
72
72
|
rb_define_method(rb_cGPhoto2Camera, "initialize", camera_initialize, -1); /* in gphoto2camera.c */
|
73
|
-
rb_define_method(rb_cGPhoto2Camera, "config", camera_get_config,
|
73
|
+
rb_define_method(rb_cGPhoto2Camera, "config", camera_get_config, -1); /* in gphoto2camera.c */
|
74
74
|
rb_define_method(rb_cGPhoto2Camera, "config_merge", camera_config_merge, 1); /* in gphoto2camera.c */
|
75
75
|
rb_define_method(rb_cGPhoto2Camera, "[]", camera_get_value, -1); /* in gphoto2camera.c */
|
76
76
|
rb_define_method(rb_cGPhoto2Camera, "[]=", camera_set_value, 2); /* in gphoto2camera.c */
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gphoto4ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- heq4 company
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-10-
|
13
|
+
date: 2008-10-10 00:00:00 +04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|