GUI::EEventStatus::Enum GGenericQuestionWindow::OnMouseClick(const GEventData & in_EventData, GUI::GBaseObject* in_pCaller)
{
   if(!in_pCaller)
      return GUI::EEventStatus::Handled;
   
   if((in_EventData.Mouse.Actor.Bits.Left || in_EventData.Mouse.Down.Bits.Left) &&  m_bEventSent == false)
   {

      if(in_pCaller == m_pObjOkBtn)
      {
         //Notify any potential observer
         NotifyObserver(c_OnGenericQuestionWindowAnswerOk,this);

         // Make some noise
         g_SP2Client->PlaySound(ESoundEventID::ConfirmOrder);
      }
      else if(in_pCaller == m_pObjCancelBtn)
      {
         //Notify any potential observer
         NotifyObserver(c_OnGenericQuestionWindowAnswerCancel,this);
      }

      if(in_pCaller == m_pObjCancelBtn || in_pCaller == m_pObjOkBtn)
      {
         m_OpenQuestionWindow.remove(this);
         KillMe();
      }
   }

   return GUI::EEventStatus::Handled;
}
// ---------------------------------------------------------------------------
// CActivityManager::RunL()
// ---------------------------------------------------------------------------
//
void CActivityManager::RunL()
    {    
    OstTraceFunctionEntry0( CACTIVITYMANAGER_RUNL_ENTRY );
    if(iFirstRound)
        {        
        iFirstRound = EFalse;
        if (!IsActive())
             {
             iWatch = EWaitingForInactivity;
             iTimer.Inactivity(iStatus, iTimeout);
             SetActive();
             }
        NotifyObserver();
        OstTraceFunctionExit0( CACTIVITYMANAGER_RUNL_EXIT );
        return;
        }
    
    if (iStatus == KErrNone)
        {
        if (iWatch == EWaitingForInactivity)
            {
            TInt inactivity = User::InactivityTime().Int();
            if (inactivity >= iTimeout)
                {                
                NotifyObserver();

                if (!IsActive()) //observer might have called a Reset()
                    {
                    iTimer.Inactivity(iStatus,0);
                    iWatch = EWaitingForActivity;
                    }
                }
            else
                {
                iTimer.Inactivity(iStatus,iTimeout);
                }
            }
        else if (iWatch == EWaitingForActivity)
            {            
            NotifyObserver();
             
            if (!IsActive()) //observer might have called a Reset()
                {
                iTimer.Inactivity(iStatus,iTimeout);
                iWatch = EWaitingForInactivity;
                }
            }
    
        if (!IsActive()) //observer might have called a Reset()
            {
            SetActive();
            }
        }
    else
        {
        iWatch = ENone;
        }      
    OstTraceFunctionExit0( DUP1_CACTIVITYMANAGER_RUNL_EXIT );
    }
Beispiel #3
0
void
URLSearchParams::Delete(const nsAString& aName)
{
  if (mParams->Delete(aName)) {
    NotifyObserver();
  }
}
// ---------------------------------------------------------------------------
// Response received
// ---------------------------------------------------------------------------
//	
TBool CCatalogsHttpTransaction::ResponseReceived( TInt aResponseStatusCode, 
    const TDesC8& aResponseStatusText )
    {    
    DLTRACEIN(( "%d, text: %S", aResponseStatusCode, 
        &aResponseStatusText ));

    iResponseStatusCode = aResponseStatusCode;
    
    iResponseStatusText = aResponseStatusText.Alloc();
    
    if ( !iResponseStatusText )
        {
        return HandleHttpError( ECatalogsHttpErrorGeneral, KErrNoMemory );        
        }

    
    if ( aResponseStatusCode >= 400 ) 
        {
        iState.iOperationState = ECatalogsHttpOpFailed;
        
        return iObserver->HandleHttpError( *this, TCatalogsHttpError( 
            ECatalogsHttpErrorHttp, 
            KCatalogsErrorHttpBase - aResponseStatusCode ) );
        }
    else 
        {
        iState.iOperationState = ECatalogsHttpOpInProgress;
        iState.iProgressState = ECatalogsHttpConnected;        
        NotifyObserver();
        }
    DLTRACEOUT((""));
    return EFalse;
    }
void
URLSearchParams::Append(const nsAString& aName, const nsAString& aValue)
{
  // Before setting any new value we have to be sure to have all the previous
  // values in place.
  Validate();

  AppendInternal(aName, aValue);
  NotifyObserver();
}
void
URLSearchParams::Delete(const nsAString& aName)
{
  // Before deleting any value we have to be sure to have all the previous
  // values in place.
  Validate();

  nsTArray<nsString>* array;
  if (!mSearchParams.Get(aName, &array)) {
    return;
  }

  mSearchParams.Remove(aName);

  NotifyObserver();
}
// -----------------------------------------------------------------------------
// LightStatusChanged()
// -----------------------------------------------------------------------------
//
void CActivityManager::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
    {    
    if(aTarget & CHWRMLight::EPrimaryDisplay)
        {
         if( aStatus == CHWRMLight::ELightOff )
            {
            iLights = EFalse;
            }
        else
            {
            iLights = ETrue;
            }
     
        NotifyObserver();
        }
    }
void Arena::Update()
{
	currentTime = (std::clock() - startTime) / CLOCKS_PER_SEC;
	player1->Update();
	player2->Update();

	if (lifeP1 != m_listPlayer->at(0)->life || lifeP2 != m_listPlayer->at(1)->life || currentTime ==maxTime)
	{
		
		lifeP1 = m_listPlayer->at(0)->life;
		lifeP2 = m_listPlayer->at(1)->life;
		NotifyObserver();

	}
	

}
// 시리얼 통신을 정보를 주고 받는다.
// 통신이 끊겼다면 false를 리턴한다.
bool cSerialCommunication::ProcessSerialCommunicatoin(const float deltaSeconds)
{
	RETV(!m_serial.IsOpened(), false);

/*
	char data = 0;
	const int readLength = m_serial.ReadData(&data, 1);
	if (readLength == 0)
		return true;

	RETV(readLength < 0, false);

	m_buff[m_currentBuffIndex++] = data;

	const bool isEndOfBuffer = (m_currentBuffIndex >= (MAX_BUFFER - 1));

	// 한 라인이 모두 완성되었다면, 정보를 분석한다.
	if (isEndOfBuffer || (data == '\n'))
	{
		m_buff[m_currentBuffIndex] = NULL;

// 		float t, roll, pitch, yaw;
// 		sscanf_s(m_buff, "Radian, %f, %f, %f, %f", &t, &roll, &pitch, &yaw);
//		cController::Get()->GetCubeFlight().SetEulerAngle(-roll, yaw, -pitch);

		// 시리얼통신으로 넘어온 정보를 옵져버에게 알린다.
		NotifyObserver(m_buff);

		m_currentBuffIndex = 0;
	}
*/

	//string buff;
	char buff[512];
	int len;
	if (m_serial.ReadStringUntil('\n', buff, len, sizeof(buff)))
	{
		// 시리얼통신으로 넘어온 정보를 옵져버에게 알린다.
		//if (!buff.empty())
		if (len > 0)
			NotifyObserver((char*)&buff[0]);
	}

	return true;
}
void
URLSearchParams::Set(const nsAString& aName, const nsAString& aValue)
{
  // Before setting any new value we have to be sure to have all the previous
  // values in place.
  Validate();

  nsTArray<nsString>* array;
  if (!mSearchParams.Get(aName, &array)) {
    array = new nsTArray<nsString>();
    array->AppendElement(aValue);
    mSearchParams.Put(aName, array);
  } else {
    array->ElementAt(0) = aValue;
  }

  NotifyObserver();
}
// ---------------------------------------------------------------------------
// Received a part of the response
// ---------------------------------------------------------------------------
//	
TBool CCatalogsHttpTransaction::ResponseBodyReceived( const TDesC8& aData )
    {
    DLTRACEIN( ( "" ) );
    DASSERT( iObserver );
    
    iState.iOperationState = ECatalogsHttpOpInProgress;    
    iState.iProgressState = ECatalogsHttpResponseBodyReceived;
    
    // Set body to point to response body
    iResponseBody.Set( aData );
    
    iTransferredLength += iResponseBody.Length();
       
    DLTRACE( ( "Calling observer" ) );
    NotifyObserver();
    
    DLTRACE( ( "Observer finished" ) );
    
    // Response body back to empty
    iResponseBody.Set( KNullDesC8 );
    return ETrue;
    }
Beispiel #12
0
void
URLSearchParams::Append(const nsAString& aName, const nsAString& aValue)
{
  mParams->Append(aName, aValue);
  NotifyObserver();
}
Beispiel #13
0
void
URLSearchParams::Set(const nsAString& aName, const nsAString& aValue)
{
  mParams->Set(aName, aValue);
  NotifyObserver();
}
// ---------------------------------------------------------------------------
// Request completed
// ---------------------------------------------------------------------------
//	
void CCatalogsHttpTransaction::DoRequestCompletedL( TInt aError )
    {
    DLTRACEIN( ("Error: %d", aError ) );

    iOwner.CompleteOperation( this );    
    
    if ( ( aError == KErrDisconnected ) && 
         iRetryCount && 
         iState.iProgressState < ECatalogsHttpResponseHeaderReceived )
        {
        DLTRACE(("Retrying"));
        iRetryCount--;
        
        // This ensures that connection is reset for this op
        ReleasePtr( iConnection );
        
        iState.iOperationState = ECatalogsHttpOpCreated;
        iState.iProgressState = ECatalogsHttpNone;
        
        // Start asynchronously so that CCatalogsHttpStack is not deleted
        // inside an MHFRunL-callback
        AsyncStartL();        
        return;
        }

    
    if ( aError == KErrNone ) 
        {        
        iState.iOperationState = ECatalogsHttpOpCompleted;
        iState.iProgressState = ECatalogsHttpDone;
        // Report to the observer
        NotifyObserver();
        
        }
    else 
        {        
        DLTRACE(("Handling error"));
        iState.iOperationState = ECatalogsHttpOpFailed;        
        
        // HandleHttpError would also Cancel the operation but it's
        // already been complete by CompleteOperation
        if ( aError < KErrNone ) 
            {
            UpdateAccessPoint( TCatalogsConnectionMethod() );
            
            // Symbian error codes
            iObserver->HandleHttpError( *this, TCatalogsHttpError( 
                ECatalogsHttpErrorGeneral, aError ) );

            }
        else 
            {
            
            // HTTP errors
            iObserver->HandleHttpError( *this, TCatalogsHttpError( 
                ECatalogsHttpErrorHttp, 
                KCatalogsErrorHttpBase - aError ) );
            }
        }

    DLTRACEOUT((""));
    }
// ---------------------------------------------------------------------------
// Received a response header
// ---------------------------------------------------------------------------
//	
void CCatalogsHttpTransaction::ResponseHeaderReceived( const TDesC8& aHeader, 
    const TDesC8& aValue )
    {
    DLTRACEIN( ("") );
    DASSERT( iObserver );
    
    TRAPD( err, iResponseHeaders->AddHeaderL( aHeader, aValue ) );        
    if ( err != KErrNone )
        {
        HandleHttpError( ECatalogsHttpErrorGeneral, err );
        return;
        }
        
    iState.iOperationState = ECatalogsHttpOpInProgress;
    iState.iProgressState = ECatalogsHttpResponseHeaderReceived;
         
    
    if ( aHeader.CompareF( KHttpContentRangeHeader ) == 0 )
        {
        //
        // Content-Range, bytes x-y/z
        // Extract 'z' and use it as the total content length
        //
        TPtrC8 ptr( aValue );
        TInt offset = ptr.Locate( '/' );
        if ( offset != KErrNotFound )
            {
            TLex8 val;
            val.Assign( ptr.Mid( offset + 1 ) );

            TInt value;
            TInt err = val.Val( value );
            if ( err == KErrNone )
                {
                iContentLength = value;
                DLTRACE(( "Content length: %i", iContentLength ));
                }
            }
        }
    else if ( aHeader.CompareF( KHttpContentLengthHeader ) == 0 )
        {
        //
        // If content length for this request has not been already set
        // e.g. from a Content-Range header, extract from Content-Length header
        //
        if ( iContentLength == 0 )
            {
            TLex8 val;
            val.Assign( aValue );

            TInt value;
            TInt err = val.Val( value );
            if ( err == KErrNone )
                {
                iContentLength = value;
                DLTRACE(( "Content length: %i", iContentLength ));
                }                
            }
        else
            {
            DLTRACE(( "-> ContentLength set, ignoring" ));
            }
        }
    else if ( aHeader.CompareF( KHttpContentTypeHeader ) == 0 ) 
        {
        // Content type from the header
        DLTRACE( ( "Content type received" ) );
        
        TRAPD( err, SetContentTypeL( aValue ) );
        if ( err != KErrNone ) 
            {
            DLTRACE( ( "Content type setting failed with err: %i",
                err ) );
            HandleHttpError( ECatalogsHttpErrorGeneral, err );
            return;
            }          
        else 
            {
            iState.iProgressState = ECatalogsHttpContentTypeReceived;
            }
        }
         
    // Report the observer that a header has been received
    NotifyObserver();
    }