registers.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2014 Tomas Petricek
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the author nor other contributors may be
18 * used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 #include "registers.h"
36 
44 namespace camera1394
45 {
46 
47 Registers::Registers(dc1394camera_t *camera) : camera_(camera)
48 {}
49 
51 {}
52 
53 // Accessors for camera control and status registers (CSR),
54 // generally wrapping dc1394 functions.
55 
63 bool Registers::getControlRegisters(const uint64_t offset,
64  const uint32_t num_regs,
65  std::vector<uint32_t> &val)
66 {
67  int err = dc1394_get_control_registers(camera_, offset, &val[0], num_regs);
68  return (DC1394_SUCCESS == err);
69 }
76 bool Registers::setControlRegisters(const uint64_t offset,
77  const std::vector<uint32_t> &val)
78 {
79  int err = dc1394_set_control_registers(camera_, offset, &val[0], val.size());
80  return (DC1394_SUCCESS == err);
81 }
82 
84 bool Registers::getAbsoluteRegister(const uint64_t offset,
85  const uint32_t feature,
86  uint32_t &val)
87 {
88  int err = dc1394_get_absolute_register(camera_, feature, offset, &val);
89  return (DC1394_SUCCESS == err);
90 }
92 bool Registers::setAbsoluteRegister(const uint64_t offset,
93  const uint32_t feature,
94  const uint32_t val)
95 {
96  int err = dc1394_set_absolute_register(camera_, feature, offset, val);
97  return (DC1394_SUCCESS == err);
98 }
99 
101 bool Registers::getFormat7Register(const uint64_t offset,
102  const uint32_t mode,
103  uint32_t &val)
104 {
105  int err = dc1394_get_format7_register(camera_, mode, offset, &val);
106  return (DC1394_SUCCESS == err);
107 }
109 bool Registers::setFormat7Register(const uint64_t offset,
110  const uint32_t mode,
111  const uint32_t val)
112 {
113  int err = dc1394_set_format7_register(camera_, mode, offset, val);
114  return (DC1394_SUCCESS == err);
115 }
116 
118 bool Registers::getAdvancedControlRegisters(const uint64_t offset,
119  const uint32_t num_regs,
120  std::vector<uint32_t> &val)
121 {
122  int err = dc1394_get_adv_control_registers(camera_, offset, &val[0],
123  num_regs);
124  return (DC1394_SUCCESS == err);
125 }
127 bool Registers::setAdvancedControlRegisters(const uint64_t offset,
128  const std::vector<uint32_t> &val)
129 {
130  int err = dc1394_set_adv_control_registers(camera_, offset, &val[0],
131  val.size());
132  return (DC1394_SUCCESS == err);
133 }
134 
136 bool Registers::getPIORegister(const uint64_t offset, uint32_t &val)
137 {
138  int err = dc1394_get_PIO_register(camera_, offset, &val);
139  return (DC1394_SUCCESS == err);
140 }
142 bool Registers::setPIORegister(const uint64_t offset, const uint32_t val)
143 {
144  int err = dc1394_set_PIO_register(camera_, offset, val);
145  return (DC1394_SUCCESS == err);
146 }
147 
149 bool Registers::getSIORegister(const uint64_t offset, uint32_t &val)
150 {
151  int err = dc1394_get_SIO_register(camera_, offset, &val);
152  return (DC1394_SUCCESS == err);
153 }
155 bool Registers::setSIORegister(const uint64_t offset, const uint32_t val)
156 {
157  int err = dc1394_set_SIO_register(camera_, offset, val);
158  return (DC1394_SUCCESS == err);
159 }
160 
162 bool Registers::getStrobeRegister(const uint64_t offset,uint32_t &val)
163 {
164  int err = dc1394_get_strobe_register(camera_, offset, &val);
165  return (DC1394_SUCCESS == err);
166 }
168 bool Registers::setStrobeRegister(const uint64_t offset, const uint32_t val)
169 {
170  int err = dc1394_set_strobe_register(camera_, offset, val);
171  return (DC1394_SUCCESS == err);
172 }
173 
174 } // namespace
bool setSIORegister(const uint64_t offset, const uint32_t val)
Definition: registers.cpp:155
bool getAdvancedControlRegisters(const uint64_t offset, const uint32_t num_regs, std::vector< uint32_t > &val)
Definition: registers.cpp:118
IEEE 1394 camera registers interface.
dc1394camera_t * camera_
Definition: registers.h:92
bool getControlRegisters(const uint64_t offset, const uint32_t num_regs, std::vector< uint32_t > &val)
Definition: registers.cpp:63
bool setAbsoluteRegister(const uint64_t offset, const uint32_t feature, const uint32_t val)
Definition: registers.cpp:92
bool getStrobeRegister(const uint64_t offset, uint32_t &val)
Definition: registers.cpp:162
bool getAbsoluteRegister(const uint64_t offset, const uint32_t feature, uint32_t &val)
Definition: registers.cpp:84
bool setStrobeRegister(const uint64_t offset, const uint32_t val)
Definition: registers.cpp:168
bool setFormat7Register(const uint64_t offset, const uint32_t mode, const uint32_t val)
Definition: registers.cpp:109
bool setPIORegister(const uint64_t offset, const uint32_t val)
Definition: registers.cpp:142
bool getFormat7Register(const uint64_t offset, const uint32_t mode, uint32_t &val)
Definition: registers.cpp:101
bool setAdvancedControlRegisters(const uint64_t offset, const std::vector< uint32_t > &val)
Definition: registers.cpp:127
bool getPIORegister(const uint64_t offset, uint32_t &val)
Definition: registers.cpp:136
bool setControlRegisters(const uint64_t offset, const std::vector< uint32_t > &val)
Definition: registers.cpp:76
bool getSIORegister(const uint64_t offset, uint32_t &val)
Definition: registers.cpp:149


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