示例#1
0
void
QEpicsAcqLocal::showMode(acqState mode)
{
	threadTimerLock.lock();
	argOnState = curState(mode);
	signalOnState = TRUE;
	threadTimerLock.unlock();
}
示例#2
0
void DCController::updateDES()
{
    //ok we have a current state
    // what events are we listening to?
    QList<DCTransition*> eventList = m_currentState->outgoingTransitions();

    // do we have a controlled event which we can activate?
    foreach(DCTransition* edge, eventList)
    {
        // if it is, follow current state to next state
        if(edge->event()->controlable())
        {
            if(m_mode == Live) {
                edge->event()->activateActuator();
            }

            m_currentState->setActive(false);
            //qDebug() << "Switch state from " << m_currentState->name() << "to" << edge->destinationState()->name() << "via" <<  edge->event()->name();
            m_currentState = edge->destinationState();
            m_currentState->setActive(true);

            emit curState(m_currentState); // do not check uncontrolled events in this turn, change state and return for next cycle

            QString historyString = QString("Event: %1 :: New State: %2").arg(edge->event()->name()).arg(m_currentState->longName());
            emit historyEntry(historyString);

            return;
        }
    }

    // start every cycle by reading the inputs
    if(m_mode == Live) {
        QString  cmd = QString("readsensors");
        QString inputstring;

        QProcess setConf;
        setConf.start( cmd );

        if( !setConf.waitForStarted() ) {
            qDebug() << "can't start process readsensors";
            return;
        }

        if( !setConf.waitForFinished() ) {
            qDebug() << "can't wait for process readsensors";
            return;
        }

        QByteArray output = setConf.readAll();

        if( !output.isEmpty() ) {
            inputstring = QString(output);

            QList<DCSensor*> sensorList = m_hwSettings->sensors();
            foreach(DCSensor* sensor, sensorList)
            {
                sensor->updateValues(inputstring);
            }
示例#3
0
void DCController::startController()
{
    m_currentState = m_initialState;
    m_currentState->setActive(true);

    m_cycleTimer->start(100);
    m_running = true;
    emit curState(m_currentState);

    QString historyString = QString("Controller started");
    emit historyEntry(historyString);
}
示例#4
0
  void Trajectory::printFromLast(size_t last) const {
    EpiState curState(getState());
    size_t ntrans = transitionCount();

    // Events that were not included in the tree
    if (ntrans > 0) {
      for (size_t i = ntrans-1; i > last; --i) {
        cout << curState << endl;
        StateTransition st = getTrans(i);
        curState -= st.getTrans();
      }
    }
  }
示例#5
0
/*!
	@function	NormalBindingV1ToState
	
	@abstract	Read a VRML 1 NormalBinding node and use it to modify the
				current state.
	
	@param		ioNode		Node to convert.
	@param		inReader	The reader object.
*/
void	NormalBindingV1ToState( PolyValue& ioNode, CVRMLReader& ioReader )
{
	PolyValue::Dictionary&	theDict( ioNode.GetDictionary() );
	int	theValue = eVRML1Value_DEFAULT;
	
	if (IsKeyPresent( theDict, "value" ))
	{
		theValue = theDict["value"].GetInt();
	}
	
	SVRML1State&	curState( ioReader.GetVRML1State() );
	
	curState.normalBinding = theValue;
}
示例#6
0
void DCController::stopController()
{
    m_cycleTimer->stop();

    if(m_currentState)
    {
        m_currentState->setActive(false);
        m_currentState = 0;
    }
    m_paused = false;
    m_running = false;
    emit curState(m_currentState);

    QString historyString = QString("Controller stopped");
    emit historyEntry(historyString);
}
示例#7
0
/*!
	@function	Coordinate3V1ToState
	
	@abstract	Read a VRML 1 Coordinate3 node and use it to modify the
				current state.
	
	@param		ioNode		Node to convert.
	@param		ioReader	The reader object.
*/
void	Coordinate3V1ToState( PolyValue& ioNode, CVRMLReader& ioReader )
{
	SVRML1State&	curState( ioReader.GetVRML1State() );
	PolyValue::Dictionary&	theDict( ioNode.GetDictionary() );

	if (IsKeyPresent( theDict, "point" ))
	{
		const PolyValue::FloatVec&	ptVec( theDict["point"].GetFloatVec() );
		
		if ( (ptVec.size() % 3) == 0 )
		{
			std::vector<TQ3Point3D>	thePts;
			FloatVecToStructureVec( ptVec, thePts );
			curState.coordinate3.swap( thePts );
		}
	}	
}
示例#8
0
void ProjectJournal::redo()
{
	while( !m_redoCheckPoints.isEmpty() )
	{
		CheckPoint c = m_redoCheckPoints.pop();
		JournallingObject *jo = m_joIDs[c.joID];

		if( jo )
		{
			DataFile curState( DataFile::JournalData );
			jo->saveState( curState, curState.content() );
			m_undoCheckPoints.push( CheckPoint( c.joID, curState ) );

			bool prev = isJournalling();
			setJournalling( false );
			jo->restoreState( c.data.content().firstChildElement() );
			setJournalling( prev );
			engine::getSong()->setModified();
			break;
		}
	}
}