Пример #1
0
bool mitk::GlobalInteraction::ExecuteAction(Action* action, mitk::StateEvent const* stateEvent)
{
  bool ok = false;

  ok = false;
  switch (action->GetActionId())
  {
  case AcDONOTHING:
    ok = true;
    break;
  case AcINFORMLISTENERS:
    InformListeners(stateEvent);
    ok = true;
    break;
  case AcASKINTERACTORS:
    if (! AskSelected(stateEvent))//no interactor selected anymore
    {
      //fill the jurisdictionMap to ask them bit by bit.
      //currentInteractor is set here to the beginning
      FillJurisdictionMap(stateEvent, 0);

      //ask the Interactors to handle that event
      AskCurrentInteractor(stateEvent);
    }
    ok = true;
    break;
  default:
    ok = true;
  }
  return ok;
}
// -----------------------------------------------------------------------------
// CBTGPSRequestManager::HandleMessage
// -----------------------------------------------------------------------------
void CBTGPSRequestManager::HandleMessage(const TBTGPSNmeaParser& aParser)
    {
    //Add the received message to buffer
    iNmeaBuffer->AddSentences(aParser.NmeaSentence());
    //Add 0x0d 0x0a
    iNmeaBuffer->AddSentences(KBTGPSNmeaTerminator);
    
    //Parse the message
    CBTGPSFix::TParsingStatus err = iFix->ParseMessage(aParser);

    //Check if we have received a valid sentence
    if(err == CBTGPSFix::EInfoUpdated)
        {
        if(iFix->IfFullNmeaPatternReceived())
            {
            TTime gsvTime = iFix->GsvTime();
            TTime now;
            now.UniversalTime();
            TRACESTRING2("CBTGPSRequestManager:: Now time = %d", now.Int64())
            TRACESTRING2("CBTGPSRequestManager:: GSV time = %d", gsvTime.Int64())
            if(gsvTime!=0 && now.MicroSecondsFrom(gsvTime)< 
                CBTGPSRequestHandler::ConstantsManager().iSatelliteInfoLifeTime)
                {
                //GSV information is still valid, set fix as valid
                TRACESTRING("CBTGPSRequestManager:: GSV information is still valid")
                iTimer->Cancel();
                InformListeners();
                }
            else
                {
                if(!iTimer->IsActive())
                    {
                    //GSV information is not valid, start timer
                    iTimer->Start(
                        KBTGPSGsvWaitTime,
                        KBTGPSGsvWaitTime,
                        TCallBack(TimerCallback, this));
                    }
                }
            }
        }