void CPhoneCallMonitor::RunL()
	{
  	CTelephony::TCallStatus status = iCallStatus.iStatus;
  	
  	// use callback function to tell owner that call status has changed
  	//iCallBack.NotifyChangeInCallStatusL(status,errVal);
  	if(iStatus.Int() == KErrNone)
  	{
  	if(status == CTelephony::EStatusConnected)
  		{
		CTelephony::TRemotePartyInfoV1 remInfoUse;
  		CTelephony::TCallInfoV1		   callInfoUse;
  		CTelephony::TCallSelectionV1   callSelectionUse;
  		
  		// we are interested only voice lines
  		callSelectionUse.iLine = CTelephony::EVoiceLine;
  		// and calls that are currently connected
  		callSelectionUse.iSelect = CTelephony::EActiveCall;  //EHeldCall, EInProgressCall
  		
  		CTelephony::TRemotePartyInfoV1Pckg 	remParty(remInfoUse);
  		CTelephony::TCallInfoV1Pckg 		callInfo(callInfoUse);
  		CTelephony::TCallSelectionV1Pckg 	callSelection(callSelectionUse);
  		
  		// Some S60 devices have a bug that requires some delay in here
  		// othervise the telephone application gets "Out of Memory" error
  		User::After(100000);
  		if(KErrNone == iTelephony->GetCallInfo(callSelection,callInfo,remParty))
  			{
			if(remInfoUse.iDirection == CTelephony::EMobileOriginated) //outgoign call
				{
				iCallBack.NotifyConnectedCallStatusL(callInfoUse.iDialledParty.iTelNumber);
				}
			else   //incoming call
				{
				// if the call is mobile terminated then the remote party is the calling party.
				// TCallRemoteIdentityStatus::ERemoteIdentityUnknown, ERemoteIdentityAvailable, ERemoteIdentitySuppressed
				if(remInfoUse.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable)
					{
					iCallBack.NotifyConnectedCallStatusL(remInfoUse.iRemoteNumber.iTelNumber);
					}
				else  // private number
					{
					TBuf16<1> privNum;
					privNum.Zero();
					iCallBack.NotifyConnectedCallStatusL(privNum);
					}
				}
  			}
  		}
  	if(status == CTelephony::EStatusIdle)
  		{
		iCallBack.NotifyDisconnectedCallStatusL();
  		}
  	//iPreviousStatus = status;
  	}
	StartListeningForEvents();
	}
/**
@SYMTestCaseID				SYSLIB-CHARCONV-UT-4018
@SYMTestCaseDesc			Convert foreign character set to Unicode code 
@SYMTestPriority			High
@SYMTestActions				Test for ConvertToUnicode() with legal foreign characters, 0x00 - 0x7F
@SYMTestExpectedResults		Test must not fail
@SYMPREQ					PREQ22265
@SYMREQ						REQ10670
*/
void CT_TURKISHLOCKING::ConvertFromForeignToUnicodeL()
	{
	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-UT-4018 Testing encoding from Foreign to Unicode "));
	ReadDescL(generatedForeign, KInputForeignFilename, fileServerSession);
	TInt state=CCnvCharacterSetConverter::KStateDefault;
	test( 0 == characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state));
	ReadDescL(temp, KExpectUnicodeFilename, fileServerSession);
	originalUnicode.Zero();
	Unicode_Big(temp, originalUnicode); 
	test(generatedUnicode == originalUnicode);
	}	
Exemple #3
0
void CT_KOI8R::DoE32MainL()
	{
	RFs fileServerSession;
	CleanupClosePushL(fileServerSession);
	User::LeaveIfError(fileServerSession.Connect());
	CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* arrayOfCharacterSetsAvailable=\
		CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(fileServerSession);
	
	INFO_PRINTF1(_L("Available:\n"));
	for (TInt i=arrayOfCharacterSetsAvailable->Count()-1; i>=0; --i)
		{
		const CCnvCharacterSetConverter::SCharacterSet& charactersSet=(*arrayOfCharacterSetsAvailable)[i];
		characterSetConverter->PrepareToConvertToOrFromL(charactersSet.Identifier(), *arrayOfCharacterSetsAvailable, fileServerSession);
		TPtrC charactersSetName(charactersSet.Name());
		if (charactersSet.NameIsFileName())
			{
			charactersSetName.Set(TParsePtrC(charactersSetName).Name());
			}
		INFO_PRINTF2(_L("    %S\n"), &charactersSetName);
		}
	
	INFO_PRINTF1(_L("Encoding from Unicode to Foreign"));
	characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifier, *arrayOfCharacterSetsAvailable, fileServerSession);
	TBuf8<508> temp;
	TBuf16<254> originalUnicode;
	TBuf8<254> generatedForeign;
	TBuf16<254> generatedUnicode;
	ReadDescL(temp, KInputUnicodeFilename, fileServerSession);
	Merge_Big(temp, originalUnicode);
    test(characterSetConverter->ConvertFromUnicode(generatedForeign, originalUnicode) == 0);
	ReadDescL(temp, KExpectForeignFilename, fileServerSession);
	test(generatedForeign == temp);

	INFO_PRINTF1(_L("Encoding from Foreign to Unicode"));	
	ReadDescL(generatedForeign, KInputForeignFilename, fileServerSession);
	TInt state=CCnvCharacterSetConverter::KStateDefault;
	test( 0 == characterSetConverter->ConvertToUnicode(generatedUnicode, generatedForeign, state));
	ReadDescL(temp, KExpectUnicodeFilename, fileServerSession);
	originalUnicode.Zero();
	Merge_Big(temp, originalUnicode); 
	test(generatedUnicode == originalUnicode);
	
	CleanupStack::PopAndDestroy(3);
    }
TBool CTe_LbsIniFileReader::SetNextPoint()
{
    iIndex++;

    TBuf16<128> findText;

    findText.Zero();
    findText.Append(_L("["));
    findText.AppendNum(iIndex);
    findText.Append(_L("]"));

    iPoint = iPtr.Find(findText);

    if (iPoint == KErrNotFound)
    {
        return(EFalse);
    }

    return(ETrue);
}
Exemple #5
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
    {
    switch ( aCommand )
        {
        case EAknSoftkeyExit:
        case EEikCmdExit:
            Exit();
            break;
        case ECmdSwitchOutput:
            {
            HBufC* buffer = HBufC::NewLC( 100 );
            TPtr bufferPtr = buffer->Des();
            TBool last = ETrue;
            bufferPtr.Append(_L("Output switched to "));
            iFileOutputOn = !iFileOutputOn;
            if (iFileOutputOn)
                bufferPtr.Append(_L("file."));
            else
                bufferPtr.Append(_L("screen."));
            ShowL( *buffer, last );
            CleanupStack::PopAndDestroy( buffer );
            }
            break;
        case ECmdStatus:
            {
            ClearL();

            // layout
            HBufC* buffer = HBufC::NewLC( 100 );
            TPtr bufferPtr = buffer->Des();
            TBool last = ETrue;

            // Orientation
            bufferPtr.Append(_L("Orientation: "));
            bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation());
            ShowL( *buffer, last );
            bufferPtr.Zero();

            // Output
            bufferPtr.Append(_L("Output: "));
            if (iFileOutputOn) bufferPtr.Append(_L("File"));
            else bufferPtr.Append(_L("Screen"));
            ShowL( *buffer, last );
            bufferPtr.Zero();

            CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
            TInt hashValue = localAppScreenMode.ScreenStyleHash();
            TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
            TSize pixelSize = pixels.iPixelSize;

            bufferPtr.Append(_L("LayoutName: "));

            if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&&
                 (pixelSize.iHeight == 320 || pixelSize.iHeight == 240 ))
                 {
                if (hashValue==0x996F7AA7)
                    bufferPtr.Append(_L("QVGA2"));
                else
                    bufferPtr.Append(_L("QVGA1"));
                }
            else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&&
                    (pixelSize.iHeight == 360 || pixelSize.iHeight == 640 ))
                {
                bufferPtr.Append(_L("nHD"));
                }
            else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&&
                    (pixelSize.iHeight == 480 || pixelSize.iHeight == 640 ))
                {
                bufferPtr.Append(_L("VGA"));
                }
            else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&&
                    (pixelSize.iHeight == 800 || pixelSize.iHeight == 352 ))
                {
                bufferPtr.Append(_L("E90"));
                }
            else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 ||
                      pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&&
                    (pixelSize.iHeight == 320 || pixelSize.iHeight == 480 ||
                     pixelSize.iHeight == 240 || pixelSize.iHeight == 640))
                {
                bufferPtr.Append(_L("HVGA"));
                }
            else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 ||
                      pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&&
                    (pixelSize.iHeight == 800 || pixelSize.iHeight == 480 ||
                     pixelSize.iHeight == 848 || pixelSize.iHeight == 854))
                {
                bufferPtr.Append(_L("WVGA"));
                }
            else
                {
                bufferPtr.Append(_L("Unknown"));
                }

            ShowL( *buffer, last );
            bufferPtr.Zero();
            CleanupStack::PopAndDestroy( buffer );
            }
            break;
        case ECmdSwitchOrientation:
            {
            ClearL();
            HBufC* buffer = HBufC::NewLC( 100 );
            TPtr bufferPtr = buffer->Des();
            TBool last = ETrue;

            #ifndef __SERIES60_31__
            if (!iAvkonAppUi->OrientationCanBeChanged())
                {
                bufferPtr.Append(_L("Orientation cannot be changed."));
                ShowL( *buffer, last );
                bufferPtr.Zero();
                CleanupStack::PopAndDestroy( buffer );
                break;
                }
            #endif //__SERIES60_31__

            if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait)
                {
                iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
                }
            else if (iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationLandscape)
                {
                iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait);
                }
            else
                {
                // unspecified
                iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
                }
            bufferPtr.Append(_L("Orientation changed."));
            ShowL( *buffer, last );
            bufferPtr.Zero();
            CleanupStack::PopAndDestroy( buffer );
            break;
            }
        case ECmdStartCalculations:
            {
            ClearL();
            // Get known values
            TInt index = 0;
            TBool last = EFalse;
            if (iFileOutputOn)
                {
                TRect screenRect;
                AknLayoutUtils::LayoutMetricsRect(
                    AknLayoutUtils::EApplicationWindow,
                    screenRect );

                // Add screen dimensions
                TInt height = screenRect.Height();
                TInt width = screenRect.Width();
                TBuf16<32> tgt;
                // HEIGHT
                tgt.Append(_L("height: \t"));
                tgt.AppendNum(height, EDecimal); // put max height into text file
                ShowL( tgt, last );
                tgt.Zero();
                // WIDTH
                tgt.Append(_L("width: \t"));
                tgt.AppendNum(width, EDecimal); // put max width into text file
                ShowL( tgt, last );
                tgt.Zero();
                // VERSION
                TPixelMetricsVersion version = PixelMetrics::Version();
                tgt.Append(_L("major_version: \t"));
                tgt.AppendNum(version.majorVersion, EDecimal); // put major version into text file
                ShowL( tgt, last );
                tgt.Zero();
                tgt.Append(_L("minor_version: \t"));
                tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file
                ShowL( tgt, last );
                tgt.Zero();
                }

            TInt myValue = KErrNotFound;
            for (;;)
                {
                if (index==QStyle::PM_Custom_MessageBoxHeight)
                    {
                    last = ETrue;
                    }
                myValue = PixelMetrics::PixelMetricValue(static_cast<QStyle::PixelMetric>(index));
                ShowSingleValueL( index, myValue, last );

                if (last) break;
                // if last before custom values, "jump" to custom base
                if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase;
                index++;
                }
            }
            break;
        case ECmdCreateHeaderFile:
            CreateHeaderFileL();
            break;
        default:
            break;
        }
    }
EXPORT_C void CIpuTestHarness::GetAnEntry(const TDesC& ourPrompt, TDes& currentstring)
//
//	Get an input string from the user, displaying a supplied prompt and default string value
	{
	// If we're scripting, try reading from script first
	TInt readScriptErr = KErrNotFound;
	if (iScriptRunning)
		{
		readScriptErr = ReadLineFromScript(currentstring);
		}
	if (!readScriptErr)
		return;

	// Either not scripting, or hit end of script - continue with user input
	TBuf16<KMaxUserEntrySize> ourLine;
	TBuf<KMaxUserEntrySize> tempstring;				//tempstring is a unicode descriptor
										//create a temporary buffer where the
										//unicode strings are stored in order to 
										//be displayed
	ourLine.Zero ();
	tempstring.Copy(currentstring);		//Copy current string to Unicode buffer
	TKeyCode key = EKeyNull;						//current string buffer is 8 bits wide.
										//Unicode string bufffer (tempstring) is 16 bits wide.
	for (;;)
		{
		if (ourLine.Length () == 0)
			{
			iTest.Console()->SetPos (0, iTest.Console()->WhereY ());
			iTest.Console()->Printf (_L ("%S"), &ourPrompt);
			if (tempstring.Length () != 0)						//get tempstring's number of items
				iTest.Console()->Printf (_L (" = %S"), &tempstring);	//if not zero print them to iTest.Console()
			iTest.Console()->Printf (_L (" : "));
			iTest.Console()->ClearToEndOfLine ();
			}
		key = iTest.Getch();
		
		  if (key == EKeyBackspace)
				{
					if (ourLine.Length() !=0)
					{
						ourLine.SetLength(ourLine.Length()-1);
						iTest.Console()->Printf (_L ("%c"), key);
						iTest.Console()->SetPos(iTest.Console()->WhereX(),iTest.Console()->WhereY());
						iTest.Console()->ClearToEndOfLine();
					}	// end if (ourLine.Length() !=0)
				}	// end if (key == KeyBackSpace)
		  
		  		  
		  if (key == EKeyDelete) 			
				{
					ourLine.Zero();
					iTest.Console()->SetPos (0, iTest.Console()->WhereY ());
					iTest.Console()->ClearToEndOfLine ();
					tempstring.Copy(ourLine);
					break;
				}
		  
		  if (key == EKeyEnter)
			break;
		
		  if (key < 32)
			{
			continue;
			}
		
		ourLine.Append (key);
		iTest.Console()->Printf (_L ("%c"), key);
		iTest.Console()->SetPos(iTest.Console()->WhereX(),iTest.Console()->WhereY());
		iTest.Console()->ClearToEndOfLine();
		if (ourLine.Length () == ourLine.MaxLength ())
			break;
		}	// end of for statement

	if ((key == EKeyEnter) && (ourLine.Length () == 0))
		tempstring.Copy (currentstring);				//copy contents of 8 bit "ourLine" descriptor
	
	iTest.Console()->SetPos (0, iTest.Console()->WhereY ());		
	iTest.Console()->ClearToEndOfLine ();
	iTest.Console()->Printf (_L ("%S"), &ourPrompt);
	
	if ((key == EKeyEnter) && (ourLine.Length() !=0))
		tempstring.Copy(ourLine);
	if (tempstring.Length () != 0)						//if temstring length is not zero
		{
		iTest.Console()->Printf (_L (" = %S\n"), &tempstring);	//print the contents to iTest.Console()
		LogIt(_L ("%S = %S\n"), &ourPrompt, &tempstring);
		}

	else
		//iTest.Console()->Printf (_L (" is empty"));
	iTest.Console()->Printf (_L ("\n"));
	currentstring.Copy(tempstring);						//copy 16 bit tempstring descriptor back 
	}