예제 #1
0
void PowercastRxControl4Layer::eventVoltageBelowThreshold()
{
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_VOLTAGE_BELOW_THRESHOLD, currentState);
	}
	processState(EVENT_VOLTAGE_BELOW_THRESHOLD, NULL);
}
예제 #2
0
void GDExplorerRun(GDExplorerRef explorer, int stepsLimit, GDBool * canExistBetter) {
  
  int stepCounter = 0;
  while ( explorer->explorationStack->count > 0 ) {
    
    GDExplorationStackItem state = GDExplorationStackPop(explorer->explorationStack);
    processState(explorer, state);

    if ( !GDSolutionCanExistsBetter(explorer->bestSolution) ) {
      if ( canExistBetter ) {
        *canExistBetter = NO;
      }
      return;
    }
    
    stepCounter++;
    if ( stepsLimit > 0 && stepCounter >= stepsLimit ) {
      break;
    }
    
  }
  
  if ( canExistBetter ) {
    *canExistBetter = YES;
  }
  
}
예제 #3
0
void PowercastRxControl4Layer::eventTimeoutRemoveOldestProbeSender()
{
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_TIMEOUT_REMOVE_OLDEST, currentState);
	}
	processState(EVENT_TIMEOUT_REMOVE_OLDEST, NULL);
}
예제 #4
0
void PowercastRxControl4Layer::eventPowerProbeRequestReceivedNotFromQueueAdress(ProtocolPacket *xBeePacket)
{
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_POWER_PROBE_REQUEST_RECEIVED_NOT_FROM_QUEUE_ADDRESS, currentState);
	}
	processState(EVENT_POWER_PROBE_REQUEST_RECEIVED_NOT_FROM_QUEUE_ADDRESS, xBeePacket);
}
예제 #5
0
void PowercastRxControl4Layer::eventTimeoutWaitingForPower()
{
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_TIMEOUT_WAITING_FOR_POWER, currentState);
	}
	processState(EVENT_TIMEOUT_WAITING_FOR_POWER, NULL);
}
예제 #6
0
void PowercastRxControlLayer::eventTimeoutPing()
{
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_TIMEOUT_PING, currentState);
	}
	processState(EVENT_TIMEOUT_PING, NULL);
}
예제 #7
0
	void nextStep(char c)
	{
		checkOnEmptyLine(c);
		
		if(state != DOUBLE_BREACKET_STATE && 
		   state != ONE_BREACKET_STATE)
				processNestingLevel(c);
		processState(c);
	}
예제 #8
0
void PowercastTxControl3Layer::eventReceivedPing(ProtocolPacket *xBeePacket)
{
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_RECEIVED_PING, currentState);
	}

	processState(EVENT_RECEIVED_PING, xBeePacket);
	
}
예제 #9
0
void PowercastTxControl3Layer::eventTimeoutOnPowerProbe()
{
	//Serial.print(F("currentState "));
	//Serial.print(currentState);
	//Serial.println(F("eventPwrProbeReceivedBelowTh"));
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_TIMEOUT_ON_POWER_PROBE, currentState);
	}
	processState(EVENT_TIMEOUT_ON_POWER_PROBE, NULL);
}
예제 #10
0
void PowercastTxControl3Layer::eventPwrProbeReceivedBelowTh()
{
	//Serial.print(F("currentState "));
	//Serial.print(currentState);
	//Serial.println(F("eventPwrProbeReceivedBelowTh"));
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_PWR_PROBE_RECEIVED_BELOW_TH, currentState);
	}
	processState(EVENT_PWR_PROBE_RECEIVED_BELOW_TH, NULL);
}
예제 #11
0
void PowercastTxControl3Layer::eventTimeoutPowerProbeResponse()
{
	//Serial.print(F("currentState "));
	//Serial.print(currentState);
	//Serial.println(F("eventTimeoutOnProbe"));
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_TIMEOUT_PWR_PROBE_RESPONSE, currentState);
	}
	processState(EVENT_TIMEOUT_PWR_PROBE_RESPONSE, NULL);
}
예제 #12
0
void PowercastTxControl2Layer::eventPwrProbeTimeout()
{
	//Serial.print(F("currentState "));
	//Serial.print(currentState);
	//Serial.println(F("eventPwrProbeTimeout"));
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_PWR_PROBE_TIMEOUT, currentState);
	}
	processState(EVENT_PWR_PROBE_TIMEOUT, NULL);
}
예제 #13
0
void PowercastTxControl2Layer::eventReceivedPing()
{
	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_RECEIVED_PING, currentState);
	}

	lastPingReceived = getCurrentTimeMiliseconds();
	processState(EVENT_RECEIVED_PING, NULL);
	
}
예제 #14
0
void Level::update(const float deltaTime) {
    world->setDelta(deltaTime);
    world->process();

    processState();

    if (state == LevelState::Won)
	next();
    else if (state == LevelState::Lost)
	restart();
}
예제 #15
0
void PowercastTxControl2Layer::eventTimeoutPing()
{
	//Serial.print(F("currentState "));
	//Serial.print(currentState);
	//Serial.println(F("eventTimeoutPing"));

	if (measurementObject != NULL) {
		measurementObject->saveFsmEventToFile(IS_TX, EVENT_TIMEOUT_PING, currentState);
	}
	processState(EVENT_TIMEOUT_PING, NULL);
}
bool BrainStateMachine::run() {
    online_check  = false;
    started_check = false;
    preconditionCheck();

    // TODO_JP: What to do in any of these cases?
    if (!online_check && !started_emergency_land_sequence) { // updated in preconditionCheck();
//        started_emergency_land_sequence = true;
//        current_state = BrainStates::EMERGENCY_LAND_SEQUENCE;
//        state_step = 0;
    }
    if (!started_check) { // preconditionCheck();
        // TODO_JP, lo suyo seria mostar un mensaje de warning o algo asi
    }

    bool is_successful = true;
    is_successful = processState();
    stateTransitionCheck();
    return is_successful;
}
예제 #17
0
////////////////////////////////////////////////////////////////////////////////
// virtual
bool LLMediaImplQuickTime::updateMedia()
{
	if ( ! mMovieHandle )
		return false;

	if ( ! mMovieController )
		return false;

	if ( ! mGWorldHandle )
		return false;

	// service QuickTime
	MoviesTask( mMovieHandle, 0 );
	MCIdle( mMovieController );

	// update state machine (deals with transport controls for example)
	processState();

	// special code for looping - need to rewind at the end of the movie

	if ( isLooping() )
	{
		// QT call to see if we are at the end - can't do with controller
		if ( IsMovieDone( mMovieHandle ) )
		{
			// go back to start
			rewind();

			// kick off new play
			MCDoAction( mMovieController, mcActionPrerollAndPlay, (void*)GetMoviePreferredRate( mMovieHandle ) );

			// set the volume
			MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume );
		}
	}

	return true;
}
예제 #18
0
void LitResDataParser::endElementHandler(const char *tag) {
	processState(tag, true, 0);
	myState = getNextState(tag, true);
	myBuffer.clear();
}
예제 #19
0
//--------------------------------------------------------------
void testApp::update(){
    
    //  Update Camera
    //------------------------------------------------
    //
    cam.update();
    
    //  Check Light sensor
    //------------------------------------------------
    //
    if (analogIn.value < 512){
        bPlayMode = true;
    }else{
        if(bPlayMode) bNotUsed = false;
        bPlayMode = false;
    }
    
    //  Check disk state based on A&B Sensors
    //------------------------------------------------
    
    //  1. trough OSC ( testing  )
	while(receiver.hasWaitingMessages()){
        ofxOscMessage m;
		receiver.getNextMessage(&m);
        
        // check for mouse moved message
        //
		if(m.getAddress() == "/AB"){
            bool bA,bB = false;
			bA = m.getArgAsInt32(0);
			bB = m.getArgAsInt32(1);
		
            //  Compute STATE
            //  https://raw.github.com/patriciogonzalezvivo/lumiereCam/master/images/disk.png
            //
            if      (!bA && !bB)nState = 0;
            else if (bA && !bB) nState = 1;
            else if (bA && bB)  nState = 2;
            else if (!bA && bB) nState = 3;
        }
    }
    
    //  2. trough PINS (just raspbery)
#ifdef TARGET_RASPBERRY_PI
    bool bA,bB = false;
    
    if (digitalRead(0) != 0)
        bA = true;
    
    if (digitalRead(3) != 0)
        bB = true;
    
    //  Compute STATE
    //  https://raw.github.com/patriciogonzalezvivo/lumiereCam/master/images/disk.png
    //
    if      (!bA && !bB) nState = 0;
    else if (bA  && !bB) nState = 1;
    else if (bA  &&  bB) nState = 2;
    else if (!bA &&  bB) nState = 3;
#endif
    
    //  3. trough keys ( testing )
    if ( bNext ){
        nState = (nState+1)%4;
    } else if ( bPrev ){
        nState--;
        if (nState == -1)
            nState = 3;
    }
    
    //  Do what ever is need to do
    //------------------------------------------------
    //
    processState();
    nPreState = nState;
}
예제 #20
0
void LitResDataParser::startElementHandler(const char *tag, const char **attributes) {
	processState(tag, false, attributes);
	myState = getNextState(tag, false);
	myBuffer.clear();
}