Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArVersalogicIO.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARVERSALOGICIO_H
00027 #define ARVERSALOGICIO_H
00028 
00029 #ifndef SWIG
00030 
00031 #include "ariaTypedefs.h"
00032 #include "ArRobot.h"
00033 
00069 class ArVersalogicIO
00070 {
00071 public:
00072 
00073   enum Direction
00074   {
00075     DIGITAL_INPUT,
00076     DIGITAL_OUTPUT
00077   };
00078 
00080   AREXPORT ArVersalogicIO(const char * dev = "/dev/amrio");
00082   AREXPORT virtual ~ArVersalogicIO(void);
00083 
00085   AREXPORT bool closeIO(void);
00086 
00088   AREXPORT bool isEnabled(void) { return myEnabled; }
00089 
00091   AREXPORT bool isAnalogSupported(void) { return myAnalogEnabled; }
00092 
00096   AREXPORT bool getAnalogValue(int port, double *val);
00097 
00100   AREXPORT bool getAnalogValueRaw(int port, int *val);
00101 
00103   AREXPORT Direction getDigitalBankDirection(int bank);
00104 
00106   AREXPORT bool setDigitalBankDirection(int bank, Direction dir);
00107 
00109   AREXPORT bool getDigitalBankInputs(int bank, unsigned char *val);
00110 
00112   AREXPORT bool getDigitalBankOutputs(int bank, unsigned char *val);
00113 
00115   AREXPORT bool setDigitalBankOutputs(int bank, unsigned char val);
00116 
00118   AREXPORT bool getSpecialControlRegister(unsigned char *val);
00119 
00121   AREXPORT int lock(void){ return(myMutex.lock()); }
00123   AREXPORT int unlock(void){ return(myMutex.unlock()); }
00124 
00126   AREXPORT int tryLock() {return(myMutex.tryLock());}
00127 
00128 protected:
00129 
00130   static ArMutex myMutex;
00131   int myFD;
00132 
00133   bool myEnabled;
00134   bool myAnalogEnabled;
00135 
00136   int myNumBanks;
00137 
00138   unsigned char myDigitalBank0;
00139   unsigned char myDigitalBank1;
00140   unsigned char myDigitalBank2;
00141   unsigned char myDigitalBank3;
00142 
00143   ArRetFunctorC<bool, ArVersalogicIO> myDisconnectCB;
00144 };
00145 
00146 #endif // SWIG
00147 
00148 #endif // ARVERSALOGICIO_H

Generated on Tue Feb 20 10:51:42 2007 for Aria by  doxygen 1.4.0