EXPORT_C TInt CComponentBase::CheckedRunError(TInt aError) { if (aError==KErrDiskFull || aError==KErrNoMemory) return KErrDiskFull; TUid uid; TInt id; TInt version; ComponentId(uid, id, version); iErrorCount++; CC_TRAPD(err, StopL()); if (err!=KErrNone || iErrorCount>MaxErrorCount()) { ComponentRecovery().ReportError(uid, id, ComponentErrorInfoMgr().GetLastErrorInfo(MakeErrorCode(uid.iUid, aError))); iActiveState=MRecovery::EFailed; ReportState(); ComponentAppContext().SetCurrentComponent(TUid::Uid(0), 0); return KErrNone; } iActiveState=MRecovery::ERestarting; iStatus=KRequestPending; Cancel(); SetActive(); iTimer.After(iStatus, TTimeIntervalMicroSeconds32( iWaitTime*1000 ) ); iWaitTime *= 1.5; ReportState(); ComponentAppContext().SetCurrentComponent(TUid::Uid(0), 0); return KErrNone; }
//------------------------------------------------------------ // CNsmlObexClient::DisconnectL() //------------------------------------------------------------ void CNsmlObexClient::DisconnectL() { if ( iObexSearcher ) { iObexSearcher->Cancel(); } StopL(); iState = EDisconnected; }
// ----------------------------------------------------------------------------- // CUpnpDeviceImplementation::StopL // ----------------------------------------------------------------------------- // EXPORT_C void CUpnpDeviceImplementation::StopL() { StopL( EStopNormal ); }
// ---------------------------------------------------------------------------- // CChatBt::RunL() // Respond to an event. // ---------------------------------------------------------------------------- // void CChatBt::RunL() { HBufC* textResource = NULL; TBuf<KMaxMarkLen> mark; if ( iStatus == KErrDisconnected ) { // Disconnected HBufC* strDisconnected = StringLoader ::LoadLC ( R_CHAT_STR_DISCONNECTED ); iLog.LogL( *strDisconnected ); CleanupStack::PopAndDestroy( strDisconnected ); StopL(); return; } else if ( iStatus == KErrAbort ) { HBufC* strDisconnected = StringLoader ::LoadLC ( R_CHAT_STR_DISCONNECTED ); iLog.LogL( *strDisconnected ); CleanupStack::PopAndDestroy( strDisconnected ); StopL(); return; } else if ( iStatus != KErrNone ) { switch ( State() ) { case EGettingDevice: if ( iStatus == KErrCancel ) { textResource = StringLoader ::LoadLC( R_CHAT_ERR_NO_DEVICE_SELECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); } SetState( EWaitingToGetDevice ); break; case EGettingService: case EGettingConnection: textResource = StringLoader ::LoadLC( R_CHAT_ERR_CONNECTION_ERROR ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); SetState( EWaitingToGetDevice ); break; case EConnected: textResource = StringLoader ::LoadLC( R_CHAT_ERR_LOST_CONNECTION ); iLog.LogL( *textResource, iStatus.Int() ); DisconnectFromServerL(); CleanupStack::PopAndDestroy( textResource ); SetState( EDisconnecting ); break; case ESendingMessage: textResource = StringLoader ::LoadLC( R_CHAT_ERR_MESSAGE_FAILED ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); DisconnectFromServerL(); SetState( EDisconnecting ); break; case EDisconnecting: if ( iStatus == KErrDisconnected ) { textResource = StringLoader ::LoadLC( R_CHAT_DISCONNECT_COMPLETE ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); StopL(); SetState( EWaitingToGetDevice ); } else { textResource = StringLoader ::LoadLC( R_CHAT_ERR_FAILED_TO_DISCONNECT ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); Panic( EChatUnableToDisconnect ); } break; case EWaitingToGetDevice: textResource = StringLoader ::LoadLC( R_CHAT_STR_DISCONNECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); break; default: Panic( EChatInvalidLogicState ); break; } } else { switch ( State() ) { case EGettingDevice: // found a device now search for a suitable service iLog.LogL( iServiceSearcher->ResponseParams().DeviceName() ); SetState( EGettingService ); iStatus = KRequestPending; // this means that the RunL // can not be called until // this program does something // to iStatus iServiceSearcher->FindServiceL( iStatus ); SetActive(); break; case EConnecting: textResource = StringLoader::LoadLC ( R_CHAT_CONNECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); // do not accept any more connections iAdvertiser->UpdateAvailabilityL( EFalse ); RequestData(); SetState( EConnected ); break; case EGettingService: textResource = StringLoader ::LoadLC( R_CHAT_FOUND_SERVICE ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); SetState( EGettingConnection ); ConnectToServerL(); break; case EGettingConnection: textResource = StringLoader ::LoadLC( R_CHAT_CONNECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); SetState( EConnected ); RequestData(); break; case EConnected: mark.Append( '>' ); textResource = HBufC::NewLC( iBuffer.Length() ); textResource->Des().Copy( iBuffer ); iLog.LogL( *textResource, mark ); iBuffer.Zero(); CleanupStack::PopAndDestroy( textResource ); RequestData(); break; case ESendingMessage: SetState( EConnected ); RequestData(); break; case EDisconnecting: textResource = StringLoader ::LoadLC( R_CHAT_DISCONNECT_COMPLETE ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy ( textResource ); iSocket.Close(); SetState( EWaitingToGetDevice ); break; case EWaitingToGetDevice: break; default: Panic( EChatInvalidLogicState ); break; }; } }
void Stop(TIM_HandleTypeDef *motorL,TIM_HandleTypeDef *motorR){ StopL(motorL); StopR(motorR); }