Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LOW_compJalousieController.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_compJalousieController.h  -  description
00003                              -------------------
00004     begin                : Wed Sep 4 2002
00005     copyright            : (C) 2002 by Harald Roelle, Helmut Reiser
00006     email                : roelle@informatik.uni-muenchen.de, reiser@informatik.uni-muenchen.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 #ifndef LOW_COMPJALOUSIECONTROLLER_H
00019 #define LOW_COMPJALOUSIECONTROLLER_H
00020 
00021 
00022 #include "LOW_component.h"
00023 #include "LOW_devDS2405.h"
00024 
00025 
00026 /**
00027     @todo Documentation of class.
00028 
00029   *@author Harald Roelle, Helmut Reiser
00030   */
00031 class LOW_compJalousieController : public LOW_component  {
00032 
00033 //=======================================================================================
00034 public:
00035   
00036   //=====================================================================================
00037   //
00038   // exceptions
00039   //
00040  
00041   class_DERIVE_FROM_EXCEPTION( compJalousieController_error, component_error);
00042   
00043   
00044   
00045   //=====================================================================================
00046   //
00047   // constructors
00048   //
00049   
00050   LOW_compJalousieController( const LOW_devDS2405 &inPowerControl, const LOW_devDS2405 &inDirectionControl,
00051                               const float inClosingTime, const float inOpeningTime,
00052                               const float inAngleClosingTime, const float inAngleOpeningTime);
00053   
00054   ~LOW_compJalousieController();
00055 
00056   
00057   
00058 //=======================================================================================
00059 protected:
00060 
00061   //=====================================================================================
00062   //
00063   // locks
00064   //
00065 
00066   class jcLock {
00067   public:
00068     jcLock( LOW_compJalousieController &inJCComp);
00069     ~jcLock();
00070   protected:
00071     const LOW_compJalousieController &jcComp;
00072   };
00073 
00074 
00075 
00076 //=======================================================================================
00077 public:
00078 
00079   //=====================================================================================
00080   //
00081   // classes
00082   //
00083   
00084   class manualMove : public jcLock { 
00085   //---------------------------------------------------------------------------------------
00086   public:
00087     //---------------------------------------------------------------------------------------
00088     // constructors
00089     manualMove( LOW_compJalousieController &inJCComp);
00090     ~manualMove();
00091   
00092     //---------------------------------------------------------------------------------------
00093     // methods
00094     void moveUp();
00095     void moveDown();
00096     void stopMove();
00097 
00098   //---------------------------------------------------------------------------------------
00099   protected:
00100     LOW_compJalousieController &jcComp;
00101   };
00102 
00103 
00104 
00105   //=====================================================================================
00106   //
00107   // methods
00108   //
00109   
00110   void setPosition( float inPos, float inAngle);
00111 
00112   float getClosingTime() const;
00113 
00114   void setClosingTime( const float inClosingTime);
00115 
00116   float getOpeningTime() const;
00117 
00118   void setOpeningTime( const float inOpeningTime);
00119 
00120   float getAngleClosingTime() const;
00121 
00122   void setAngleClosingTime( const float inAngleClosingTime);
00123 
00124   float getAngleOpeningTime() const;
00125 
00126   void setAngleOpeningTime( const float inAngleOpeningTime);
00127 
00128   //LOW_devDS2405& getPowerPIODevice();
00129 
00130   //LOW_devDS2405& getDirectionPIODevice();
00131 
00132   void measureTransitionDelays();
00133 
00134   void getTransitionDelays( unsigned int &outStop2upDelay, unsigned int &outUp2stopDelay,
00135                             unsigned int &outStop2downDelay, unsigned int &outDown2stopDelay,
00136                             unsigned int &outUp2downDelay, unsigned int &outDown2upDelay);
00137 
00138   void setTransitionDelays( const unsigned int inStop2upDelay, const unsigned int inUp2stopDelay,
00139                             const unsigned int inStop2downDelay, const unsigned int inDown2stopDelay,
00140                             const unsigned int inUp2downDelay, const unsigned int inDown2upDelay);
00141 
00142   
00143 //=======================================================================================
00144 protected:
00145 
00146   //=====================================================================================
00147   //
00148   // friends
00149   //
00150   
00151   friend class manualMove;
00152   friend class jcLock;
00153   
00154   
00155   
00156   //=====================================================================================
00157   //
00158   // constants
00159   //
00160   
00161   static const int fullMovementAdditionMillis = 500;
00162 
00163   
00164       
00165   //=====================================================================================
00166   //
00167   // attributes
00168   //
00169   
00170   const int            jcSerialNum;
00171   const LOW_devDS2405  &powerControl;
00172   const LOW_devDS2405  &directionControl;
00173   float                closingTime;
00174   float                openingTime;
00175   float                angleClosingTime;
00176   float                angleOpeningTime;
00177   unsigned int         stop2upDelay;
00178   unsigned int         up2stopDelay;
00179   unsigned int         stop2downDelay;
00180   unsigned int         down2stopDelay;
00181   unsigned int         up2downDelay;
00182   unsigned int         down2upDelay;
00183   LOW_semaphoreSet     *semSet;
00184 
00185   
00186   
00187   //=====================================================================================
00188   //
00189   // methods
00190   //
00191   
00192   void moveUp();
00193   
00194   void moveDown();
00195   
00196   void stopMove();
00197 
00198   void moveUpStop( const unsigned long inMillis);
00199 
00200   void moveDownStop( const unsigned long inMillis);
00201 
00202   
00203   
00204 //=======================================================================================
00205 private:
00206   
00207   //=====================================================================================
00208   //
00209   // static attributes
00210   //
00211   
00212   static int  jcCounter;
00213 
00214   
00215   
00216   //=====================================================================================
00217   //
00218   // attributes
00219   //
00220   
00221   bool powerIsOn;
00222   bool directionIsDown;
00223   
00224   
00225   
00226   //=====================================================================================
00227   //
00228   // methods
00229   //
00230   
00231   void setPowerOn();
00232   
00233   void setPowerOff();
00234   
00235   void setDirectionDown();
00236   
00237   void setDirectionUp();
00238 
00239   unsigned int averageMillis( const std::vector<unsigned int> &inVals);
00240 };
00241 
00242 #endif

Generated on Sun Jan 12 21:07:43 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001