features.h
Go to the documentation of this file.
1 /* -*- mode: C++ -*- */
2 /* $Id$ */
3 
4 /*********************************************************************
5 * Software License Agreement (BSD License)
6 *
7 * Copyright (c) 2010 Jack O'Quin
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 * * Neither the name of the author nor other contributors may be
21 * used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *********************************************************************/
37 
38 #ifndef _FEATURES_H_
39 #define _FEATURES_H_
40 
41 #include <dc1394/dc1394.h>
42 
43 #include "camera1394/Camera1394Config.h"
44 #include "trigger.h"
45 typedef camera1394::Camera1394Config Config;
46 
61 class Features
62 {
63 public:
64 
65  Features(dc1394camera_t *camera);
66  ~Features() {};
67  bool initialize(Config *newconfig);
68  void reconfigure(Config *newconfig);
69 
70  inline bool isTriggerPowered()
71  {
72  return trigger_->isPowered();
73  }
74 
75 private:
76  typedef int state_t;
77 
78  void configure(dc1394feature_t feature, int *control,
79  double *value, double *value2=NULL);
80  state_t getState(dc1394feature_info_t *finfo);
81  void getValues(dc1394feature_info_t *finfo,
82  double *value, double *value2);
83 
92  inline bool hasMode(dc1394feature_info_t *finfo, dc1394feature_mode_t mode)
93  {
94  for (uint32_t i = 0; i < finfo->modes.num; ++i)
95  {
96  if (finfo->modes.modes[i] == mode)
97  return true;
98  }
99  return false;
100  }
101 
107  inline bool hasTrigger(void)
108  {
109  return DC1394_TRUE == feature_set_.feature[DC1394_FEATURE_TRIGGER
110  - DC1394_FEATURE_MIN].available;
111  }
112 
113  // pointer to subordinate trigger class
115 
116  bool setMode(dc1394feature_info_t *finfo, dc1394feature_mode_t mode);
117  void setPower(dc1394feature_info_t *finfo, dc1394switch_t on_off);
118  void updateIfChanged(dc1394feature_t feature,
119  int old_control, int *control,
120  double old_value, double *value);
121  void updateIfChanged(dc1394feature_t feature,
122  int old_control, int *control,
123  double old_value, double *value,
124  double old_value2, double *value2);
125 
126  dc1394camera_t *camera_;
127  dc1394featureset_t feature_set_;
129 };
130 
131 #endif // _FEATURES_H_
boost::shared_ptr< Trigger > trigger_
Definition: features.h:114
void setPower(dc1394feature_info_t *finfo, dc1394switch_t on_off)
Definition: features.cpp:606
state_t getState(dc1394feature_info_t *finfo)
Definition: features.cpp:420
dc1394featureset_t feature_set_
that camera&#39;s feature set
Definition: features.h:127
dc1394camera_t * camera_
current camera
Definition: features.h:126
bool isTriggerPowered()
Definition: features.h:70
void reconfigure(Config *newconfig)
Definition: features.cpp:202
void updateIfChanged(dc1394feature_t feature, int old_control, int *control, double old_value, double *value)
Definition: features.cpp:642
bool setMode(dc1394feature_info_t *finfo, dc1394feature_mode_t mode)
Definition: features.cpp:571
void getValues(dc1394feature_info_t *finfo, double *value, double *value2)
Definition: features.cpp:481
~Features()
Definition: features.h:66
void configure(dc1394feature_t feature, int *control, double *value, double *value2=NULL)
Definition: features.cpp:280
bool initialize(Config *newconfig)
Definition: features.cpp:140
bool hasMode(dc1394feature_info_t *finfo, dc1394feature_mode_t mode)
Definition: features.h:92
camera1394::Camera1394Config Config
Definition: features.h:45
libdc1394 triggering modes interface
bool hasTrigger(void)
Definition: features.h:107
Camera1394 Features class.
Definition: features.h:61
Features(dc1394camera_t *camera)
Definition: features.cpp:125
int state_t
camera1394::Camera1394_* state values
Definition: features.h:76
Config oldconfig_
previous Config settings
Definition: features.h:128
camera1394::Camera1394Config Config
Definition: driver1394.h:53


camera1394
Author(s): Jack O'Quin, Ken Tossell, Patrick Beeson, Nate Koenig, Andrew Howard, Damien Douxchamps, Dan Dennedy
autogenerated on Mon Jun 10 2019 12:52:31