hornetseye-dc1394 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/ext/dc1394input.cc +379 -10
  3. data/ext/dc1394input.hh +25 -0
  4. metadata +2 -2
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
7
7
  require 'rbconfig'
8
8
 
9
9
  PKG_NAME = 'hornetseye-dc1394'
10
- PKG_VERSION = '0.1.0'
10
+ PKG_VERSION = '0.2.0'
11
11
  CXX = ENV[ 'CXX' ] || 'g++'
12
12
  STRIP = ENV[ 'STRIP' ] || 'strip'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
data/ext/dc1394input.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /* HornetsEye - Computer Vision with Ruby
2
- Copyright (C) 2006, 2007, 2008, 2009 Jan Wedekind
2
+ Copyright (C) 2006, 2007, 2008, 2009, 2010 Jan Wedekind
3
3
 
4
4
  This program is free software: you can redistribute it and/or modify
5
5
  it under the terms of the GNU General Public License as published by
@@ -150,6 +150,11 @@ FramePtr DC1394Input::read(void) throw (Error)
150
150
  (char *)m_frame->image ) );
151
151
  }
152
152
 
153
+ bool DC1394Input::status(void) const
154
+ {
155
+ return m_camera != NULL;
156
+ }
157
+
153
158
  string DC1394Input::inspect(void) const
154
159
  {
155
160
  ostringstream s;
@@ -157,9 +162,136 @@ string DC1394Input::inspect(void) const
157
162
  return s.str();
158
163
  }
159
164
 
160
- bool DC1394Input::status(void) const
165
+ unsigned int DC1394Input::featureGetValue( dc1394feature_t feature ) throw (Error)
161
166
  {
162
- return m_camera != NULL;
167
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
168
+ "call \"close\" before?" );
169
+ uint32_t value;
170
+ dc1394error_t err = dc1394_feature_get_value( m_camera, feature, &value );
171
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error reading feature value: "
172
+ << dc1394_error_get_string( err ) );
173
+ return value;
174
+ }
175
+
176
+ void DC1394Input::featureSetValue( dc1394feature_t feature, unsigned int value ) throw (Error)
177
+ {
178
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
179
+ "call \"close\" before?" );
180
+ dc1394error_t err = dc1394_feature_set_value( m_camera, feature, value );
181
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error writing feature value: "
182
+ << dc1394_error_get_string( err ) );
183
+ }
184
+
185
+ bool DC1394Input::featureIsPresent( dc1394feature_t feature ) throw (Error)
186
+ {
187
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
188
+ "call \"close\" before?" );
189
+ dc1394bool_t value;
190
+ dc1394error_t err = dc1394_feature_is_present( m_camera, feature, &value );
191
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error checking presence of feature: "
192
+ << dc1394_error_get_string( err ) );
193
+ return value != DC1394_FALSE;
194
+ }
195
+
196
+ bool DC1394Input::featureIsReadable( dc1394feature_t feature ) throw (Error)
197
+ {
198
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
199
+ "call \"close\" before?" );
200
+ dc1394bool_t value;
201
+ dc1394error_t err = dc1394_feature_is_readable( m_camera, feature, &value );
202
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error checking whether feature is "
203
+ "readable: " << dc1394_error_get_string( err ) );
204
+ return value != DC1394_FALSE;
205
+ }
206
+
207
+ bool DC1394Input::featureIsSwitchable( dc1394feature_t feature ) throw (Error)
208
+ {
209
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
210
+ "call \"close\" before?" );
211
+ dc1394bool_t value;
212
+ dc1394error_t err = dc1394_feature_is_switchable( m_camera, feature, &value );
213
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error checking whether feature is "
214
+ "switchable: " << dc1394_error_get_string( err ) );
215
+ return value != DC1394_FALSE;
216
+ }
217
+
218
+ dc1394switch_t DC1394Input::featureGetPower( dc1394feature_t feature ) throw (Error)
219
+ {
220
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
221
+ "call \"close\" before?" );
222
+ dc1394switch_t value;
223
+ dc1394error_t err = dc1394_feature_get_power( m_camera, feature, &value );
224
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error checking power status of "
225
+ "feature: " << dc1394_error_get_string( err ) );
226
+ return value;
227
+ }
228
+
229
+ void DC1394Input::featureSetPower( dc1394feature_t feature, dc1394switch_t value )
230
+ throw (Error)
231
+ {
232
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
233
+ "call \"close\" before?" );
234
+ dc1394error_t err = dc1394_feature_set_power( m_camera, feature, value );
235
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error setting power status of "
236
+ "feature: " << dc1394_error_get_string( err ) );
237
+ }
238
+
239
+ dc1394feature_modes_t DC1394Input::featureModes( dc1394feature_t feature )
240
+ throw (Error)
241
+ {
242
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
243
+ "call \"close\" before?" );
244
+ dc1394feature_modes_t value;
245
+ dc1394error_t err = dc1394_feature_get_modes( m_camera, feature, &value );
246
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error querying list of control modes "
247
+ "for a feature: " << dc1394_error_get_string( err ) );
248
+ return value;
249
+ }
250
+
251
+ dc1394feature_mode_t DC1394Input::featureModeGet( dc1394feature_t feature )
252
+ throw (Error)
253
+ {
254
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
255
+ "call \"close\" before?" );
256
+ dc1394feature_mode_t value;
257
+ dc1394error_t err = dc1394_feature_get_mode( m_camera, feature, &value );
258
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error querying current mode of "
259
+ "feature: " << dc1394_error_get_string( err ) );
260
+ return value;
261
+ }
262
+
263
+ void DC1394Input::featureModeSet( dc1394feature_t feature, dc1394feature_mode_t mode )
264
+ throw (Error)
265
+ {
266
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
267
+ "call \"close\" before?" );
268
+ dc1394error_t err = dc1394_feature_set_mode( m_camera, feature, mode );
269
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error setting mode of feature: "
270
+ << dc1394_error_get_string( err ) );
271
+ }
272
+
273
+ unsigned int DC1394Input::featureMin( dc1394feature_t feature ) throw (Error)
274
+ {
275
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
276
+ "call \"close\" before?" );
277
+ dc1394feature_info_t info;
278
+ info.id = feature;
279
+ dc1394error_t err = dc1394_feature_get( m_camera, &info );
280
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error querying minimum value of "
281
+ "feature: " << dc1394_error_get_string( err ) );
282
+ return info.min;
283
+ }
284
+
285
+ unsigned int DC1394Input::featureMax( dc1394feature_t feature ) throw (Error)
286
+ {
287
+ ERRORMACRO( m_camera != NULL, Error, , "Camera device not open any more. Did you "
288
+ "call \"close\" before?" );
289
+ dc1394feature_info_t info;
290
+ info.id = feature;
291
+ dc1394error_t err = dc1394_feature_get( m_camera, &info );
292
+ ERRORMACRO( err == DC1394_SUCCESS, Error, , "Error querying minimum value of "
293
+ "feature: " << dc1394_error_get_string( err ) );
294
+ return info.max;
163
295
  }
164
296
 
165
297
  VALUE DC1394Input::registerRubyClass( VALUE module )
@@ -190,10 +322,88 @@ VALUE DC1394Input::registerRubyClass( VALUE module )
190
322
  rb_define_const( cRubyClass, "FRAMERATE_60" , INT2NUM( DC1394_FRAMERATE_60 ) );
191
323
  rb_define_const( cRubyClass, "FRAMERATE_120" , INT2NUM( DC1394_FRAMERATE_120 ) );
192
324
  rb_define_const( cRubyClass, "FRAMERATE_240" , INT2NUM( DC1394_FRAMERATE_240 ) );
325
+ rb_define_const( cRubyClass, "FEATURE_MIN",
326
+ INT2NUM( DC1394_FEATURE_MIN ) );
327
+ rb_define_const( cRubyClass, "FEATURE_BRIGHTNESS",
328
+ INT2NUM( DC1394_FEATURE_BRIGHTNESS ) );
329
+ rb_define_const( cRubyClass, "FEATURE_EXPOSURE",
330
+ INT2NUM( DC1394_FEATURE_EXPOSURE ) );
331
+ rb_define_const( cRubyClass, "FEATURE_SHARPNESS",
332
+ INT2NUM( DC1394_FEATURE_SHARPNESS ) );
333
+ rb_define_const( cRubyClass, "FEATURE_WHITE_BALANCE",
334
+ INT2NUM( DC1394_FEATURE_WHITE_BALANCE ) );
335
+ rb_define_const( cRubyClass, "FEATURE_HUE",
336
+ INT2NUM( DC1394_FEATURE_HUE ) );
337
+ rb_define_const( cRubyClass, "FEATURE_SATURATION",
338
+ INT2NUM( DC1394_FEATURE_SATURATION ) );
339
+ rb_define_const( cRubyClass, "FEATURE_GAMMA",
340
+ INT2NUM( DC1394_FEATURE_GAMMA ) );
341
+ rb_define_const( cRubyClass, "FEATURE_SHUTTER",
342
+ INT2NUM( DC1394_FEATURE_SHUTTER ) );
343
+ rb_define_const( cRubyClass, "FEATURE_GAIN",
344
+ INT2NUM( DC1394_FEATURE_GAIN ) );
345
+ rb_define_const( cRubyClass, "FEATURE_IRIS",
346
+ INT2NUM( DC1394_FEATURE_IRIS ) );
347
+ rb_define_const( cRubyClass, "FEATURE_FOCUS",
348
+ INT2NUM( DC1394_FEATURE_FOCUS ) );
349
+ rb_define_const( cRubyClass, "FEATURE_TEMPERATURE",
350
+ INT2NUM( DC1394_FEATURE_TEMPERATURE ) );
351
+ rb_define_const( cRubyClass, "FEATURE_TRIGGER",
352
+ INT2NUM( DC1394_FEATURE_TRIGGER ) );
353
+ rb_define_const( cRubyClass, "FEATURE_TRIGGER_DELAY",
354
+ INT2NUM( DC1394_FEATURE_TRIGGER_DELAY ) );
355
+ rb_define_const( cRubyClass, "FEATURE_WHITE_SHADING",
356
+ INT2NUM( DC1394_FEATURE_WHITE_SHADING ) );
357
+ rb_define_const( cRubyClass, "FEATURE_FRAME_RATE",
358
+ INT2NUM( DC1394_FEATURE_FRAME_RATE ) );
359
+ rb_define_const( cRubyClass, "FEATURE_ZOOM",
360
+ INT2NUM( DC1394_FEATURE_ZOOM ) );
361
+ rb_define_const( cRubyClass, "FEATURE_PAN",
362
+ INT2NUM( DC1394_FEATURE_PAN ) );
363
+ rb_define_const( cRubyClass, "FEATURE_TILT",
364
+ INT2NUM( DC1394_FEATURE_TILT ) );
365
+ rb_define_const( cRubyClass, "FEATURE_OPTICAL_FILTER",
366
+ INT2NUM( DC1394_FEATURE_OPTICAL_FILTER ) );
367
+ rb_define_const( cRubyClass, "FEATURE_CAPTURE_SIZE",
368
+ INT2NUM( DC1394_FEATURE_CAPTURE_SIZE ) );
369
+ rb_define_const( cRubyClass, "FEATURE_CAPTURE_QUALITY",
370
+ INT2NUM( DC1394_FEATURE_CAPTURE_QUALITY ) );
371
+ rb_define_const( cRubyClass, "FEATURE_MAX",
372
+ INT2NUM( DC1394_FEATURE_MAX ) );
373
+ rb_define_const( cRubyClass, "FEATURE_MODE_MANUAL",
374
+ INT2NUM( DC1394_FEATURE_MODE_MANUAL ) );
375
+ rb_define_const( cRubyClass, "FEATURE_MODE_AUTO",
376
+ INT2NUM( DC1394_FEATURE_MODE_AUTO ) );
377
+ rb_define_const( cRubyClass, "FEATURE_MODE_ONE_PUSH_AUTO",
378
+ INT2NUM( DC1394_FEATURE_MODE_ONE_PUSH_AUTO ) );
193
379
  rb_define_singleton_method( cRubyClass, "new", RUBY_METHOD_FUNC( wrapNew ), 5 );
194
380
  rb_define_method( cRubyClass, "close", RUBY_METHOD_FUNC( wrapClose ), 0 );
195
381
  rb_define_method( cRubyClass, "read", RUBY_METHOD_FUNC( wrapRead ), 0 );
196
382
  rb_define_method( cRubyClass, "status?", RUBY_METHOD_FUNC( wrapStatus ), 0 );
383
+ rb_define_method( cRubyClass, "feature_read",
384
+ RUBY_METHOD_FUNC( wrapFeatureGetValue ), 1 );
385
+ rb_define_method( cRubyClass, "feature_write",
386
+ RUBY_METHOD_FUNC( wrapFeatureSetValue ), 2 );
387
+ rb_define_method( cRubyClass, "feature_exist?",
388
+ RUBY_METHOD_FUNC( wrapFeatureIsPresent ), 1 );
389
+ rb_define_method( cRubyClass, "feature_readable?",
390
+ RUBY_METHOD_FUNC( wrapFeatureIsReadable ), 1 );
391
+ rb_define_method( cRubyClass, "feature_switchable?",
392
+ RUBY_METHOD_FUNC( wrapFeatureIsSwitchable ), 1 );
393
+ rb_define_method( cRubyClass, "feature_on?",
394
+ RUBY_METHOD_FUNC( wrapFeatureGetPower ), 1 );
395
+ rb_define_method( cRubyClass, "feature_on",
396
+ RUBY_METHOD_FUNC( wrapFeatureSetPower ), 2 );
397
+ rb_define_method( cRubyClass, "feature_modes",
398
+ RUBY_METHOD_FUNC( wrapFeatureModes ), 1 );
399
+ rb_define_method( cRubyClass, "feature_mode_read",
400
+ RUBY_METHOD_FUNC( wrapFeatureModeGet ), 1 );
401
+ rb_define_method( cRubyClass, "feature_mode_write",
402
+ RUBY_METHOD_FUNC( wrapFeatureModeSet ), 2 );
403
+ rb_define_method( cRubyClass, "feature_min",
404
+ RUBY_METHOD_FUNC( wrapFeatureMin ), 1 );
405
+ rb_define_method( cRubyClass, "feature_max",
406
+ RUBY_METHOD_FUNC( wrapFeatureMax ), 1 );
197
407
  return cRubyClass;
198
408
  }
199
409
 
@@ -205,7 +415,7 @@ void DC1394Input::deleteRubyObject( void *ptr )
205
415
  VALUE DC1394Input::wrapNew( VALUE rbClass, VALUE rbDC1394, VALUE rbNode,
206
416
  VALUE rbSpeed, VALUE rbForceFrameRate, VALUE rbFrameRate )
207
417
  {
208
- VALUE retVal = Qnil;
418
+ VALUE rbRetVal = Qnil;
209
419
  try {
210
420
  DC1394Ptr *dc1394; Data_Get_Struct( rbDC1394, DC1394Ptr, dc1394 );
211
421
  DC1394SelectPtr select( new DC1394Select );
@@ -213,12 +423,12 @@ VALUE DC1394Input::wrapNew( VALUE rbClass, VALUE rbDC1394, VALUE rbNode,
213
423
  (dc1394speed_t)NUM2INT( rbSpeed ),
214
424
  select, rbForceFrameRate != Qfalse,
215
425
  (dc1394framerate_t)NUM2INT( rbFrameRate ) ) );
216
- retVal = Data_Wrap_Struct( rbClass, 0, deleteRubyObject,
217
- new DC1394InputPtr( ptr ) );
426
+ rbRetVal = Data_Wrap_Struct( rbClass, 0, deleteRubyObject,
427
+ new DC1394InputPtr( ptr ) );
218
428
  } catch ( std::exception &e ) {
219
429
  rb_raise( rb_eRuntimeError, "%s", e.what() );
220
430
  };
221
- return retVal;
431
+ return rbRetVal;
222
432
  }
223
433
 
224
434
  VALUE DC1394Input::wrapClose( VALUE rbSelf )
@@ -230,15 +440,15 @@ VALUE DC1394Input::wrapClose( VALUE rbSelf )
230
440
 
231
441
  VALUE DC1394Input::wrapRead( VALUE rbSelf )
232
442
  {
233
- VALUE retVal = Qnil;
443
+ VALUE rbRetVal = Qnil;
234
444
  try {
235
445
  DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
236
446
  FramePtr frame( (*self)->read() );
237
- retVal = frame->rubyObject();
447
+ rbRetVal = frame->rubyObject();
238
448
  } catch ( std::exception &e ) {
239
449
  rb_raise( rb_eRuntimeError, "%s", e.what() );
240
450
  };
241
- return retVal;
451
+ return rbRetVal;
242
452
  }
243
453
 
244
454
  VALUE DC1394Input::wrapStatus( VALUE rbSelf )
@@ -247,3 +457,162 @@ VALUE DC1394Input::wrapStatus( VALUE rbSelf )
247
457
  return (*self)->status() ? Qtrue : Qfalse;
248
458
  }
249
459
 
460
+ VALUE DC1394Input::wrapFeatureGetValue( VALUE rbSelf, VALUE rbFeature )
461
+ {
462
+ VALUE rbRetVal = Qnil;
463
+ try {
464
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
465
+ rbRetVal = UINT2NUM( (*self)->
466
+ featureGetValue( (dc1394feature_t)NUM2INT( rbFeature ) ) );
467
+ } catch ( std::exception &e ) {
468
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
469
+ };
470
+ return rbRetVal;
471
+ }
472
+
473
+ VALUE DC1394Input::wrapFeatureSetValue( VALUE rbSelf, VALUE rbFeature, VALUE rbValue )
474
+ {
475
+ try {
476
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
477
+ (*self)->featureSetValue( (dc1394feature_t)NUM2INT( rbFeature ),
478
+ NUM2UINT( rbValue ) );
479
+ } catch ( std::exception &e ) {
480
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
481
+ };
482
+ return rbValue;
483
+ }
484
+
485
+ VALUE DC1394Input::wrapFeatureIsPresent( VALUE rbSelf, VALUE rbFeature )
486
+ {
487
+ VALUE rbRetVal = Qnil;
488
+ try {
489
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
490
+ bool retVal = (*self)->featureIsPresent( (dc1394feature_t)NUM2INT( rbFeature ) );
491
+ rbRetVal = retVal ? Qtrue : Qfalse;
492
+ } catch ( std::exception &e ) {
493
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
494
+ };
495
+ return rbRetVal;
496
+ }
497
+
498
+ VALUE DC1394Input::wrapFeatureIsReadable( VALUE rbSelf, VALUE rbFeature )
499
+ {
500
+ VALUE rbRetVal = Qnil;
501
+ try {
502
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
503
+ bool retVal = (*self)->featureIsReadable( (dc1394feature_t)NUM2INT( rbFeature ) );
504
+ rbRetVal = retVal ? Qtrue : Qfalse;
505
+ } catch ( std::exception &e ) {
506
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
507
+ };
508
+ return rbRetVal;
509
+ }
510
+
511
+ VALUE DC1394Input::wrapFeatureIsSwitchable( VALUE rbSelf, VALUE rbFeature )
512
+ {
513
+ VALUE rbRetVal = Qnil;
514
+ try {
515
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
516
+ bool retVal = (*self)->
517
+ featureIsSwitchable( (dc1394feature_t)NUM2INT( rbFeature ) );
518
+ rbRetVal = retVal ? Qtrue : Qfalse;
519
+ } catch ( std::exception &e ) {
520
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
521
+ };
522
+ return rbRetVal;
523
+ }
524
+
525
+ VALUE DC1394Input::wrapFeatureGetPower( VALUE rbSelf, VALUE rbFeature )
526
+ {
527
+ VALUE rbRetVal = Qnil;
528
+ try {
529
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
530
+ dc1394switch_t retVal = (*self)->
531
+ featureGetPower( (dc1394feature_t)NUM2INT( rbFeature ) );
532
+ rbRetVal = retVal != DC1394_OFF ? Qtrue : Qfalse;
533
+ } catch ( std::exception &e ) {
534
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
535
+ };
536
+ return rbRetVal;
537
+ }
538
+
539
+ VALUE DC1394Input::wrapFeatureSetPower( VALUE rbSelf, VALUE rbFeature, VALUE rbValue )
540
+ {
541
+ try {
542
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
543
+ (*self)->featureSetPower( (dc1394feature_t)NUM2INT( rbFeature ),
544
+ rbValue == Qtrue ? DC1394_ON : DC1394_OFF );
545
+ } catch ( std::exception &e ) {
546
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
547
+ };
548
+ return rbValue;
549
+ }
550
+
551
+ VALUE DC1394Input::wrapFeatureModes( VALUE rbSelf, VALUE rbFeature )
552
+ {
553
+ VALUE rbRetVal = Qnil;
554
+ try {
555
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
556
+ dc1394feature_modes_t retVal = (*self)->
557
+ featureModes( (dc1394feature_t)NUM2INT( rbFeature ) );
558
+ rbRetVal = rb_ary_new();
559
+ for ( int i=0; i<retVal.num; i++ )
560
+ rb_ary_push( rbRetVal, INT2NUM( retVal.modes[i] ) );
561
+ } catch ( std::exception &e ) {
562
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
563
+ };
564
+ return rbRetVal;
565
+ }
566
+
567
+ VALUE DC1394Input::wrapFeatureModeGet( VALUE rbSelf, VALUE rbFeature )
568
+ {
569
+ VALUE rbRetVal = Qnil;
570
+ try {
571
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
572
+ rbRetVal = UINT2NUM( (*self)->
573
+ featureModeGet( (dc1394feature_t)NUM2INT( rbFeature ) ) );
574
+ } catch ( std::exception &e ) {
575
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
576
+ };
577
+ return rbRetVal;
578
+ }
579
+
580
+ VALUE DC1394Input::wrapFeatureModeSet( VALUE rbSelf, VALUE rbFeature, VALUE rbMode )
581
+ {
582
+ try {
583
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
584
+ (*self)->featureModeSet( (dc1394feature_t)NUM2INT( rbFeature ),
585
+ (dc1394feature_mode_t)NUM2UINT( rbMode ) );
586
+ } catch ( std::exception &e ) {
587
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
588
+ };
589
+ return rbMode;
590
+ }
591
+
592
+ VALUE DC1394Input::wrapFeatureMin( VALUE rbSelf, VALUE rbFeature )
593
+ {
594
+ VALUE rbRetVal = Qnil;
595
+ try {
596
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
597
+ rbRetVal = UINT2NUM( (*self)->
598
+ featureMin( (dc1394feature_t)NUM2INT( rbFeature ) ) );
599
+ } catch ( std::exception &e ) {
600
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
601
+ };
602
+ return rbRetVal;
603
+ }
604
+
605
+ VALUE DC1394Input::wrapFeatureMax( VALUE rbSelf, VALUE rbFeature )
606
+ {
607
+ VALUE rbRetVal = Qnil;
608
+ try {
609
+ DC1394InputPtr *self; Data_Get_Struct( rbSelf, DC1394InputPtr, self );
610
+ rbRetVal = UINT2NUM( (*self)->
611
+ featureMax( (dc1394feature_t)NUM2INT( rbFeature ) ) );
612
+ } catch ( std::exception &e ) {
613
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
614
+ };
615
+ return rbRetVal;
616
+ }
617
+
618
+
data/ext/dc1394input.hh CHANGED
@@ -33,6 +33,19 @@ public:
33
33
  FramePtr read(void) throw (Error);
34
34
  bool status(void) const;
35
35
  std::string inspect(void) const;
36
+ unsigned int featureGetValue( dc1394feature_t feature ) throw (Error);
37
+ void featureSetValue( dc1394feature_t feature, unsigned int value ) throw (Error);
38
+ bool featureIsPresent( dc1394feature_t feature ) throw (Error);
39
+ bool featureIsReadable( dc1394feature_t feature ) throw (Error);
40
+ bool featureIsSwitchable( dc1394feature_t feature ) throw (Error);
41
+ dc1394switch_t featureGetPower( dc1394feature_t feature ) throw (Error);
42
+ void featureSetPower( dc1394feature_t feature, dc1394switch_t value ) throw (Error);
43
+ dc1394feature_modes_t featureModes( dc1394feature_t feature ) throw (Error);
44
+ dc1394feature_mode_t featureModeGet( dc1394feature_t feature ) throw (Error);
45
+ void featureModeSet( dc1394feature_t feature, dc1394feature_mode_t mode )
46
+ throw (Error);
47
+ unsigned int featureMin( dc1394feature_t feature ) throw (Error);
48
+ unsigned int featureMax( dc1394feature_t feature ) throw (Error);
36
49
  static VALUE cRubyClass;
37
50
  static VALUE registerRubyClass( VALUE module );
38
51
  static void deleteRubyObject( void *ptr );
@@ -41,6 +54,18 @@ public:
41
54
  static VALUE wrapClose( VALUE rbSelf );
42
55
  static VALUE wrapRead( VALUE rbSelf );
43
56
  static VALUE wrapStatus( VALUE rbSelf );
57
+ static VALUE wrapFeatureGetValue( VALUE rbSelf, VALUE rbFeature );
58
+ static VALUE wrapFeatureSetValue( VALUE rbSelf, VALUE rbFeature, VALUE rbValue );
59
+ static VALUE wrapFeatureIsPresent( VALUE rbSelf, VALUE rbFeature );
60
+ static VALUE wrapFeatureIsReadable( VALUE rbSelf, VALUE rbFeature );
61
+ static VALUE wrapFeatureIsSwitchable( VALUE rbSelf, VALUE rbFeature );
62
+ static VALUE wrapFeatureGetPower( VALUE rbSelf, VALUE rbFeature );
63
+ static VALUE wrapFeatureSetPower( VALUE rbSelf, VALUE rbFeature, VALUE rbValue );
64
+ static VALUE wrapFeatureModes( VALUE rbSelf, VALUE rbFeature );
65
+ static VALUE wrapFeatureModeGet( VALUE rbSelf, VALUE rbFeature );
66
+ static VALUE wrapFeatureModeSet( VALUE rbSelf, VALUE rbFeature, VALUE rbMode );
67
+ static VALUE wrapFeatureMin( VALUE rbSelf, VALUE rbFeature );
68
+ static VALUE wrapFeatureMax( VALUE rbSelf, VALUE rbFeature );
44
69
  protected:
45
70
  DC1394Ptr m_dc1394;
46
71
  int m_node;
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Wedekind