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

LOW_compToggleSwitch.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_compToggleSwitch.cpp  -  description
00003                              -------------------
00004     begin                : Sun Jan 5 2003
00005     copyright            : (C) 2003 by Harald Roelle
00006     email                : roelle@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 #include "LOW_compToggleSwitch.h"
00019 
00020 
00021 
00022 //=====================================================================================
00023 //
00024 // constructors
00025 //
00026 
00027 LOW_compToggleSwitch::LOW_compToggleSwitch( const LOW_devDS2406 &inPIODevice, actionReceiver &inActionRcv,
00028                                             const bool inDetectShortClicks) :
00029   LOW_compTwinSwitch( inPIODevice, *this, inDetectShortClicks),
00030   toggleActionRcv( inActionRcv)
00031 {
00032   toggleState = noLock_state;
00033 }
00034 
00035 
00036 LOW_compToggleSwitch::~LOW_compToggleSwitch()
00037 {
00038 }
00039 
00040 
00041 
00042 //=====================================================================================
00043 //
00044 // private methods
00045 //
00046 
00047 void LOW_compToggleSwitch::switchAction( LOW_compTwinSwitch */*inCaller*/, const unsigned int inSwitchNum, const bool inValue)
00048 {
00049   switch ( toggleState ) {
00050 
00051     case noLock_state:
00052       if ( inValue == false )
00053         break;
00054         
00055       lockedSwitch = inSwitchNum;
00056       toggleState =  locked_state;
00057 
00058       toggleActionRcv.switchAction( this, inSwitchNum, inValue);
00059 
00060       break;
00061       
00062     case locked_state:
00063       if ( inSwitchNum != lockedSwitch )
00064         break;
00065 
00066       if ( inValue == true )
00067         break;
00068 
00069       toggleState =  noLock_state;
00070 
00071       toggleActionRcv.switchAction( this, inSwitchNum, inValue);
00072 
00073       break;
00074   }
00075 }
00076 
00077 
00078 void LOW_compToggleSwitch::shortSwitchAction( LOW_compTwinSwitch */*inCaller*/, const unsigned int inSwitchNum)
00079 {
00080   if ( toggleState != noLock_state )
00081     return;
00082 
00083   toggleActionRcv.shortSwitchAction( this, inSwitchNum);
00084 }

Generated on Tue Feb 3 11:30:24 2004 for OneWireLibrary++ by doxygen 1.3.2