registers.cpp
Go to the documentation of this file.
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 *
00004 *  Copyright (c) 2014 Tomas Petricek
00005 *  All rights reserved.
00006 *
00007 *  Redistribution and use in source and binary forms, with or without
00008 *  modification, are permitted provided that the following conditions
00009 *  are met:
00010 *
00011 *   * Redistributions of source code must retain the above copyright
00012 *     notice, this list of conditions and the following disclaimer.
00013 *   * Redistributions in binary form must reproduce the above
00014 *     copyright notice, this list of conditions and the following
00015 *     disclaimer in the documentation and/or other materials provided
00016 *     with the distribution.
00017 *   * Neither the name of the author nor other contributors may be
00018 *     used to endorse or promote products derived from this software
00019 *     without specific prior written permission.
00020 *
00021 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032 *  POSSIBILITY OF SUCH DAMAGE.
00033 *********************************************************************/
00034 
00035 #include "registers.h"
00036 
00044 namespace camera1394
00045 {
00046 
00047 Registers::Registers(dc1394camera_t *camera) : camera_(camera)
00048 {}
00049 
00050 Registers::Registers() : camera_(NULL)
00051 {}
00052 
00053 // Accessors for camera control and status registers (CSR),
00054 // generally wrapping dc1394 functions.
00055 
00063 bool Registers::getControlRegisters(const uint64_t offset,
00064                                     const uint32_t num_regs,
00065                                     std::vector<uint32_t> &val)
00066 {
00067   int err = dc1394_get_control_registers(camera_, offset, &val[0], num_regs);
00068   return (DC1394_SUCCESS == err);
00069 }
00076 bool Registers::setControlRegisters(const uint64_t offset,
00077                                     const std::vector<uint32_t> &val)
00078 {
00079   int err = dc1394_set_control_registers(camera_, offset, &val[0], val.size());
00080   return (DC1394_SUCCESS == err);
00081 }
00082 
00084 bool Registers::getAbsoluteRegister(const uint64_t offset,
00085                                     const uint32_t feature,
00086                                     uint32_t &val)
00087 {
00088   int err = dc1394_get_absolute_register(camera_, feature, offset, &val);
00089   return (DC1394_SUCCESS == err);
00090 }
00092 bool Registers::setAbsoluteRegister(const uint64_t offset,
00093                                     const uint32_t feature,
00094                                     const uint32_t val)
00095 {
00096   int err = dc1394_set_absolute_register(camera_, feature, offset, val);
00097   return (DC1394_SUCCESS == err);
00098 }
00099 
00101 bool Registers::getFormat7Register(const uint64_t offset,
00102                                    const uint32_t mode,
00103                                    uint32_t &val)
00104 {
00105   int err = dc1394_get_format7_register(camera_, mode, offset, &val);
00106   return (DC1394_SUCCESS == err);
00107 }
00109 bool Registers::setFormat7Register(const uint64_t offset,
00110                                    const uint32_t mode,
00111                                    const uint32_t val)
00112 {
00113   int err = dc1394_set_format7_register(camera_, mode, offset, val);
00114   return (DC1394_SUCCESS == err);
00115 }
00116 
00118 bool Registers::getAdvancedControlRegisters(const uint64_t offset,
00119                                             const uint32_t num_regs,
00120                                             std::vector<uint32_t> &val)
00121 {
00122   int err = dc1394_get_adv_control_registers(camera_, offset, &val[0],
00123                                              num_regs);
00124   return (DC1394_SUCCESS == err);
00125 }
00127 bool Registers::setAdvancedControlRegisters(const uint64_t offset,
00128                                             const std::vector<uint32_t> &val)
00129 {
00130   int err = dc1394_set_adv_control_registers(camera_, offset, &val[0],
00131                                              val.size());
00132   return (DC1394_SUCCESS == err);
00133 }
00134 
00136 bool Registers::getPIORegister(const uint64_t offset, uint32_t &val)
00137 {
00138   int err = dc1394_get_PIO_register(camera_, offset, &val);
00139   return (DC1394_SUCCESS == err);
00140 }
00142 bool Registers::setPIORegister(const uint64_t offset, const uint32_t val)
00143 {
00144   int err = dc1394_set_PIO_register(camera_, offset, val);
00145   return (DC1394_SUCCESS == err);
00146 }
00147 
00149 bool Registers::getSIORegister(const uint64_t offset, uint32_t &val)
00150 {
00151   int err = dc1394_get_SIO_register(camera_, offset, &val);
00152   return (DC1394_SUCCESS == err);
00153 }
00155 bool Registers::setSIORegister(const uint64_t offset, const uint32_t val)
00156 {
00157   int err = dc1394_set_SIO_register(camera_, offset, val);
00158   return (DC1394_SUCCESS == err);
00159 }
00160 
00162 bool Registers::getStrobeRegister(const uint64_t offset,uint32_t &val)
00163 {
00164   int err = dc1394_get_strobe_register(camera_, offset, &val);
00165   return (DC1394_SUCCESS == err);
00166 }
00168 bool Registers::setStrobeRegister(const uint64_t offset, const uint32_t val)
00169 {
00170   int err = dc1394_set_strobe_register(camera_, offset, val);
00171   return (DC1394_SUCCESS == err);
00172 }
00173 
00174 } // namespace


camera1394
Author(s): Jack O'Quin, Ken Tossell, Patrick Beeson, Nate Koenig, Andrew Howard, Damien Douxchamps, Dan Dennedy
autogenerated on Thu Jun 6 2019 19:34:17