Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

l1394_dccregister.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           l1394dccregister.cpp  -  description
00003                              -------------------
00004     begin                : Thu Aug 17 2000
00005     copyright            : (C) 2000-2004 by Michael Repplinger
00006     email                : repplinger@cs.uni-sb.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "l1394_dccregister.h"
00019 
00020 
00021 namespace L1394{
00022 DccRegister::DccRegister(const Node *parent)
00023 {
00024   this->parent = parent;
00025   balance      = false;
00026   message      = internal::SMessage::getInstance();
00027   data.fromInt(0);
00028 }
00029 
00030 
00031 bool DccRegister::onePush(bool one_push) const
00032 {
00033   if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00034     message->errorStream() << "DccRegister > read transaction failed" << endl;
00035 
00036   data.setBit(26, one_push);
00037 
00038   if (  parent->write(DCC_BASE + reg_offset + 0x800,data) == L1394_FAILED )
00039     message->errorStream() << "DccRegister > write transaction failed" << endl;
00040 
00041   if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00042     message->errorStream() << "DccRegister > read transaction failed" << endl;
00043 
00044   return data.getBit(26);
00045 }
00046 
00047 bool DccRegister::on(bool on)  const
00048 {
00049   if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00050     message->errorStream() << "DccRegister > read transaction failed" << endl;
00051   if(on)
00052     data.setBit(25, 1);
00053   else
00054     data.setBit(25, 0);
00055 
00056   if ( parent->write(DCC_BASE + reg_offset + 0x800, data) == L1394_FAILED )
00057     message->errorStream() << "DccRegister > write transaction failed" << endl;
00058 
00059   if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00060     message->errorStream() << "DccRegister > read transaction failed" << endl;
00061 
00062   return data.getBit(25);
00063 }
00064 
00065 bool DccRegister::automatic(bool on) const
00066 {
00067   if ( parent->read(DCC_BASE + reg_offset + 0x800, &data ) == L1394_FAILED )
00068     message->errorStream() << "DccRegister > read transaction failed" << endl;
00069 
00070   if(on)
00071     data.setBit(24, 1);
00072   else
00073     data.setBit(24, 0);
00074 
00075   if ( parent->write(DCC_BASE + reg_offset + 0x800, data ) == L1394_FAILED )
00076     message->errorStream() << "DccRegister > write transaction failed" << endl;
00077 
00078   if ( parent->read (DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00079     message->errorStream() << "DccRegister > read transaction failed" << endl;
00080 
00081   return data.getBit(24);
00082 }
00083 
00084 int DccRegister::setValue(int value)  const
00085 {
00086   if (  parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00087     message->errorStream() << "DccRegister > read transaction failed" << endl;
00088 
00089   if(balance)
00090     data.setBitRange(12,23,value);
00091   else
00092     data.setBitRange(0,11, value);
00093 
00094   if ( parent->write(DCC_BASE + reg_offset + 0x800, data) == L1394_FAILED )
00095       message->errorStream() << "DccRegister > write transaction failed" << endl;
00096 
00097   if (balance)
00098   {
00099     balance = false;
00100     if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00101       message->errorStream() << "DccRegister > read transaction failed" << endl;
00102 
00103     return data.getBitRange(12,23);
00104   }
00105   else
00106   {
00107     if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00108       message->errorStream() << "DccRegister > read transaction failed" << endl;
00109 
00110     return data.getBitRange(0,11);
00111    }
00112 }
00113 
00114 int DccRegister::setTriggerMode(int value)  const
00115 {
00116   if ( parent->read(DCC_BASE +reg_offset +0x800, &data) == L1394_FAILED )
00117     message->errorStream() << "DccRegister > read transaction failed" << endl;
00118 
00119   data.setBitRange(16,19, value);
00120   if ( parent->write(DCC_BASE + reg_offset + 0x800,data) == L1394_FAILED )
00121     message->errorStream() << "DccRegister > write transaction failed" << endl;
00122 
00123   if ( parent->read(DCC_BASE +reg_offset +0x800, &data) == L1394_FAILED )
00124     message->errorStream() << "DccRegister > read transaction failed" << endl;
00125 
00126   return data.getBitRange(16,19);
00127 }
00128 
00129 bool DccRegister::setTriggerPolarity(bool value)  const
00130 {
00131   if ( parent->read(DCC_BASE +reg_offset +0x800, &data) == L1394_FAILED )
00132     message->errorStream() << "DccRegister > read transaction failed" << endl;
00133 
00134   data.setBit(24, value);
00135 
00136   if ( parent->write(DCC_BASE + reg_offset + 0x800,data) == L1394_FAILED )
00137     message->errorStream() << "DccRegister > write transaction failed" << endl;
00138 
00139   if ( parent->read(DCC_BASE +reg_offset +0x800, &data) == L1394_FAILED )
00140     message->errorStream() << "DccRegister > read transaction failed" << endl;
00141 
00142   return data.getBit(24);
00143 }
00144 
00145 
00146 int DccRegister::getValue() const
00147 {
00148   if (balance)
00149   {
00150     balance = false;
00151     if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00152       message->errorStream() << "DccRegister > read transaction failed" << endl;
00153     return data.getBitRange(12,23);
00154   }
00155   if ( parent->read(DCC_BASE + reg_offset + 0x800, &data) == L1394_FAILED )
00156     message->errorStream() << "DccRegister > read transaction failed" << endl;
00157 
00158   return data.getBitRange(0,11);
00159 }
00160 
00161 
00162 int DccRegister::getMinValue()const//corrected
00163 {
00164   if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00165     message->errorStream() << "DccRegister > read transaction failed" << endl;
00166 
00167   return data.getBitRange(12, 23);
00168 }
00169 
00170 
00171 int DccRegister::getMaxValue()  const//corrected
00172 {
00173   if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00174     message->errorStream() << "DccRegister > read transaction failed" << endl;
00175 
00176   return data.getBitRange(0,11);
00177 }
00178 
00179 bool DccRegister::hasFeature()  const    //corrected
00180 {
00181   if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00182     message->errorStream() << "DccRegister > read transaction failed" << endl;
00183 
00184   return (bool)data.getBit(31);
00185 /*  switch(reg_offset)
00186   {
00187     case 0x0: return (bool)feature_hi.getBit(31); break; //brihtness
00188     case 0x4: return (bool)feature_hi.getBit(30); break; //AE
00189     case 0x8: return (bool)feature_hi.getBit(29); break; //Sharpness
00190     case 0xc: return (bool)feature_hi.getBit(28); break; //White Balance
00191     case 0x10: return (bool)feature_hi.getBit(27); break; //Hue
00192     case 0x14: return (bool)feature_hi.getBit(26); break; //Saturation
00193     case 0x18: return (bool)feature_hi.getBit(25); break; //Gamma
00194     case 0x1c: return (bool)feature_hi.getBit(24); break; //shutter
00195     case 0x20: return (bool)feature_hi.getBit(23); break; //gain
00196     case 0x24: return (bool)feature_hi.getBit(22); break; //iris
00197     case 0x28: return (bool)feature_hi.getBit(21); break; //focus
00198     case 0x2c: return (bool)feature_hi.getBit(20); break; //temperature
00199     case 0x30: return (bool)feature_hi.getBit(19); break; //trigger
00200     //
00201     case 0x80: return (bool)feature_lo.getBit(31); break; //zoom
00202     case 0x84: return (bool)feature_lo.getBit(30); break; //pan
00203     case 0x88: return (bool)feature_lo.getBit(29); break; //tilt
00204     case 0x8c: return (bool)feature_lo.getBit(28); break; //optical filter
00205     default: cout << " ERROR " << endl; return false; break;
00206   }
00207 
00208  */
00209 }
00210 
00211 bool DccRegister::hasOnePush()  const
00212 {
00213  if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00214     message->errorStream() << "DccRegister > read transaction failed" << endl;
00215  return data.getBit(3);
00216 }
00217 
00218 bool DccRegister::hasReadout()  const
00219 {
00220   if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00221     message->errorStream() << "DccRegister > read transaction failed" << endl;
00222 
00223   return data.getBit(4);
00224 }
00225 
00226 bool DccRegister::hasOnOff()  const
00227 {
00228   if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00229     message->errorStream() << "DccRegister > read transaction failed" << endl;
00230 
00231   return data.getBit(5);
00232 }
00233 
00234 bool DccRegister::hasAuto() const
00235 {
00236   if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00237     message->errorStream() << "DccRegister > read transaction failed" << endl;
00238 
00239   return data.getBit(6);
00240 }
00241 
00242 bool DccRegister::hasManual() const
00243 {
00244   if ( parent->read(DCC_BASE + reg_offset + 0x500, &data) == L1394_FAILED )
00245     message->errorStream() << "DccRegister > read transaction failed" << endl;
00246 
00247   return data.getBit(7);
00248 }
00249 
00250 }

Generated on Wed Aug 24 00:36:40 2005 for L1394 by doxygen 1.4.2
L1394 library (NMM) grahics.cs.uni-sb.de/~repplix/l1394_home/