// -----------------------------------------------------------------------------
// CUpnpSymbianServerBase::RunError
// RunError is called when RunL leaves.
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CUpnpSymbianServerBase::RunError( TInt aError )
    {
    LOG_FUNC_NAME;
    if ( aError == KErrBadDescriptor )
        {
        // A bad descriptor error implies a badly programmed client, so panic it;
        // otherwise report the error to the client
        LOGS( "RunError - BadClient" );
        PanicClient( Message(), EBadDescriptor );
        }
    else if ( aError != KErrCorrupt )
        {
        LOGS( "RunError - Faulty Message" );
        if ( !Message().IsNull() )
            {
            Message().Complete( aError );
            }
        }

    // The leave will result in an early return from CServer::RunL(), skipping
    // the call to request another message. So do that now in order to keep the
    // server running.
    ReStart();

    // Handled the error fully
    return KErrNone;
    }
Exemple #2
0
/**
Handles the receipt of a message.
*/
EXPORT_C void CServer2::RunL()
	{
	TInt fn = Message().Function();

	if(fn>=0)
		{
		// Service the message
		CSession2* session=Message().Session();
		if(session)
			session->ServiceL(Message());
		else
			NotConnected(Message());
		}
	else if(fn==RMessage2::EConnect)
		{
		Connect(Message());
		}
	else if(fn==RMessage2::EDisConnect)
		{
		Disconnect(Message());
		}
	else
		{
		BadMessage(Message());
		}
	// Queue reception of next message if it hasn't already been done
	if(!IsActive())
		ReStart();
	}
EXPORT_C TInt CPolicyServer::RunError(TInt aError)
	{
	ProcessError(Message(), aError);
	if (!IsActive())
		ReStart();
	return KErrNone;
	}
Exemple #4
0
/**
Handles the situation where a call to CServer2::RunL(), leaves.

This is the server active object's implementation of the active object
framework's RunError() function.

In practice, the leave can only be caused by a session's ServiceL() function,
which is called from this RunL(); this error is reflected back to that session
by calling its ServiceError() function.

@param aError The leave code.

@return KErrNone.

@see CActive::RunL()
@see CActive::RunError()
@see CSession2::ServiceError()
*/
EXPORT_C TInt CServer2::RunError(TInt aError)
	{
	Message().Session()->ServiceError(Message(),aError);
	if (!IsActive())
		ReStart();
	return KErrNone;
	}
/*
* Called when the server active object's RunL() leaves
*/
TInt CCoreDumpServer::RunError(TInt aError)
	{
	Message().Complete(aError);
    
	// Call Restart(), as RunL() left before server got chance to re-issue its request
	ReStart();

	return KErrNone;
	}
Exemple #6
0
/**
Adds the server with the specified name to the active scheduler,
and issues the first request for messages.

If KNullDesC is specified for the name, then an anonymous server will be created.
To create a session to such a server, an overload of RSessionBase::CreateSession()
which takes RServer2 object as a parameter can be used.

@param aName The name of the server.
             KNullDesC, to create anonymous servers.
@return KErrNone, if successful, otherwise one of the other system wide error codes.

@capability ProtServ if aName starts with a '!' character
*/
EXPORT_C TInt CServer2::Start(const TDesC& aName)
	{
	TInt r = iServer.CreateGlobal(aName, iSessionType, iServerRole, iServerOpts);
	if (r == KErrNone)
		{
		CActiveScheduler::Add(this);
		ReStart();
		}
	return r;
	}
Exemple #7
0
static void
reScreenActivate(void * /* dummy */)
{
    glutDisplayFunc(reDisplay);

    if ((ReInfo->s->_raceState & RM_RACE_PAUSED) == 0) {
	ReStart(); 			/* resynchro */
    }
    glutPostRedisplay();
}
Exemple #8
0
TInt CAppMain::RunError(TInt aError){
  Log(_L8("TInt CAppMain::RunError(TInt aError) start"));
  if(aError==KErrBadDescriptor){
    PanicClient(Message(),EBadDescriptor);
  }else{
    Message().Complete(aError);
  }
  ReStart();
  Log(_L8("TInt CAppMain::RunError(TInt aError) end"));
  return KErrNone;
}
Exemple #9
0
static void
ReBoardInfo(void * /* vboard */)
{
    if (ReInfo->s->_raceState & RM_RACE_PAUSED) {
	ReInfo->s->_raceState &= ~RM_RACE_PAUSED;
	ReStart();
	GfuiVisibilitySet(reScreenHandle, rePauseId, 0);
    } else {
	ReInfo->s->_raceState |= RM_RACE_PAUSED;
	ReStop();
	GfuiVisibilitySet(reScreenHandle, rePauseId, 1);
    }
}
Exemple #10
0
void Init_Sim900(void)
{
		#ifdef DebugOn
	  			    GsmDisplayUpdate("Start   ",1)	;	
					#endif
			GsmDisableComm();					
			ReStart();
			GsmConfig(Con_InitState,Con_ATE0,Con_ATE0,MsgSend,	NORMAL_PDOWN,Sec(3),Sec(10),TimerStart);
			Gsm.BuffCnt  			=	0;   //rxbuff start location is 0			
			Gsm_Tick();
			GsmEnableComm();
			GsmStartReceive();
			drv_sim900_send_cmd(4,"AT\r\n");//test	
}
Exemple #11
0
//非战斗
VOID Game_Paint(HWND hwnd){
	//背景
	SelectObject(g_bufdc, g_hBackGround_mv);
	BitBlt(g_mdc, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, g_bufdc, g_iX - WINDOW_WIDTH / 2, g_iY - WINDOW_HEIGHT / 2, SRCCOPY);

	

	//角色(移动和站立)
	if (g_tNow - g_mv < 100){
		SelectObject(g_bufdc, g_hSprite[0]);
	}
	else{
		SelectObject(g_bufdc, g_hSprite[1]);
	}
	TransparentBlt(g_mdc, WINDOW_WIDTH / 2 - 46, WINDOW_HEIGHT / 2 - 99, 85, 113, g_bufdc, g_iNum_mv * 85, g_iDirection*113.5, 85, 113, RGB(255, 255, 255));


	//覆盖层
	SelectObject(g_bufdc, g_hBackGround_mvzd);
	TransparentBlt(g_mdc, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, g_bufdc, g_iX - WINDOW_WIDTH / 2, g_iY - WINDOW_HEIGHT / 2, WINDOW_WIDTH, WINDOW_HEIGHT, RGB(255, 255, 255));

	//下边框
	SelectObject(g_bufdc, g_hxbk2);
	TransparentBlt(g_mdc, 0, WINDOW_HEIGHT - 88 - 76, 819, 110, g_bufdc, 7, 550, 812, 110, RGB(255, 255, 255));


	if (hdtflag == 1){
		for (int i = 0; i < WINDOW_WIDTH / 5; i++){
			for (int j = 0; j < 5; j++)
				BitBlt(g_hdc, i + j*WINDOW_WIDTH / 5, 0, 1, WINDOW_HEIGHT, g_mdc, i + j*WINDOW_WIDTH / 5, 0, SRCCOPY);
			Sleep(20);
		}
		hdtflag = 0;
	}
	else{
		BitBlt(g_hdc, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, g_mdc, 0, 0, SRCCOPY);
	}


	//BitBlt(g_hdc, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, g_mdc, 0, 0, SRCCOPY);

	g_tPre = GetTickCount();     //记录此次绘图时间
	g_iNum_mv++;
	if (g_iNum_mv == 4)
		g_iNum_mv = 0;
	if (rand() % 100 == 1) {
		ReStart();
	}
}
// -----------------------------------------------------------------------------
// CDRMHelperServer::RunError().
// This function handle errors from CActive
// -----------------------------------------------------------------------------
//
TInt CDRMHelperServer::RunError(TInt aError)
    {
#ifdef _DRM_TESTING
    TRAPD( err , WriteL(_L8("RunError")) );
#endif


    Message().Complete(aError);
    //
    // The leave will result in an early return from CServer::RunL(), skipping
    // the call to request another message. So do that now in order to keep the
    // server running.
    ReStart();
    return KErrNone;    // handled the error fully
    }
//
// Handle an error from CCdlSession::ServiceL()
// A bad descriptor error implies a badly programmed client, so panic it;
// otherwise report the error to the client
//
TInt CCdlServer::RunError(TInt aError)
	{
	if (aError == KErrBadDescriptor)
		PanicClient(Message(),EPanicBadDescriptor);
	else if (aError == KErrArgument)
		PanicClient(Message(), EPanicParamOutOfRange);
	else
		Message().Complete(aError);
	//
	// The leave will result in an early return from CServer::RunL(), skipping
	// the call to request another message. So do that now in order to keep the
	// server running.
	ReStart();
	return KErrNone;	// handled the error fully
	}
Exemple #14
0
int CMyRegTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CTreeView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	m_TreeImageList.Create(16, 16,ILC_COLOR8|ILC_MASK ,3,3);
	m_TreeImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_T_NORMAL));
	m_TreeImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_T_OPEN));
	m_TreeImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_T_ROOT));
	GetTreeCtrl().SetImageList(&m_TreeImageList,TVSIL_NORMAL);

	GetTreeCtrl().ModifyStyle(NULL,TVS_HASLINES|
		TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS);
	
	ReStart();

	return 0;
}
/**
 *  Standard Active Object RunError() method, called when the RunL() method
 *  leaves, which will be when the CShBufTestServerSession::ServiceL() leaves.
 *
 *  Find the current message and complete it before restarting the server.
 *
 *  @param aError  Leave code from CShBufTestServerSession::ServiceL().
 *
 *  @return KErrNone
 */
TInt CShBufTestServer::RunError(TInt aError)
	{
	//
	// Complete the request with the available error code.
	//
	if (Message().IsNull() == EFalse)
		{
		Message().Complete(aError);
		}

	//
	// The leave will result in an early return from CServer::RunL(), skipping
	// the call to request another message. So do that now in order to keep the
	// server running.
	//
	ReStart();

	return KErrNone;
	} // CShBufTestServer::RunError
// ----------------------------------------------------------------------------
// CSipClientSimulatorServer::RunError
// ----------------------------------------------------------------------------
//
TInt CSipClientSimulatorServer::RunError( TInt aError )
	{
	// Panic client if we had an error that is caused by the client itself
	if( ( aError == KErrBadDescriptor ) ||
		( aError == KErrBadHandle ) )
		{
		Message().Panic( KSipClientSimulatorName, aError );
		}
	// Otherwise just complete the request with an error code
	else
		{
		Message().Complete( aError );
		}

	// Restart server as it was interrupted when
	// the leave at CServer::RunL() happened
	ReStart();

	// We're fully recovered now
	return KErrNone;
	}
//*************************************************************************************
TInt CASSrvServer::RunError(TInt aError)
	{
	// A bad descriptor error implies a badly programmed client, so panic it;
	// otherwise report the error to the client
	if	(aError == KErrBadDescriptor)
		{
		ASSrvStaticUtils::PanicClient(Message(), EAlarmServerInitiatedClientPanicBadDescriptor);
		}
	else
		{
		Message().Complete(aError);
		}

	// The leave will result in an early return from CServer2::RunL(), skipping
	// the call to request another message. So do that now in order to keep the
	// server running.
	ReStart();

	// Indicate that we've handled the error fully
	return KErrNone;
	}
TInt CMdSServer::RunError( TInt aError )
    {
    __LOG1( ELogAlways, "Server::RunError %d", aError );

    if ( aError == KErrBadDescriptor )
        {
        // A bad descriptor error implies a badly programmed client,
        // so panic it; otherwise report the error to the client
        PanicClient( Message(), KErrBadDescriptor );
        }
    else
        {
        Message().Complete( aError );
        }

    // The leave will result in an early return from CServer::RunL(), skipping
    // the call to request another message. So do that now in order to keep the
    // server running.
    ReStart();

    return KErrNone;    // Handled the error fully
    }
Exemple #19
0
static void
reMovieCapture(void * /* dummy */)
{
   tRmMovieCapture	*capture = &(ReInfo->movieCapture);

    if (!capture->enabled || (ReInfo->_displayMode == RM_DISP_MODE_NONE)) {
	GfOut("Video Capture Mode Not Enabled\n");
	return;
    }
    
    capture->state = 1 - capture->state;
    if (capture->state) {
	GfOut("Video Capture Mode On\n");
	capture->currentFrame = 0;
	capture->currentCapture++;
	capture->lastFrame = GfTimeClock() - capture->deltaFrame;
	ReInfo->_displayMode = RM_DISP_MODE_CAPTURE;
    } else {
	GfOut("Video Capture Mode Off\n");
	ReInfo->_displayMode = RM_DISP_MODE_NORMAL;
	ReStart();
    }

}
Exemple #20
0
void MainInterface::StartProcess(GameProcess::GameStatus status)
{
    switch(status)
    {
    case (GameProcess::PickingCard):
        shuffleCardsMusic->play();
        shuffleCardsMusic->setLoops(-1);
        ReStart();
        m_basecard->show();
        m_movingcard->show();
        m_pickingCardTimer->start();
        m_gameprocess->m_gamestatus=GameProcess::PickingCard;
        break;
    case (GameProcess::CallingLord):
        m_gameprocess->m_gamestatus=GameProcess::CallingLord;
        m_timeLabel->setText("20");
        m_timeLabel->show();
        timer->start();
        m_clock->show();
        PlayerStartCallingLord();
        break;
    case (GameProcess::PlayingHand):
        m_gameprocess->m_gamestatus=GameProcess::PlayingHand;
        m_clock->hide();
        //角色标识
        if(m_gameprocess->getDownPlayer()->getRole()==Player::Lord)
            m_gameprocess->getDownPlayer()->roleLabel->setPixmap(QPixmap(":/img/res/lord.png"));
        else
            m_gameprocess->getDownPlayer()->roleLabel->setPixmap(QPixmap(":/img/res/farmer.png"));

        m_gameprocess->getDownPlayer()->roleLabel->show();

        if(m_gameprocess->getLeftPlayer()->getRole()==Player::Lord)
            m_gameprocess->getLeftPlayer()->roleLabel->setPixmap(QPixmap(":/img/res/lord.png"));
        else
            m_gameprocess->getLeftPlayer()->roleLabel->setPixmap(QPixmap(":/img/res/farmer.png"));

        m_gameprocess->getLeftPlayer()->roleLabel->show();

        if(m_gameprocess->getRightPlayer()->getRole()==Player::Lord)
            m_gameprocess->getRightPlayer()->roleLabel->setPixmap(QPixmap(":/img/res/lord.png"));
        else
            m_gameprocess->getRightPlayer()->roleLabel->setPixmap(QPixmap(":/img/res/farmer.png"));

        m_gameprocess->getRightPlayer()->roleLabel->show();

        m_bet0->hide();
        m_bet1->hide();
        m_bet2->hide();
        m_bet3->hide();

        m_gameprocess->getDownPlayer()->betLabel->hide();
        m_gameprocess->getLeftPlayer()->betLabel->hide();
        m_gameprocess->getRightPlayer()->betLabel->hide();

        QList<card> restthreecards=m_gameprocess->getAllCards();
        //添加剩余三张牌
        for(int i=0;i<3;i++)
        {
            m_gameprocess->getCurrentPlayer()->addCard(restthreecards[i]);
            CardPicture* cardpic=new CardPicture(this);
            cardpic->setPic(m_Cards.value(restthreecards[i])->getPic());

            m_restThreeCards.append(cardpic);
            m_restThreeCards[i]->move(360+i*100,5);
            m_restThreeCards[i]->setTurn(true);
            m_restThreeCards[i]->show();
        }
        m_gameprocess->getAllCards().clear();
        UpdateCards(m_gameprocess->getCurrentPlayer());
        break;
    }
}
EXPORT_C void CPolicyServer::RunL()
	{
	const RMessage2& msg = Message();
	msg.ClearAuthorised();
	TInt fn = msg.Function();

	__ASSERT_COMPILE(-1 == RMessage2::EConnect);
	if(fn >= RMessage2::EConnect) 
		//So this implies any "normal" message or Connect
		//Now we have two steps to follow each having two mutually exculsive
		//parts.
		//Step 1: Find policy.
		//Step 2: Apply policy.
		{
		const TPolicyElement* element = 0;
		TUint specialCase = 0;
		//1a: If its a normal message.  Find the associate policy or special
		//case action.
		if(fn >= 0)
			{
			element = FindPolicyElement(fn, specialCase);
			}
		//1b: If its a connect message, there's a shortcut to the policy.
		else 
			{
			TUint8 i = iPolicy.iOnConnect;
			if(i >= ESpecialCaseHardLimit)
				specialCase = i;
			else
				element = &(iPolicy.iElements[i]);
			}
		//2a: We found a policy that we can automatically apply... Apply it!
		if(element)
			{
			TSecurityInfo missing;
			//If policy check succeeds, allow it through
			if(element->iPolicy.CheckPolicy(msg, missing, __PSD("Checked by CPolicyServer::RunL")))
				{
				ProcessL(msg);
				}
			//Else see what failure action is required (return error code,
			//panic client, ask user, etc...)
			else
				{
				CheckFailedL(msg, element->iAction, missing);
				}
			}
		//2b: The policy is a special case
		else 
			{
			switch(specialCase)
				{
				//If you change this you'll have to add to the switch statement
				__ASSERT_COMPILE(ESpecialCaseLimit == 252u);
				case ECustomCheck:
					{
					TInt action = EFailClient; 
					//The default action after failing a CustomSecurityCheck is
					//to complete the message with KErrPermissionDenied.  If
					//you want a different action, then change the action
					//parameter prior to returning from your derived
					//implementation of CustomSecurityCheckL
					TSecurityInfo missing;
					__ASSERT_COMPILE(SCapabilitySet::ENCapW == 2);
					memset(&missing, 0, sizeof(SSecurityInfo));
					TCustomResult result = CustomSecurityCheckL(msg, action, missing);
					if(result == EPass)
						{
						ProcessL(msg);
						}
					else if(result == EFail)
						{
						CheckFailedL(msg, action, missing); 
						}
					else if(result == EAsync)
						{
						//Do Nothing.  Derived CustomSecurityCheck is
						//responsible for calling ProcessL/CheckFailedL
						}
					else
						Panic(EPolSvrInvalidCustomResult);
					}
					break;	
				case ENotSupported:
					msg.Complete(KErrNotSupported);	
					break;
				case EAlwaysPass:
					ProcessL(msg);
					break;
				default:
					Panic(EPolSvrPolicyInvalid);
					break;
				}
			}
		}
	//else it must be either Disconnect or bad message.  Both are handled by
	//ProcessL
	else 
		{
		ProcessL(msg);
		}

	// Queue reception of next message if it hasn't already been done
	if(!IsActive())
		ReStart();
	}
Exemple #22
0
void CODESolver::Integrate(ODESolverBase *ODEBase, double Stop_Time, double Max_dTime, flag OneIteration, flag HoldAdvance)
  {
  pODEBase=ODEBase;
  Time_Stop=Stop_Time;
  if (m_iMethod != ODE_RK4)
    m_iStepSizeControl=ODE_SSC_Fixed;

  rIC.m_TimeIncMx=Min(rIC.m_TimeIncMxRqd, Max_dTime);
  rIC.m_TimeIncMn=rIC.m_TimeIncMnRqd;

  dEstMaxDT=0.0;
  fStepTooLarge=False;
  fStepSizeTooSmall=0;
  //nBadVarRange=0;

  rIC.m_TimeIncMx=Max(1.0e-5, rIC.m_TimeIncMx);
  rIC.m_TimeIncMn=Max(1.0e-6, rIC.m_TimeIncMn);

  if (m_iStepSizeControl==ODE_SSC_Fixed)
    rIC.m_TimeIncNext=rIC.m_TimeIncMx;

  flag ShortStep=0;
  rIC.m_TimeIncNext=Range(rIC.m_TimeIncMn, Valid(rIC.m_TimeIncNext) ? rIC.m_TimeIncNext : rIC.m_TimeInc, rIC.m_TimeIncMx);
  while (rIC.m_Time < Time_Stop && !fStepSizeTooSmall)
    {
    double dT_Reqd;

    rIC.m_TimeInc=rIC.m_TimeIncNext;
    rIC.m_TimeIncInit=rIC.m_TimeInc;
    dT_Reqd = Min(Max_dTime, Min(rIC.m_TimeInc, (Time_Stop-rIC.m_Time)));
    ShortStep = (dT_Reqd < rIC.m_TimeInc * 0.99);
    rIC.m_TimeInc = dT_Reqd;

    LoadIC(IC_StepStart | IC_StepPreStart, "====");

    // Clear the last Iterations Errors
    m_BadTolList.Len=0;
    m_BadLim.Len=0;

    // Must Converge States Before Starting
    CODEDataBlock ODB(this);
    ODB.Set(eStateConverge, -1, CODEDataBlock::Converge, pODEBase);

    pODEBase->ODEStartStep();

    LoadIC(IC_StepStart , "====");
    pODEBase->ODEDerivs();
    SaveStart();
    #if dbgODESolve
    if (dbgDumpDerivs())
      DumpIntegrators(hDumpFile, rIC.m_Time, rIC.m_TimeInc, "Strt");
    #endif
    SetLimits();

    int IntLoop=0;
    m_BadTolList.Len=0;
    m_BadTolCopy.Len=0;

    for (flag OK=0; (!OK ) ; )
      {
      m_BadLim.Len=0;
      IntLoop++;
      if (IntLoop > 1)
        {
        LoadIC(IC_StepReStart ,"=..=");
        pODEBase->ODEStartStep();
        pODEBase->ODEDerivs();
        }

      flag IsBad=0;
      OK=1;
      dTimeWrk = rIC.m_TimeInc;
      IntOneStep();
      if (fStepTooLarge)
        {
        IsBad=True;
        }
      else
        switch (m_iStepSizeControl)
          {
          case ODE_SSC_Var_1:
            SaveIntermediate();
            ReStart();
            dTimeWrk *= 0.5;
            LoadIC(0 , "  ==");
            // Derivatives @ Start still the Same
            IntOneStep();
            if (!fStepTooLarge)
              {
              LoadIC(0 , "  --");
              pODEBase->ODEDerivs();
              IntOneStep();
              dTimeWrk *= 2.0;
              CalculateErrors();
              IsBad = !StepSizeOK_1();
              }
            break;

          case ODE_SSC_Var_2 :
            CalculateErrors();
            IsBad=!StepSizeOK_2();
            break;

          default:
            IsBad=0;
            break;
          }

      // FindOut what action to take
      // If bad then restart
      if (IsBad)
        {
        if (fStepTooLarge)
          {
          rIC.m_TimeInc=dEstMaxDT;
          ReStart();
          OK=0;
          m_nBadIters++;
          fStepTooLarge=False;
          }
        else if (fStepSizeTooSmall)
          {
          rIC.m_TimeIncNext=rIC.m_TimeIncMn;
          m_nGoodIters++;
          m_nIters4Step++;
          }
        else //if (!fStepSizeTooSmall)
          {
          rIC.m_TimeInc=rIC.m_TimeIncRestart;
          ReStart();
          OK=0;
          m_nBadIters++;
          m_nIters4Step++;
          }
        }
      else
        {
        m_nGoodIters++;
        m_nIters4Step++;
        }
      }

    // Must be called independently
    // EvalAllDiscrete();
    #if dbgODESolve
    if (dbgDumpDerivs())
      DumpIntegrators(hDumpFile, rIC.m_Time, rIC.m_TimeInc, "Done");
    #endif

    if (ShortStep && !fStepSizeTooSmall)
      {
      if (rIC.m_TimeIncNext >= rIC.m_TimeInc)
        // Test Passed Easily but step was artificially short - use prev dT
        rIC.m_TimeIncNext=rIC.m_TimeIncInit;
      break;
      }
    
    rIC.m_TimeIncNext=Min(Max_dTime, rIC.m_TimeIncNext);
    rIC.m_TimeIncNext=Min(Max_dTime, rIC.m_TimeIncNext);

    if (OneIteration)
      break;
    }

  pODEBase=NULL;
  };