00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "LOW_compToggleSwitch.h"
00019
00020
00021
00022
00023
00024
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
00045
00046
00047 void LOW_compToggleSwitch::switchAction( LOW_compTwinSwitch *, 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 *, const unsigned int inSwitchNum)
00079 {
00080 if ( toggleState != noLock_state )
00081 return;
00082
00083 toggleActionRcv.shortSwitchAction( this, inSwitchNum);
00084 }