netAgent::netAgent(QObject *parent ) { socket = new QTcpSocket(this); connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead())); connect(socket, SIGNAL(connected()), this, SLOT(connected())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(prepareError(QAbstractSocket::SocketError))); }
void Requester::processResponse(bool ok, QString const &msg) { disconnect(m_networkManager, SIGNAL(response(bool, QString const &)), this, SLOT(processResponse(bool, QString const &))); if (ok) { emit result(prepareResult(msg)); } else { emit error(prepareError(msg)); } }
void CMMAVideoPlayer::HandleEvent(const TMMFEvent& aEvent) { LOG1(EJavaMMAPI, EInfo, "MMA:CMMAVideoPlayer::HandleEvent %d", aEvent.iEventType.iUid); // event KMMFEventCategoryPlaybackComplete is handled by both Video // and Audio players. first it should be handled by Video player if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete) { iSurfaceWindow->RemoveSurface(); } // KNotCompleteVideoError can be notified when video is not complete // ( missing sound ) but still can be played. Because // CMMAAudioPlayer::HandleEvent fails with all negative error codes, // do not call it with KNotCompleteVideoError error when preparing. if ((aEvent.iErrorCode != KNotCompleteVideoError) || (aEvent.iEventType != KMMFEventCategoryVideoPrepareComplete)) { CMMAAudioPlayer::HandleEvent(aEvent); } if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceCreated) { if (aEvent.iErrorCode == KErrNone) { TSurfaceId surfaceId; TRect cropRect; TVideoAspectRatio pixelAspectRatio; iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters(surfaceId, cropRect, pixelAspectRatio); if (iMMASurface.iPrevSurfaceAvailable) { // free Surface TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId); if (KErrNone != error) { ELOG1(EJavaMMAPI, "CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode); } } iMMASurface.iPrevSurfaceId = surfaceId; iMMASurface.iPrevSurfaceAvailable = ETrue; iSurfaceWindow->SetSurfaceParameters(surfaceId, cropRect, pixelAspectRatio); LOG(EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: KMMFEventCategoryVideoSurfaceCreated, surface parameters set"); } else { ELOG1(EJavaMMAPI, "CMMAVideoPlayer::HandleEvent: error getting surface parameters, %d", aEvent.iErrorCode); } } else if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceParametersChanged) { if (aEvent.iErrorCode == KErrNone) { TSurfaceId surfaceId; TRect cropRect; TVideoAspectRatio pixelAspectRatio; iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters(surfaceId, cropRect, pixelAspectRatio); if (iMMASurface.iPrevSurfaceAvailable) { // free Surface TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId); if (KErrNone != error) { LOG1(EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode); } } iMMASurface.iPrevSurfaceAvailable = ETrue; iMMASurface.iPrevSurfaceId = surfaceId; iSurfaceWindow->SetChangedSurfaceParameters(surfaceId, cropRect, pixelAspectRatio); LOG(EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: KMMFEventCategoryVideoSurfaceParametersChanged"); } else { ELOG1(EJavaMMAPI, "CMMAVideoPlayer::HandleEvent: surface parameters changed error, %d", aEvent.iErrorCode); } } else if (aEvent.iEventType == KMMFEventCategoryVideoRemoveSurface) { if (aEvent.iErrorCode == KErrNone) { if (iMMASurface.iPrevSurfaceAvailable) { // free Surface TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId); if (KErrNone != error) { ELOG1(EJavaMMAPI, "CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode); } iMMASurface.iPrevSurfaceAvailable = EFalse; } } else { ELOG1(EJavaMMAPI, "CMMAVideoPlayer::HandleEvent:KMMFEventCategoryVideoRemoveSurface error, %d", aEvent.iErrorCode); } } // video opened, preparing else if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete) { if (aEvent.iErrorCode == KErrNone) { TInt error = iVideoPlaySurfaceSupportCustomCommands.UseSurfaces(); ELOG1(EJavaMMAPI, "MMA::CMMAVideoPlayer::HandleEvent::After UseSurfaces(), error = %d", error); TInt prepareError(iVideoPlayControllerCustomCommands.Prepare()); if (prepareError != KErrNone) { // opening failed, notifying java PostActionCompleted(prepareError); } } else { // opening failed, notifying java PostActionCompleted(aEvent.iErrorCode); } } // final state of prefetch ( prepare completed ) else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete) { // This callback must be handled differently depending on whether // player is created for a file locator or for a stream. When file // locator is used, this callback is made in realized state. For // stream it is made in prefetched state. PrepareDisplay(); if (iFileName) { LOG(EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: Using filename, change state to REALIZED"); // If there is an error condition, then the player state is not // changed, which indicates the error condition to StartL when // the ActiveSchedulerWait returns. KNotCompleteVideoError is not // considered as an error condition, instead it indicates that some // elements of the media cannot be played (e.g. video OR audio) if (aEvent.iErrorCode == KErrNone || aEvent.iErrorCode == KNotCompleteVideoError) { ChangeState(ERealized); } __ASSERT_DEBUG(iActiveSchedulerWait->IsStarted(), User::Invariant()); iActiveSchedulerWait->AsyncStop(); } else { LOG(EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: Not using filename, change state to PREFETCHED"); CompletePrefetch(aEvent.iErrorCode); } } else // in case of any other event { if (aEvent.iErrorCode != KErrNone) { PostActionCompleted(aEvent.iErrorCode); //some other error } } }