Esempio n. 1
0
/**
   @SYMTestCaseID T-RApaLsSessionTestStep-TestServiceDiscovery24
  
   @SYMPREQ 538
  
   @SYMTestPriority  High
  
   @SYMTestStatus Implemented

   @SYMTestCaseDesc Test the functionality ofAppForDocumentAndService given an undefined file name
   
   @SYMTestActions  Call AppForDocumentAndService with two parameters: a filename, a service uid, an
   app uid and the datatype requested
   on z: drive.\n
   API Calls:\n	
   RApaLsSession::AppForDocumentAndService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const
   
   @SYMTestExpectedResults Returns KErrNone.The value returned for appuid is null.The returned value for the datatpe
   is null.
    
 */	
void CT_ServicesTestStep::TestServiceDiscovery24()
	{
	// AppForDocumentAndService test cases
	INFO_PRINTF1(_L("TestServiceDiscovery24 about to start..."));
	TInt ret(0);
	TUid appUid=KNullUid;
	const TUid KUidService = {0x01020304};
    TDataType dataType;
    ret = iApaLsSession.AppForDocumentAndService(_L(""), KUidService, appUid, dataType);	
	TEST(ret==KErrNone);
	TEST(appUid==KNullUid);
	TEST(dataType.Uid()==KNullUid);
	}
Esempio n. 2
0
TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem )	
	{

    TInt ret( KErrNone );
    // Print to UI
    TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") );

    TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ;
    TPtrC8 data (GetNextStringLC( aItem, _L("datafile"))->Des() );
    
	HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ;
    SetURIL( nodename );
    
    TPtrC8 parentURI(RemoveLastSeg(nodename));
    HBufC8 *luid = GetLuidAllocLC( parentURI );
    
    TDataType type; 

	TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() );

    /**
    virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
									const TDesC8& aObject, const TDesC8& aType,
									TInt aStatusRef ) = 0;
    */
    
	Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3);

	if ( iStatus == MSmlDmAdapter::EOk )
	{
		iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus );	
	}
	else
	{
		iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus );	
		ret = KErrGeneral ;
	}

	CleanupStack::PopAndDestroy(); // loadfile
	CleanupStack::PopAndDestroy(); // luid
	CleanupStack::PopAndDestroy(); // mime
	CleanupStack::PopAndDestroy(); // nodename

	iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret );	

    return ret;
	}	
Esempio n. 3
0
/**
   @SYMTestCaseID T-RApaLsSessionTestStep-TestServiceDiscovery26
  
   @SYMPREQ 538
   
   @SYMTestPriority  High
  
   @SYMTestStatus Implemented
  
   @SYMTestCaseDesc Test the functionality ofAppForDocumentAndService given a file, service uid,file server and undefined file name 
   
   @SYMTestActions  Call AppForDocumentAndService with two parameters: a filename, a service uid, an
   app uid and the datatype requested
   on z: drive.\n
   API Calls:\n	
   RApaLsSession::AppForDocumentAndService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const
   
   @SYMTestExpectedResults Returns KErrBadHandle. The app uid is set to null, the uid of datatype is set to null
    
 */	
void CT_ServicesTestStep::TestServiceDiscovery26()
	{
	INFO_PRINTF1(_L("TestServiceDiscovery26 about to start..."));
	const TUid KUidService = {0x01020304};
	TInt ret(0);
	TUid appUid=KNullUid;
	TDataType dataType;
	RFile file;
	_LIT(KOneByteFileName, "z:\\system\\data\\imaginary_byte.txt");
	RFs fs;
	ret = fs.Connect();
	ret = fs.ShareProtected();
	ret = file.Open(fs, KOneByteFileName, EFileRead|EFileShareAny);
	TEST(ret==KErrNotFound);
	ret = iApaLsSession.AppForDocumentAndService(file, KUidService, appUid, dataType);
	TEST(appUid==KNullUid);
	TEST(dataType.Des8().Length()==0);
	TEST(ret==KErrBadHandle);	
	fs.Close();

	}
// ---------------------------------------------------------------------------
// CThumbnailAudioProvider::GetThumbnailL()
// Provides the thumbnail image
// ---------------------------------------------------------------------------
//
void CThumbnailAudioProvider::GetThumbnailL( RFs& aFs, RFile64& aFile, const
    TDataType& aMimeType  , const CThumbnailManager::TThumbnailFlags aFlags,
    const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference /*aQualityPreference*/  )
    {   
    TN_DEBUG1( "CThumbnailAudioProvider::GetThumbnailL() - rfile " );
    OstTrace0( TRACE_NORMAL, CTHUMBNAILAUDIOPROVIDER_GETTHUMBNAILL, "CThumbnailAudioProvider::GetThumbnailL - rfile" );
    CMetaDataUtility* metaDataUtil = CMetaDataUtility::NewL();
    CleanupStack::PushL( metaDataUtil );
    
    RArray<TMetaDataFieldId> wantedFields;
    CleanupClosePushL(wantedFields);
    wantedFields.AppendL(EMetaDataJpeg);
    
    metaDataUtil->OpenFileL(aFile, wantedFields, aMimeType.Des8());
    const CMetaDataFieldContainer& metaCont = metaDataUtil->MetaDataFieldsL();
    TPtrC8 ptr = metaCont.Field8( EMetaDataJpeg );
    HBufC8* data = ptr.AllocL();
    
    CleanupStack::PopAndDestroy(&wantedFields);
    CleanupStack::PopAndDestroy(metaDataUtil);
    CleanupStack::PushL( data );
    
    if(data->Length() == 0)
      {
      User::Leave( KErrNotFound );            
      }
    
    if ( !iImageDecoderv3 )
        {
        iImageDecoderv3 = new( ELeave )CThumbnailImageDecoderv3( aFs );
        }
    
    iMimeType = TDataType(KJpegMime);
    iFlags = aFlags;
	//set default mode displaymode from global constants
    iDisplayMode = KStoreDisplayMode;
    TRAPD( err, iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize ) );
    if (err == KErrNone)
        {
        CleanupStack::Pop( data );
        }
    else
        {
        // this is because data buffer is already released in CreateDecoderL
        // and we must prevent automatic PopAndDestroy
        CleanupStack::Pop( data );
        User::Leave(err);
        } 
    
    iOriginalSize = iImageDecoderv3->OriginalSize();
    iImageDecoderv3->DecodeL( iDisplayMode );
    }
void CAknFileSelectionModel::AppendIconForFileL(const TDesC& aFileName)
    {
    //TFileName absFileName( iCurrentPath.DriveAndPath() );
    HBufC *bufAbsFileName = HBufC::NewLC(KMaxPath);
    *bufAbsFileName = iCurrentPath.DriveAndPath();
    TPtr absFileName = bufAbsFileName->Des();

    absFileName.Append( aFileName );
    TUid uidIgnore;
    TDataType dataType;
    TInt err = iApaSession.AppForDocument( absFileName, uidIgnore, dataType );
    TInt iconIndex = EUnknowTypeIcon;
    CleanupStack::PopAndDestroy(); //bufAbsFileName

    if( err != KErrNone )
        {
        // Couldn't find out the data type, use generic file icon:
        iconIndex = EUnknowTypeIcon;
        }
    else
        {
        HBufC *bufDataTypeBuf = HBufC::NewLC(KMaxDataTypeLength);
        *bufDataTypeBuf = dataType.Des();
        TPtr dataTypeBuf = bufDataTypeBuf->Des();

        if( dataTypeBuf.MatchF( KCFDMimeTypeAudioVoiceRec ) == 0 ||
            dataTypeBuf.MatchF( KCFDMimeTypeAudioVoiceRec2 ) == 0 )
            {
            iconIndex = EVoiceRecFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypePlaylist ) == 0 )
            {
            iconIndex = EPlaylistFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeRam ) == 0 )
            {
            iconIndex = ELinkFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeAudio ) == 0 )
            {
            iconIndex = ESoundFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeImageGms ) == 0 )
            {
            iconIndex = EGmsFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeImage ) == 0 )
            {
            iconIndex = EImageFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeVideo ) == 0 ||
                 dataTypeBuf.MatchF( KCFDMimeTypeVideoRealMedia ) == 0 ||
                 dataTypeBuf.MatchF( KCFDMimeTypeVideoSdp ) == 0 )
            {
            iconIndex = EVideoFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeGame ) == 0 )
            {
            iconIndex = EGameFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeNote ) == 0 )
            {
            iconIndex = ENoteFileIcon;
            }
        else if( dataTypeBuf.MatchF( KCFDMimeTypeJava ) == 0 )
            {
            iconIndex = EJavaFileIcon;
            }
        else if ( dataTypeBuf.MatchF( KCFDMimeTypeFlash ) == 0 )
            {
            iconIndex = EFlashFileIcon;
            }
        else
            {
            // Check from the file name extension, if it's a SIS file:
            //TParse fileName;
            //fileName.Set( aFileName, NULL, NULL );

            HBufC * bufFileName = aFileName.AllocLC();
            TPtr ptrFileName = bufFileName->Des();
            TParsePtr fileName(ptrFileName);

            TPtrC ext( fileName.Ext() );
            if( ext.CompareF( KCFDFileExtSis ) == 0
                || ext.CompareF( KCFDFileExtSisx ) == 0 )
                {
                iconIndex = ESisFileIcon;
                }
            // RApaLsSession does not recognize .mid's:
            else if( ext.CompareF( KCFDFileExtMid ) == 0 )
                {
                iconIndex = ESoundFileIcon;
                }
            else
                {
                iconIndex = EUnknowTypeIcon;
                }
            CleanupStack::PopAndDestroy(); //bufFileName

            }

        CleanupStack::PopAndDestroy(); //bufDataTypeBuf
        }
    iImageIndexArray.Append( iconIndex );
    }
void MsgAudioPreview::PlayL()
    {
    if( IsPlaying() )
        {
        Stop();
        return;
        }
    //sequence for playing a beep once sound
    _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\
    \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); 

    // rng mime type
    _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" );
    
    Cancel(); // stop previous play
    
    if ( !iFullName || iFullName->Des().Length() == 0 )
        {
        User::Leave( KErrNotFound );
        }

    TRAP_IGNORE( ReadActiveProfileL() );

    TPtrC fileName( iFullName->Des() );
    TDataType dataType;
    TInt err = GetDataType( fileName, dataType );
    if ( err == KErrNotFound )
        {
        fileName.Set( iDefaultTone );
        if ( fileName.Length() == 0 )
             {
             User::Leave( KErrNotFound );
             }
        }
    else if ( err != KErrNone )
        {
        User::Leave( err );
        }
        
    TBool mimeTypeRng = EFalse;
    
    if ( err == KErrNone )
        {
        if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 )
            {
            mimeTypeRng = ETrue;
            }
        }

    TInt ringingType = RingingType();
    if ( ringingType == ERingingTypeBeepOnce )
        {
        // Active profile ringing tone is set to Beep Once
        // Don't initialize a FileSequence but use DesSequence instead
        iTonePlayer = CMdaAudioToneUtility::NewL( *this );
        iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() );
        iTonePlayerStatus = EPlayerInitializing;
        }
    else
        {
        if( mimeTypeRng )
            {
            //Ringingtone is a RNG-file
            iTonePlayer = CMdaAudioToneUtility::NewL( *this );
            iTonePlayer->PrepareToPlayFileSequence( fileName );
            iTonePlayerStatus = EPlayerInitializing;
            }
        else
            {
            delete iAudioPlayer;
            iAudioPlayer = 0;

            iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL(
                fileName, *this, KAudioPriorityRingingTonePreview,
                ( TMdaPriorityPreference )KAudioPrefRingFilePreview );
    
            iAudioPlayerStatus = EPlayerInitializing;
            }
        }
    DisableBackLight();
    }
Esempio n. 7
0
TVerdict CMultipartContent::doTestStepL()
	{
	_LIT(KxcafMime, "application/x-caf");
	
	TPtrC contentXml;
	TPtrC contentXml2;
	TPtrC outputFile;
	TPtrC outputFile2;
	TPtrC contentFile;
	TPtrC contentFile2;
	GetStringFromConfig(ConfigSection(),_L("ContentDescription"),contentXml);
	GetStringFromConfig(ConfigSection(),_L("ContentDescription2"),contentXml2);
	GetStringFromConfig(ConfigSection(),_L("OutputFile"),outputFile);
	GetStringFromConfig(ConfigSection(),_L("OutputFile2"),outputFile2);
	GetStringFromConfig(ConfigSection(),_L("ContentFile"), contentFile);
	GetStringFromConfig(ConfigSection(),_L("ContentFile2"), contentFile2);
	__UHEAP_MARK;	
	
	INFO_PRINTF1(_L("Creating DRM archive using the following parameters"));
	INFO_PRINTF2(_L("		Content Xml Description : %S"),&contentXml);
	INFO_PRINTF2(_L("		Output File             : %S"),&outputFile);
	INFO_PRINTF2(_L("		Output File2             : %S"),&outputFile2);
	INFO_PRINTF2(_L("		Content File            : %S"),&contentFile);
	INFO_PRINTF2(_L("		Content File2            : %S"),&contentFile2);

	// will need to modify the output file name
	TFileName outputFileName;
	TFileName outputFileName2;
	outputFileName.Copy(outputFile);
	outputFileName2.Copy(outputFile2);

	TBuf8 <KMaxDataTypeLength> mimeType;
	
	// Pass empty path to rights file to produce a ".content" file
	User::LeaveIfError(CRefTestAgentArchive::CreateArchive(contentXml, _L(""), outputFileName, mimeType));
	User::LeaveIfError(CRefTestAgentArchive::CreateArchive(contentXml2, _L(""), outputFileName2, mimeType));


	TDataType dataType;
	TUid uid = KNullUid;

	// Use the Application Architecture Server to find the Mime type 

	RApaLsSession apparcSession;
	User::LeaveIfError(apparcSession.Connect());
	CleanupClosePushL(apparcSession);
	User::LeaveIfError(apparcSession.AppForDocument(contentFile, uid, dataType));
	// dataType should be of type "application/x-caf"
	if (dataType.Des() != KxcafMime)
    	{
    	SetTestStepResult(EFail);
    	}
	User::LeaveIfError(apparcSession.AppForDocument(contentFile2, uid, dataType));
	// dataType should not be of type "application/x-caf"
	if (dataType.Des() == KxcafMime)
    	{
    	SetTestStepResult(EFail);
    	}
    
    CleanupStack::PopAndDestroy(&apparcSession);
    
    __UHEAP_MARKEND;
    
    
    
	return TestStepResult();
	}