source: trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/amcstate.cpp@ 3401

Last change on this file since 3401 was 3401, checked in by merck, 21 years ago
nitial checkin of AMC project
File size: 2.7 KB
Line 
1/***************************************************************************
2 amcstate.cpp - description
3 -------------------
4 begin : Fri Apr 4 2003
5 copyright : (C) 2003 by Martin Merck
6 email : merck@astro.uni-wuerzburg.de
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "amcstate.h"
19
20AMCState::AMCState(QObject *parent, const char *name ) : QObject( parent, name )
21{
22 m_qsStateTxtTable[AMC_STATE_ERROR] = new QString( "AMC error" );
23 m_qsStateTxtTable[AMC_STATE_PARKED] = new QString( "AMC mirrors parked" );
24 m_qsStateTxtTable[AMC_STATE_INITIALIZED] = new QString( "AMC is initialized" );
25 m_qsStateTxtTable[AMC_STATE_READJUST] = new QString( "AMC neads readjustment" );
26 m_qsStateTxtTable[AMC_STATE_ADJUSTED] = new QString( "AMC is adjusted" );
27 m_qsStateTxtTable[AMC_STATE_MOVING] = new QString( "AMC is moving mirrors" );
28 m_qsStateTxtTable[AMC_STATE_LASERADJUSTED] = new QString( "AMC is laser-adjusted" );
29 m_qsStateTxtTable[AMC_STATE_UNDEFINED] = new QString( "AMC is in undefined state" );
30 m_qsStateTxtTable[AMC_STATE_USER] = new QString( "AMC is in user mode" );
31 m_qsStateTxtTable[AMC_STATE_NOT_AVAILABLE] = new QString( "AMC has no connection to CC" );
32 m_qsStateTxtTable[AMC_STATE_UNKNOWN] = new QString( "AMC is in an unknown state." );
33 m_iInstalledPanels = 0;
34 m_iErrorPanels = 0;
35}
36
37AMCState::~AMCState()
38{
39}
40
41/** Set the state. */
42void AMCState::setState( int p_iState )
43{
44 // if the new state is equal to the actual state we
45 // do nothing.
46 if( p_iState == m_iState )
47 return;
48
49 int iOldState = m_iState;
50 m_iState = p_iState;
51
52 emit stateChanged( iOldState, m_iState );
53}
54
55/** Return the actual state. */
56int AMCState::getState() const
57{
58 return m_iState;
59}
60
61/** Get a textual description of the state. */
62const QString& AMCState::getText( int p_iState ) const
63{
64 if ( ( p_iState < AMC_STATE_ERROR )
65 ||
66 ( p_iState > AMC_STATE_NOT_AVAILABLE ) )
67 return( *m_qsStateTxtTable[ AMC_STATE_UNKNOWN ] );
68 else
69 return( *m_qsStateTxtTable[ p_iState ] );
70}
Note: See TracBrowser for help on using the repository browser.