EXPORT_C
COmxILComponent::~COmxILComponent()
{
    DEBUG_PRINTF(_L8("COmxILComponent::~COmxILComponent"));
    delete ipImpl;
}
void TestVFATCase1()
	{
	test.Next(_L("Test Without VFAT entry, but DOS entry uses CP932 Japanese file's access"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	GetBootInfo();

   	RFile file;
  	TFileName fn = _L("\\ABCD");
  	
  	TInt r=file.Create(TheFs,fn,EFileRead);
  	testAndLog(r==KErrNone);
  	file.Close();
  
  	//	Assume this file is the first entry in the root directory
  	r=TheDisk.Open(TheFs,CurrentDrive());
  	testAndLog(r==KErrNone);

    //-- read the 1st dir entry, it should be a DOS entry 
    const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
      
    TFatDirEntry fatEntry1;
 	TPtr8 ptrEntry1((TUint8*)&fatEntry1,sizeof(TFatDirEntry));
	testAndLog(TheDisk.Read(posEntry1, ptrEntry1)==KErrNone); 
	testAndLog(!fatEntry1.IsVFatEntry());

	// Manually modify the short name into unicode characters
	// 	Unicode: 	0x(798F 5C71 96C5 6CBB)
	//	Shift-JIS: 	0x(959F 8E52 89EB 8EA1)

	TBuf8<8> unicodeSN = _L8("ABCD1234");
	unicodeSN[0] = 0x95;
	unicodeSN[1] = 0x9F;
	unicodeSN[2] = 0x8E;
	unicodeSN[3] = 0x52;
	unicodeSN[4] = 0x89;
	unicodeSN[5] = 0xEB;
	unicodeSN[6] = 0x8E;
	unicodeSN[7] = 0xA1;

	fatEntry1.SetName(unicodeSN);
	testAndLog(TheDisk.Write(posEntry1, ptrEntry1)==KErrNone);
	TheDisk.Close();

  	// The Unicode file name of the file that is created
  	fn = _L("\\ABCD");
  	fn[1] = 0x798F;
  	fn[2] = 0x5C71;
  	fn[3] = 0x96C5;
  	fn[4] = 0x6CBB;
  	
  	// Access the file using its unicode file name without the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
  	TEntry entry;
  	TInt err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNotFound);
  	
      // Access the file using its unicode file name with the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);  	
	test_KErrNone(r);
 	r = UserSvr::ChangeLocale(KTestLocale);  	
	test_KErrNone(r);
  
  	err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNone);
  	
  	//file is no more required,delete it.
  	err = TheFs.Delete(fn);
  	testAndLog(err==KErrNone);
  	
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
 	r=TheFs.SessionPath(gSessionPath);
  	test_KErrNone(r);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
//
// ----------------------------------------------------------------------------------
// CASYStubCmdHandlerBase::ProcessCommandL()
// ----------------------------------------------------------------------------------
// 
void CASYStubCmdHandlerBase::ProcessCommandL( const TProcessCmdId aCommand,
    const TASYCmdParams& aCmdParams )
    {

    COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - Enter" ) ) );

    CASYMainServiceBase* mainServiceBase = ASYMainServiceBase();
    COMPONENT_TRACE(
        ( _L( "AsyStub - CASYStubCmdHandlerBase::ProcessCommandL - mainServiceBase (0x%x)" ), &mainServiceBase ) );

    TASYCommandParamRecord cmdParams( aCmdParams() );//For debugging

    if( aCommand == ECmdGetObjectValue || aCommand == ECmdSetObjectValue )
        {
        ProcessObjectL( aCommand, aCmdParams );
        }
    else
        {
        CASYStubMainServiceBase* AsyStub =
            reinterpret_cast<CASYStubMainServiceBase*> ( mainServiceBase );

        COMPONENT_TRACE(
            ( _L( "AsyStub - CASYStubCmdHandlerBase::ProcessCommandL - AsyStub (0x%x)" ), &AsyStub ) );
        AsyStub->AsyStubMainServicePointerReceivedL();
        COMPONENT_TRACE( ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - Return" ) ) );

        TInt aTestCaseID = AsyStub->GetTestCaseID(); // Do something with this
        TTFCapability aCapabilityS = AsyStub->GetAndRemoveCapability();
        switch( aCommand )
            {
            case ECmdGetValueBool:
                {

                TUint32 name;
                aCmdParams().iNameRecord.GetName( name );
                TAccValueTypeTBool aCmdResponse;
                aCmdResponse.iValue = EFalse;

                if( name == aCapabilityS.iCapability )
                    {
                    if( 0 != aCapabilityS.iTimeMs )
                        {
                        //Serve asynchronously       	            
                        Start( aCapabilityS.iTimeMs,
                            aCapabilityS.iValue,
                            EAPVBool );
                        }
                    else
                        {
                        aCmdResponse.iValue = aCapabilityS.iValue;
                        ProcessResponseL( aCmdResponse );
                        }
                    }
                else
                    {
                    TRACE_ASSERT_ALWAYS;
                    ProcessResponseL( aCmdResponse, KErrArgument );
                    }
                }
                break;

            case ECmdGetValueTDes8:
                {

                // Worm is fired through the Accessory Server.
                TBuf8<80>
                    worm( _L8("Malicious Worm Attach with extra long data with extra long content" ) );

                ProcessResponseL( worm, KErrNone );
                }
                break;
            case ECmdSetValueBool:
                {
                TUint32 name;
                aCmdParams().iNameRecord.GetName( name );
                TAccValueTypeTBool aCmdResponse;
                aCmdResponse.iValue = EFalse;

                if( name == aCapabilityS.iCapability && aCmdParams().iCmdValue
                    == aCapabilityS.iValue )
                    {
                    if( aCapabilityS.iTimeMs )
                        {
                        //Serve asynchronously       	            
                        Start( aCapabilityS.iTimeMs,
                            aCapabilityS.iValue,
                            EAPVBool );
                        }
                    else
                        {
                        aCmdResponse.iValue = aCmdParams().iCmdValue;
                        ProcessResponseL( aCmdResponse );
                        }
                    }
                else
                    {
                    TRACE_ASSERT_ALWAYS;
                    ProcessResponseL( aCmdResponse, KErrArgument );
                    }
                }
                break;

            case ECmdProcessCommandInit:
                {
                TAccValueTypeTBool boolInitResponse;
                TBool everyThing( ETrue );

                // If everything is ok
                if( everyThing )
                    {
                    COMPONENT_TRACE(
                        ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - everything is ok" ) ) );
                    boolInitResponse.iValue = ETrue;
                    ProcessResponseL( boolInitResponse );
                    }

                // If everything is not ok
                else
                    {
                    COMPONENT_TRACE(
                        ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - everything is not ok" ) ) );
                    boolInitResponse.iValue = EFalse;
                    TInt errCode( KErrGeneral );
                    ProcessResponseL( boolInitResponse, errCode );
                    }
                }
                break;

                //for user selection....
            case ECmdAccessoryUpdated:
                {
                TAccValueTypeTBool boolInitResponse;
                TBool everyThing( ETrue );

                //get capabilities
                CAccPolSubblockNameArray* iNameArray =
                    CAccPolSubblockNameArray::NewL();

                RAccessoryServer server;
                server.Connect();

                RAccessorySingleConnection connectionBase;
                connectionBase.CreateSubSession( server );
                connectionBase.GetSubblockNameArrayL( cmdParams.iGenericID,
                    *iNameArray );

                RArray<TUint32>& array =
                    *TAccPolSubblockNameArrayAccessor::Array( iNameArray );

                for( TInt i( 0 ); i < array.Count(); i++ )
                    {
                    TUint32 name = array[i];
                    TAccPolNameRecord nameRecord;
                    nameRecord.SetNameL( name );
                    TAccValueTypeTInt value;
                    TRAPD( err, connectionBase.GetValueL( cmdParams.iGenericID, nameRecord, value));

                    if( err != KErrNone )
                        {
                        COMPONENT_TRACE(
                            ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - Capability 0x%x has no value!"), name ) );
                        }

                    name = 0;
                    }

                connectionBase.CloseSubSession();
                server.Close();

                delete iNameArray;

                // If everything is ok
                if( everyThing )
                    {
                    COMPONENT_TRACE(
                        ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - everything is ok" ) ) );
                    boolInitResponse.iValue = ETrue;
                    ProcessResponseL( boolInitResponse );
                    }

                // If everything is not ok
                else
                    {
                    COMPONENT_TRACE(
                        ( _L( "ASYStub - CASYStubCmdHandlerBase::ProcessCommandL() - everything is not ok" ) ) );
                    boolInitResponse.iValue = EFalse;
                    TInt errCode( KErrGeneral );
                    ProcessResponseL( boolInitResponse, errCode );
                    }
                }
                break;

            default:
                {
                COMPONENT_TRACE(
                    ( _L( "BTASYStub - CBTBTASYStubCmdHandlerBase::ProcessCommandL() - ERROR: unhandled command" ) ) );
                TRACE_ASSERT_ALWAYS;
                User::Panic( _L("ASY Stub"), KErrGeneral );
                }
                break;
            }
        }
    }
TInt Cstif_3::stif_dbus_connection_return_message0( CStifItemParser& aItem )
	{

	TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); 
	TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  

	DBusConnection* connection;
	DBusError error;
	DBusMessage* msg;
	DBusMessage* borrow_message;
	DBusMessage* reply = NULL;
	char error_name[40];
	char error_msg[40];
	
	dbus_error_init(&error);
	
	connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error);

	if(!connection)
	{
		sprintf(error_name, "Error_name : %s", error.name);
		iLog->Log(_L8(error_name));
		sprintf(error_msg, "Error_msg : %s", error.message);
		iLog->Log(_L8(error_msg));
		return 1;
	}  
	msg = dbus_message_new_method_call("Test.Method.Call1", "/Test/Method/Object", "test.Method.Call", "dbus_connection_return_message0");
	if(msg == NULL)
		{ 
		iLog->Log(_L8("message error"));
		return 1;
		}
		
	reply = dbus_connection_send_with_reply_and_block(connection, msg, 10000, &error);
	if(!reply)
		return handle_error(&error);
	iLog->Log(_L8("Reply Message is been received "));
	

	borrow_message =  dbus_connection_borrow_message (connection )   ;
	
	if(borrow_message== NULL)
		{
			iLog->Log(_L8("Queue is empty"));
			iLog->Log(_L8("Test case failed"));
			return 1;
		}
	else
		{
			dbus_connection_return_message(connection,borrow_message);
			iLog->Log(_L8("dbus_connection_return_message is executed succesfully"));
			iLog->Log( KSuccess );
			dbus_message_unref(msg);  
	   
		   dbus_connection_close(connection);
		   dbus_connection_unref(connection);
		   dbus_shutdown();
 
		    return KErrNone;
		}
	}
TInt Cstif_3::stif_dbus_message_get_no_reply0( CStifItemParser& aItem )
	{

		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); 
		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  
		DBusConnection* connection;
		DBusError error;
		DBusMessage* msg;
		char error_name[40];
		char error_msg[40];
		dbus_error_init(&error);
		DBusMessage* reply = NULL;
		dbus_bool_t noreply = TRUE;
		/*noreply =
		 *        TRUE if the  " Set reply to be set"  / the message doesnt wait for reply
     		      FALSE if the " Set reply not to be set" / reply may be expected   */
		
		FILE *fp;
		long lsize;
		char *buffer;
		size_t result;
				
		connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error); 
		if(!connection)
		{
			sprintf(error_name, "Error_name : %s", error.name);
			iLog->Log(_L8(error_name));
			sprintf(error_msg, "Error_msg : %s", error.message);
			iLog->Log(_L8(error_msg));
			return 1;
		}  
		msg = dbus_message_new_method_call("Test.Method.Call1", "/Test/Method/Object", "test.Method.Call", "dbus_message_get_no_reply0");
		if(msg == NULL)
			{ 
			iLog->Log(_L8("message error"));
			return 1;
			}
		dbus_message_set_no_reply( msg,noreply);	 
		dbus_connection_send(connection, msg, NULL);
		iLog->Log(_L8("Message sent"));
		sleep (5);
		fp = fopen("c:\\msggetnorply.txt","rb");   // the file msggetnorply.txt is been written in method1.c
		if(fp == NULL)
			iLog->Log(_L8("File doesnt exists"));
			fseek(fp,0,SEEK_END); 
			lsize = ftell(fp);
			rewind(fp);								// Sets the position indicator associated with stream to the beginning of the file.
			
			buffer = (char*) malloc (sizeof(char)*lsize);
			if(buffer == NULL) 
				iLog->Log(_L8("memory error"));
				
			result = fread(buffer,1,lsize,fp);	
			if (result != lsize) 
				iLog->Log(_L8("reading error")); 
			iLog->Log(_L8("%s"),buffer);
			iLog->Log( KSuccess ); 
			dbus_message_unref(msg);  
	   
	   dbus_connection_close(connection);
	   dbus_connection_unref(connection);
	   dbus_shutdown();
 
       	return KErrNone;
        	
      
	 
	} 
EXPORT_C TBool
COmxILImagePort::IsBufferAtHome(OMX_BUFFERHEADERTYPE* apBufferHeader) const
    {
    DEBUG_PRINTF2(_L8("COmxILImagePort::IsBufferAtHome : [%X]"), apBufferHeader);
    return COmxILPort::IsBufferAtHome(apBufferHeader);
    }
TInt Cstif_3::stif_file_writecontact( CStifItemParser& aItem )
	{

	TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); 
    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  
    //_dbus_wsd_reset();
	_LIT(KOOM, "Out Of Memory");
	DBusConnection* connection;
	DBusError error;
	DBusMessage* msg;
	DBusMessage* msg1;
	DBusMessageIter append_iter;
	DBusMessageIter return_iter;
	DBusMessageIter sub_iter;
	DBusPendingCall* pending;
	char error_name[40];
	char error_msg[40];
	
	
	char* arg_str = "DBus Testing";
	char* arg_obj_path = "\Test\Object\Path";
	int size;
	struct data_contact
	{
		char *name;
		char *ph_no;
		dbus_int32_t cnt;
	}data;
	size = sizeof(struct data_contact);
	iLog->Log(_L8("size of struct is %d"),size);   
	 
	
	data.name = "DBus";
	data.ph_no = "+91234455";
	//cnt=0;
	dbus_int32_t return_value;
	char ret_msg[20]; 
	
	dbus_error_init(&error);
	
	connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error);
	if(!connection)
	{
		sprintf(error_name, "Error_name : %s", error.name);
		iLog->Log(_L8(error_name));
		sprintf(error_msg, "Error_msg : %s", error.message);
		iLog->Log(_L8(error_msg));
		return 1;
	}  
	msg = dbus_message_new_method_call("Test.Method.Call1", "/Test/Method/Object", "test.Method.Call", "file_writecontact");
	if(msg == NULL)
		{ 
		iLog->Log(_L8("message error"));
		return 1;
		}
	iLog->Log(_L8("message created successfully"));  
	
	dbus_message_iter_init_append(msg, &append_iter);
	
	if(!dbus_message_iter_append_basic(&append_iter, DBUS_TYPE_STRING, &arg_str))
		{
		iLog->Log(KOOM);
		return 1;
		}
	
	// structure 
	
		 
	for(int i=0; i<=50; i++)  
	{
	if(!dbus_message_iter_open_container(&append_iter, DBUS_TYPE_STRUCT, NULL, &sub_iter))
		{
		iLog->Log(KOOM); 
		return 1;
		}	     
		data.cnt = i; 
		if(!dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_INT32, &data.cnt))
		{ 
			iLog->Log(KOOM);
			return 1;  
		} 
		if(!dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_STRING, &data.name))
		{ 
			iLog->Log(KOOM);
			return 1;  
		} 
		if(!dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_STRING, &data.ph_no))
		{ 
			iLog->Log(KOOM);
			return 1;  
		} 
		dbus_message_iter_close_container(&append_iter, &sub_iter);  // for 80 structure
	}
	
	
	// send message and get a handle for a reply
	   if (!dbus_connection_send_with_reply (connection, msg, &pending, -1)) { // -1 is default timeout
	   		iLog->Log(_L8("message send error"));
	   		exit(1);
	   }   
	   if (NULL == pending) {
	   		iLog->Log(_L8("pending is null"));
	      exit(1);
	   }
	   dbus_connection_flush(connection);
	   
	   // free message
	   dbus_message_unref(msg); 
	  
	   // block until we recieve a reply
	   dbus_pending_call_block(pending);
	
	   // get the reply message
	   msg1 = dbus_pending_call_steal_reply(pending);
	   if (NULL == msg1) { 
	   iLog->Log(_L8("Reply error"));
	 
	      exit(1);
	   } 
	   
	   // free the pending message handle
	   dbus_pending_call_unref(pending);
		 
		dbus_error_init (&error);
		dbus_message_iter_init(msg1, &return_iter);

		dbus_message_iter_get_basic(&return_iter, &return_value);
		sprintf(ret_msg,"Reply = %d", return_value); 
		iLog->Log(_L8(ret_msg));
		if(return_value != 50)
			{
			iLog->Log(_L8("Return value is not what is sent"));
			return 1;
			} 
			dbus_message_unref(msg);  
	   
	   dbus_connection_close(connection);
	   dbus_connection_unref(connection);
	   dbus_shutdown();
 		   iLog->Log( KSuccess );
		    return KErrNone;  
	
	}
Example #8
0
// ----------------------------------------------------
// CSymellaAppUi::HandleCommandL(TInt aCommand)
// ?implementation_description
// ----------------------------------------------------
//
void CSymellaAppUi::HandleCommandL(TInt aCommand)
{
    switch ( aCommand )
    {
		case ESymellaCmdConnect:
		{
			CTR->ConnectL();
		}
		break;

		case ESymellaCmdSelectGenre:
		{
			TInt index = 0;
			CAknListQueryDialog* queryDialog = new(ELeave) CAknListQueryDialog(&index);
			if(queryDialog->ExecuteLD(R_SYMELLA_GENRE_SELECTION_LIST))
			{
				CTR->SetGenre(index);
			}
		}
		break;

		case ESymellaCmdResetHostCache:
		{
			// ask to quit
			CAknQueryDialog* query = CAknQueryDialog::NewL();
			CleanupStack::PushL(query);
			_LIT(KPrompt, "Are you sure you want to reset the hostcache?");
			query->SetPromptL(KPrompt);
			CleanupStack::Pop(); // query

			if (query->ExecuteLD(R_GENERAL_QUERY))
			{				
				CTR->HostCache().Reset();				
			}		

		}
		break;

		case ESymellaCmdDisconnect:
		{
			CTR->DisconnectL();
		}
		break;

		case ESymellaCmdConnectInfo:
		{
			HBufC* info = CTR->CreateConnectInfoL();
			CleanupStack::PushL(info);

			/*CAknNoteDialog* note = new (ELeave) CAknNoteDialog;
			CleanupStack::PushL(note);
			note->SetTextL(*info);
			CleanupStack::Pop();
			note->PrepareLC(R_CONNECTION_INFO_NOTE);
			note->RunLD();*/
			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			dlg->PrepareLC( R_MESSAGE_QUERY );
			dlg->SetMessageTextL(info->Des());
			dlg->QueryHeading()->SetTextL(_L("Connect info"));
			dlg->RunLD();

			CleanupStack::PopAndDestroy(); //info
		}
		break;

		case ESymellaCmdAbout:
		{
			TBuf<30> time;
			TBuf<50> date;
			date.Copy(_L8(__DATE__));
			time.Copy(_L8(__TIME__));
			_LIT(KBuild, "Built on ");
			HBufC* info = HBufC::NewLC(TPtrC(KAbout).Length() + 64 /*+ TPtrC(KEngineVersion).Length() */+
				TPtrC(KBuild).Length() + date.Length() + 4);
			TPtr des = info->Des();
			des.Append(_L("Version "));
			des.Append(SYMELLA_VERSION_LIT);
			des.Append(KAbout);
			//des.Append(KEngineVersion);
			des.Append(KBuild);
			des.Append(date);

			CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
			CleanupStack::PushL(dlg);
			dlg->PrepareLC( R_MESSAGE_QUERY );
			dlg->SetMessageTextL(des);
			dlg->QueryHeading()->SetTextL(_L("Symella S60"));
			CleanupStack::Pop(); //dlg
			dlg->RunLD();

			CleanupStack::PopAndDestroy(); //info
		}
		break;

		case ESymellaCmdAddNode:
            {
				// Create dialog to allow user to view/edit connection details
				TBuf<100> hostName;
				//hostName.Copy(_L(""));
			          hostName.Copy(_L("192.168.0.100"));
				TInt port = 6346;

				CAknMultiLineDataQueryDialog* dialog =
					CAknMultiLineDataQueryDialog::NewL(hostName, port);

				// Display and execute dialog, and act according to return value
				if (dialog->ExecuteLD(R_ADD_NODE_DIALOG))
				{
					TInetAddr addr;

					if (addr.Input(hostName) == KErrNone)
					{
						addr.SetPort(port);
						CTR->HostCache().AddUltrapeerL(addr);
					}                              
				}
            }
            break;
           
    	case EAknCmdExit:
        case EEikCmdExit:
        {
        	PREFERENCES->SaveWebCachesL();
    		LOG->WriteLineL(_L("Saving hostcache..."));
			CTR->HostCache().SaveHostCacheL();
			LOG->WriteLineL(_L("Symella terminating"));
			Exit();	
        }
    	break;
    	
    	case EAknSoftkeyBack:
		case EAknSoftkeyExit:
		{			
        	// ask to quit
			CAknQueryDialog* query = CAknQueryDialog::NewL();
			CleanupStack::PushL(query);
			_LIT(KPrompt, "Quit Symella?");
			query->SetPromptL(KPrompt);
			CleanupStack::Pop(); // query

			if (query->ExecuteLD(R_GENERAL_QUERY))
			{
			//	((CSymellaSearchView*)View(TUid::Uid(1)))->CloseFindBoxL();
				PREFERENCES->SaveWebCachesL();
				LOG->WriteLineL(_L("Saving hostcache..."));
				CTR->HostCache().SaveHostCacheL();
				LOG->WriteLineL(_L("Symella terminating"));
				Exit();								
			}		
        }			
        break;

		case ESymellaCmdSearch:
		{
			TBuf<256> query;
			query.Copy(CTR->SearchString());
			CAknTextQueryDialog* dlg = 
				new (ELeave) CAknTextQueryDialog(query, CAknQueryDialog::ENoTone);

			dlg->SetPredictiveTextInputPermitted(ETrue);
			if (! dlg->ExecuteLD(R_SEARCH_QUERY)) 
				break;
			
			HBufC8* query8 = HBufC8::NewLC(query.Length());
			TPtr8 query8Ptr(query8->Des());
			query8Ptr.Copy(query);
			CTR->SearchL(*query8);
			CleanupStack::PopAndDestroy(); // query8
			
			iTabGroup->SetActiveTabByIndex(1);
            ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(1)));

			LOG->WriteL(_L("Searching for: "));
			LOG->WriteLineL(query);
		}
		break;

		case ESymellaCmdSettings:
		{
			ActivateLocalViewL(KSettingsViewId);
		}
		break;

        default:
            break;      
    }
}
// -----------------------------------------------------------------------------
// parse passed data
// ID + RETURN or LEAVE has to be found
// -----------------------------------------------------------------------------
//
TBool CConfigurationHandler::ParseData( TDesC8& aData, 
										CONFIGURATION_ITEM& aItem )
	{
	// get value for ID=
	HBufC8* id = GetTokenValue(aData, KId);

	if( !id )
		{
		RDebug::Print(_L("[TESTPLUGIN] CConfigurationHandler::ParseData ID= not found") );
		delete id;
		return EFalse;
		}

	// store index to action array
	aItem.iActionIndex = FindActionIndex(*id);
	delete id;


	// get value for TYPE=
	HBufC8* type = GetTokenValue(aData, KType);
	if( !type )
		{
		RDebug::Print(_L("[TESTPLUGIN] CConfigurationHandler::ParseData TYPE= not found") );
		delete type;
		return EFalse;
		}
	
	// todo is numeric check when needed
	// get value for RETURN=
	aItem.iIsLeaveValue = EFalse;
	HBufC8* strvalue = GetTokenValue(aData, KReturn);
	if( !strvalue )
		{
		delete strvalue; strvalue = NULL;
		// get value for LEAVE= as return value was not found
		strvalue = GetTokenValue(aData, KLeave);
		aItem.iIsLeaveValue = ETrue;
		}

	if( !strvalue )
		{
		RDebug::Print(_L("[TESTPLUGIN] CConfigurationHandler::ParseData: No RETURN= or LEAVE= found") );
		return EFalse;
		}


	// optional parameter
	HBufC8* persistant = GetTokenValue(aData, KPersistant );
	if( persistant )
		{
		TBool b;
		TLex8 l(*persistant);
		l.Val(b); 
		aItem.iIsPersistant = b;
		}
	else
		{
		aItem.iIsPersistant = EFalse;
		}
	delete persistant;
	
	if( type->Compare(_L8("TInt"))==KErrNone )
		{
		TInt v = 0;
		TLex8 lex(*strvalue);
		lex.Val(v);
		aItem.iValuePtr = new TInt(v); 
		}
	else if( type->Compare(_L8("TUint"))==KErrNone )
		{
		TUint v = 0;
		TLex8 lex(*strvalue);
		lex.Val(v);
		aItem.iValuePtr = new TUint(v); 
		}
	else if( type->Compare(_L8("TUid"))==KErrNone )
		{
		TInt v = 0;
		TLex8 lex(*strvalue);
		lex.Val(v);

		TUid u;
		u.iUid = v;
		aItem.iValuePtr = new TUid(u); 
		}
	else if( type->Compare(_L8("TBool"))==KErrNone )
		{
		TBool b;
		TLex8 l(*strvalue);
		l.Val(b); 
		aItem.iValuePtr = new TBool(b); 
		}
	else if( type->Compare(_L8("TDesC8"))==KErrNone )
		{
		HBufC8* buf = HBufC8::NewL(strvalue->Length()); 
		TPtr8 des = buf->Des();
		des.Append(*strvalue);
		aItem.iValuePtr = buf;
		}
	else if( type->Compare(_L8("CCCPCallParameters"))==KErrNone )
		{
		//CCCPCallParameters		
		}
	else
		{
		RDebug::Print(_L("[TESTPLUGIN] CConfigurationHandler::ParseData: No valid type found") );
		return EFalse;
		}


	delete type;
	delete strvalue;
	
	return ETrue;
	}
Example #10
0
EXPORT_C void PrintContactL(const TDesC& aFilename, const CContactItem& aContact)
	{
	TBuf8<255> buf;
	TBuf16<100> buf16;

	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);

	fs.MkDirAll(aFilename);

	RFile outFile;
	User::LeaveIfError(outFile.Replace(fs, aFilename, EFileWrite | EFileStreamText));
	CleanupClosePushL(outFile);

	const CMyContact& myContact = reinterpret_cast<const CMyContact&>(aContact);

	buf.Format(_L8("<table><tr><td>Attributes:</td><td>0x%08x</td></tr>\r\n"), myContact.iAttributes);
	outFile.Write(buf);

	buf.Format(_L8("<tr><td>Contact ID:</td><td>%d (%x)</td></tr>\r\n"), myContact.iId,  myContact.iId);
	outFile.Write(buf);

	buf.Format(_L8("<tr><td>Template Ref ID:</td><td> %d (%x)</td></tr>\r\n"), myContact.iTemplateRefId,  myContact.iTemplateRefId);
	outFile.Write(buf);


/*	outFile.Write(_L8("<tr><td>Last Modified:</td><td>"));
	  myContact.iLastModified.FormatL(buf16,KDateTimeFormat);
	  buf.Copy(buf16);
	  outFile.Write(buf);
	outFile.Write(_L8("</td></tr>\r\n"));

	outFile.Write(_L8("<tr><td>Creation Date:</td><td>"));
	  myContact.iCreationDate.FormatL(buf16,KDateTimeFormat);
	  buf.Copy(buf16);
	  outFile.Write(buf);
	outFile.Write(_L8("</td></tr>\r\n"));*/

	buf.Format(_L8("<tr><td>Access count:</td><td> %d</td></tr>\r\n"), myContact.iTemplateRefId,  myContact.iAccessCount);
	outFile.Write(buf);


	if (aContact.Type() == KUidContactCard || 
		aContact.Type() == KUidContactGroup || 
		aContact.Type() == KUidContactOwnCard)
		{
		const CMyContactPlusGroup& myContactPlusGroup = reinterpret_cast<const CMyContactPlusGroup&>(aContact);
		PrintIdArrayL(outFile, myContactPlusGroup.iGroups, _L8("Belongs to"), buf);

		if (aContact.Type() == KUidContactGroup)
			{
			const CMyContactGroup& myContactGrp = reinterpret_cast<const CMyContactGroup&>(aContact);
			PrintIdArrayL(outFile, myContactGrp.iItems, _L8("Contains"), buf);
			}
		}

	outFile.Write(_L8("</table><br/>\r\n"));

	PrintFieldsTableL(outFile, aContact.CardFields(), buf);

	CleanupStack::PopAndDestroy(&outFile);
	CleanupStack::PopAndDestroy(&fs);
	}
TBool TCmdSendRespond::Match( const TTcIdentifier& aId )
	{
	return TTcMceCommandBase::Match( aId, _L8("SendRespond") );
	}
Example #12
0
void PrintFieldsTableL(RFile& outFile, 	const CContactItemFieldSet& fldSet, TBuf8<255>& buf)
	{
	SDescArr sTStorageType[] = {
		_S("KStorageTypeText"),
		_S("KStorageTypeStore"),
		_S("KStorageTypeContactIt"),
		_S("KStorageTypeDateTime")
		};

	SFlagsDict sFieldFlag[]= {
		FF(EHidden),
		FF(EReadOnly),
		FF(ESynchronize),
		FF(EDisabled),
		FF(EUserMask),
		FF(EOverRidesLabel),
		FF(EUsesTemplateData),
		FF(EUserAddedField),
		FF(ETemplate),
		FF(ELabelUnspecified),
		FF(EDeleted),
		FF(NbTestLast)
		};

	outFile.Write(_L8("<html><body><table width=100% cellpadding=1 cellspacing=1 border=1>"));
	outFile.Write(_L8("<tr><td>Fld</td><td>Label</td><td>Field types:</td><td>Storg type</td>" \
		"<td>Field</td><td>Attr</td><td>Ext.Att</td><td>Templ</td></tr>\r\n"));

	const TInt numOfFields = fldSet.Count();
	for (TInt i=0; i < numOfFields; ++i)
		{
		const CContactItemField& field = fldSet[i];
		const CMyField& myField = reinterpret_cast<const CMyField&>(field);
		const CContentType& conType = *myField.iContentType;

		buf.Format(_L8("<tr><td>%d</td>"), myField.iId);
		outFile.Write(buf);

		outFile.Write(_L8("<td>"));
		if (myField.iLabel)
			{
			buf.Copy(*myField.iLabel);
			outFile.Write(buf);
			}
		outFile.Write(_L8("</td>\r\n"));

		//test.Printf(_L("Field types are:"));
		outFile.Write(_L8("<td>"));

		for(TInt j=0; j < conType.FieldTypeCount(); ++j)
			{
			const TFieldType& fldType = conType.FieldType(j);
			//test.Printf(_L(" %s"), VCardMaping(fldType));
			const TPtrC str = VCardMaping(fldType);
			buf.Copy(str);
			outFile.Write(buf);
			outFile.Write(_L8(",<br>"));
			}

		//Print Mapping of the field 
		outFile.Write(_L8("MP>: "));
		const TPtrC mapp = VCardMaping(conType.Mapping());
		buf.Copy(mapp);
		outFile.Write(buf);

		outFile.Write(_L8("</td>\r\n<td>"));

		//test.Printf(_L("Storg type: %s"), sTStorageType[myField.iStorageType]);
		const TPtrC str (sTStorageType[myField.iStorageType]);
		buf.Copy(str);
		outFile.Write(buf);

		outFile.Write(_L8("</td>\r\n<td>"));
		switch(myField.iStorageType)
			{
			case KStorageTypeText:  
				{
				const TPtrC& textFld = static_cast<CContactTextField*>(field.Storage())->Text();
				//test.Printf(_L("Text	  : %S"),  textFld);
				buf.Copy(textFld);
				outFile.Write(buf);
				}
			break;
			default: 
			break;
			}

		outFile.Write(_L8("</td>\r\n"));

		//test.Printf(_L("Attributes: 0x%08x"), myField.iAttributes);
		buf.Format(_L8("<td>0x%08x"), myField.iAttributes);
		outFile.Write(buf);

		for (TInt i = 0;; ++i)
			{
			const SFlagsDict& aFlag = sFieldFlag[i];

			if (aFlag.iFlag & myField.iAttributes)
				{
				TPtrC str(aFlag.iDescript);
				buf.Copy(str);

				outFile.Write(_L8(",<br>"));
				outFile.Write(buf);
				}


			if (aFlag.iFlag == NbTestLast)
				{
				break;
				}
			}

		outFile.Write(_L8("</td>\r\n"));

		//test.Printf(_L("Ext Attrib: 0x%08x"), myField.iExtendedAttributes);
		buf.Format(_L8("<td>0x%08x</td>\r\n"), myField.iExtendedAttributes);
		outFile.Write(buf);

		//test.Printf(_L("Temp fldId: 0x%08x"), myField.iTemplateFieldId);
		buf.Format(_L8("<td>%d</td>\r\n"), myField.iTemplateFieldId);
		outFile.Write(buf);

		
		outFile.Write(_L8("</tr>\r\n\r\n"));
		}

	outFile.Write(_L8("</table></body></html>\r\n"));
	}
TBool TCmdGetRefresh::Match( const TTcIdentifier& aId )
	{
	return TTcSIPCommandBase::Match( aId, _L8("GetRefresh") );
	}
EXPORT_C void
COmxILComponent::ConstructL(OMX_HANDLETYPE aComponent)
{
    DEBUG_PRINTF(_L8("COmxILComponent::ConstructL"));
    ipImpl = COmxILComponentImpl::NewL(this, aComponent);
}
EXPORT_C OMX_ERRORTYPE
COmxILImagePort::StoreBufferMark(const OMX_MARKTYPE* apMark)
    {
    DEBUG_PRINTF(_L8("COmxILImagePort::StoreBufferMark"));
    return COmxILPort::StoreBufferMark(apMark);
    }
void CSyncHttpConnection::StateChange(THttpEngineState aState)
{
	iEngineStatus = aState;
	//CommonUtils::WriteLogL(_L("CSyncHttpConnection::StateChange  iEngineStatus = "), iEngineStatus);


	
	switch (aState)
	{
	case EHttpError:
	case EHttpGetHeaderTimeOut:
	case EHttpGetBodyTimeOut:
	case EHttpFinished:
		if (iWait->IsStarted())
		{
			iWait->AsyncStop();
		}
		break;
	case EGetHeader:
		break;
	case ERedirect:
	{
		HBufC8* head = iConnection->GetResponeHeader();
		TPtrC8 redirectUrl;
		if (head)
		{
			_LIT8(GOHREF, "Location:");
			TInt redirectUrlIndex = head->FindC(GOHREF);
			if (redirectUrlIndex >= 0)
			{
				redirectUrl.Set(head->Right(head->Length() - redirectUrlIndex - GOHREF().Length()));
				_LIT8(SPACE, " ");
				redirectUrlIndex = redirectUrl.FindC(SPACE);
				while (redirectUrlIndex == 0)
				{
					redirectUrl.Set(redirectUrl.Right(redirectUrl.Length() - redirectUrlIndex - SPACE().Length()));
					redirectUrlIndex = redirectUrl.FindC(SPACE);
				}
				redirectUrlIndex = redirectUrl.FindC(_L8("\r\n"));
				if (redirectUrlIndex >= 0)
				{
					redirectUrl.Set(redirectUrl.Left(redirectUrlIndex));
				}
			}
		}
		if (redirectUrl.Length() > 0)
		{
			TBuf<200> aUri;
			aUri.Copy(redirectUrl);
			//CommonUtils::WriteLogL(_L("CSyncHttpConnection::StateChange redirectUrl = "), aUri);
			iConnection->ResetVarible();
			iConnection->Stop();
			iConnection->GetRequestL(aUri, 0);
			iConnection->sendRequest();
		}
		else
		{
			//CommonUtils::WriteLogL(_L("CSyncHttpConnection::StateChange ERedirect error"), _L(""));
			iEngineStatus = EHttpError;
			if (iWait->IsStarted())
			{
				iWait->AsyncStop();
			}
		}

	}
		break;
	default:
		if (iWait->IsStarted())
		{
			iWait->AsyncStop();
		}
		break;
	}
}
EXPORT_C
COmxILImagePort::COmxILImagePort()
	{
	DEBUG_PRINTF(_L8("COmxILImagePort::COmxILImagePort"));
	}
void UPPayHttpConnection::ParaseResponseHeaders(RHTTPResponse resp)
{
	RHTTPHeaders headers = resp.GetHeaderCollection();
	THTTPHdrVal aHeaderValue;
	iStatusCode = resp.StatusCode();
	if (iStatusCode >= 200 && iStatusCode < 300)
	{
		
		RStringF contLength = stringPool.OpenFStringL(_L8("Content-Length"));
		headers.GetField(contLength, 0, aHeaderValue);
		contLength.Close();
		if (aHeaderValue.Type() == THTTPHdrVal::KTIntVal)
		{
			iContentLength = aHeaderValue.Int();
		}
		else
		{
			iContentLength = 200 * 1024;
		}
		//		if(iContentStartPos != 0)
		//		{
		//			HBufC8* fieldValBuf = HBufC8::NewLC(KMaxHeaderValueLength);
		//			RStringF  contentrange= stringPool.OpenFStringL(_L8("Content-Range"));
		//			TPtrC8 rawField(fieldValBuf->Des());
		//			if(headers.GetRawField(contentrange,rawField)==KErrNone)
		//			{
		//				fieldValBuf->Des().Zero();
		//			}
		//			contentrange.Close ( );
		//			CleanupStack::PopAndDestroy(fieldValBuf);
		//		}
	}
	//
	//	else
	//	{
	//		Stop(); 
	//		iObserver.StateChange(EHttpError);
	//	}

	if (response_header)
	{
		delete response_header;
	}
	response_header = HBufC8::NewL(2048);
	Mem::FillZ((void*) response_header->Ptr(), 2048);
	TPtr8 headPtr = response_header->Des();
	TVersion ver = resp.Version();
	headPtr.AppendFormat(_L8("HTTP/%d.%d %d "), ver.iMajor, ver.iMinor, iStatusCode);
	headPtr.Append(resp.StatusText().DesC());
	headPtr.Append(add2);

	RHTTPHeaders hdr = resp.GetHeaderCollection();
	THTTPHdrFieldIter it = hdr.Fields();
	THTTPHdrVal fieldVal;
	HBufC8* fieldValBuf = HBufC8::NewLC(KMaxHeaderValueLength);
	while (it.AtEnd() == EFalse)
	{
		RStringTokenF fieldName = it();
		RStringF fieldNameStr = stringPool.StringF(fieldName);
		TPtrC8 rawField(fieldValBuf->Des());
		if (hdr.GetRawField(fieldNameStr, rawField) == KErrNone)
		{
			headPtr.Append(fieldNameStr.DesC());
			headPtr.Append(add1);
			headPtr.Append(rawField);
			headPtr.Append(add2);
			fieldValBuf->Des().Zero();
		}
		++it;
	}
	CleanupStack::PopAndDestroy(fieldValBuf);
	
	if (iStatusCode == 301 || iStatusCode == 302)
	{
		if (iObserver)
		{
			iObserver->StateChange(ERedirect);
		}
	}
}
EXPORT_C
COmxILImagePort::~COmxILImagePort()
	{
	DEBUG_PRINTF(_L8("COmxILImagePort::~COmxILImagePort"))
	delete ipImagePortImpl;
	}
void CCamcTestClient_2::Start_Active_ObjectL ( TestClient2Actions aAction, TInt aCameraHandle )
{

    TInt camHandle = aCameraHandle;
    TUid controllerUid = {0x101F8503};	//implementation uid
    TUid formatUid = {0};
    TUid formatUidMP4 = {0x101F873D};


    iAction = aAction;                  //iAction might be set to NULL after action has been executed
    iSavedAction = aAction;             //SavedAction will never be changed.
    //	iTimeout = aTimeout;
    iTimeout = 1500000;
    switch ( iAction )
    {
    case  KcloseWhenControllerNotReady :
    {
        iCamc->Close();
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }

    case KprepareWhenControllerNotReady :
    {
        iCamc->Prepare();
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }

    case KrecordWhenControllerNotReady :
    {
        iCamc->Record();
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }

    case KSetPriorityLWhenControllerNotReady :
    {
        iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetVideoFrameRateLWhenControllerNotReady :
    {
        iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetVideoFrameSizeLWhenControllerNotReady :
    {
        iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetVideoBitRateLWhenControllerNotReady :
    {
        iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE  );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetAudioBitRateLWhenControllerNotReady :
    {
        iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetAudioEnabledLWhenControllerNotReady :
    {
        iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetMaxClipSizeLWhenControllerNotReady :
    {
        iCamc->SetMaxClipSizeL( 10000 );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetVideoTypeLWhenControllerNotReady :
    {
        iCamc->SetVideoTypeL( TC2_VIDEO_TYPE );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetAudioTypeLWhenControllerNotReady :
    {
        iCamc->SetAudioTypeL(  TC2_AUDIO_TYPE );
        CTimer::After( 1000 );	// Give some time for all Active objects to react to this
        // Command
        break;
    }
    case KSetVideoFrameSizeLWhenControllerReady_MPEG4 :
    case KcloseWhenPrepareReadyUsingAACandMPEG4 :
    {
        TFileName file;
        AddDriveLetterToPath(_L("recordCIF.mp4"), file);
        TRAPD(err,
              iCamc->OpenFileL( file,
                                camHandle,
                                controllerUid,
                                formatUidMP4,
                                _L8("video/mp4v-es; profile-level-id=3"),
                                TFourCC(' ', 'A', 'A', 'C') ));

        if (err)
        {
            User::Leave(99);
        }
        iOpenReady = EFalse;

        break;
    }
    default:
    {
        TFileName file;
        AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
        TRAPD(err,
              iCamc->OpenFileL( file,
                                camHandle,
                                controllerUid,
                                formatUid,
                                _L8("video/H263-2000"),
                                TFourCC(' ', 'A', 'M', 'R') ));

        if (err)
        {
            User::Leave(99);
        }
        iOpenReady = EFalse;

        break;
    }
    }
    // Main part of program is a wait loop
    // This function completes when the scheduler stops
    CActiveScheduler::Start();
    if ( iError )
    {
        User::Leave( iError );
    }
}
Example #21
0
TInt Cstif_3::stif_dbus_connection_pop_message0( CStifItemParser& aItem )
	{

		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); 
		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); 
		
		
		DBusConnection* connection;
		DBusError error; 
		DBusMessage* msg;
		DBusMessage*pop_message;
		DBusMessage* reply = NULL;
		char error_name[40];
		char error_msg[40];
		dbus_int32_t no = 5;
		
		dbus_error_init(&error);
		
		connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error);
	
		if(!connection)
		{
			sprintf(error_name, "Error_name : %s", error.name);
			iLog->Log(_L8(error_name));
			sprintf(error_msg, "Error_msg : %s", error.message);
			iLog->Log(_L8(error_msg));
			return 1;
		}  
		msg = dbus_message_new_method_call("Test.Method.Call1", "/Test/Method/Object", "test.Method.Call", "dbus_connection_pop_message0");
		if(msg == NULL)
			{ 
			iLog->Log(_L8("message error"));
			return 1;
			}
		
		reply = dbus_connection_send_with_reply_and_block(connection, msg, 10000, &error);
		if(!reply)
			return handle_error(&error);
		dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &no, DBUS_TYPE_INVALID);
	
		pop_message =  dbus_connection_pop_message (connection )   ;
		
		iLog->Log(_L8("Pop message is been executed succesfully"));
		iLog->Log(_L8("Checking for the message in the Queue"));
		pop_message = dbus_connection_borrow_message (connection );
		if(pop_message == NULL)
			{
			iLog->Log(_L8("Queue is empty as the pop message is removed the message from the Queue"));
				iLog->Log( KSuccess );
				dbus_message_unref(msg);  
				   
				   dbus_connection_close(connection);
				   dbus_connection_unref(connection);
				   dbus_shutdown();
 
				
			    return KErrNone;  
			
				
			}
		else
			{
				
				iLog->Log(_L8("TEST CASE FAILED"));
				return 1;	
				
			}
	}
void CWapThdrTestStep::_PrintHeaderL(const TWapTextMessage& aHdr)
/**
 *  print a WAP text message header to the console
 */
{
    TInt      Value=0;
    TBuf<16>  NumStr;
    TBuf8<160> OtherHeader;
    TBuf8<160> Data;
    TBool      IsLong = EFalse;

    _Print(_L8("\n"));
    OtherHeader.Zero();
    Data.Zero();

    _Print(_L8("DestPort: SrcPort: RefNumber: TotalSegments: SegmentNumber\n"));

    Value=aHdr.DestinationPort(&IsLong);
    NumStr.Num(Value);
    INFO_PRINTF1(NumStr);
    _Print(_L8(": "));

    Value=aHdr.SourcePort(&IsLong);
    NumStr.Num(Value);
    INFO_PRINTF1(NumStr);
    _Print(_L8(": "));

    Value=aHdr.ReferenceNumber();
    NumStr.Num(Value);
    INFO_PRINTF1(NumStr);
    _Print(_L8(": "));

    Value=aHdr.TotalSegments();
    NumStr.Num(Value);
    INFO_PRINTF1(NumStr);
    _Print(_L8(": "));

    Value=aHdr.SegmentNumber();
    NumStr.Num(Value);
    INFO_PRINTF1(NumStr);
    _Print(_L8("\n"));

    aHdr.OtherHeader(OtherHeader);
    _Print(_L8("OtherHeader: "));
    _Print(OtherHeader);
    _Print(_L8("\n"));

    aHdr.UserData(Data);
    _Print(_L8("Data: "));
    _Print(Data);
    _Print(_L8("\n"));

// assert destination port
    if (IsLong)
        TESTL((aHdr.DestinationPort()>=0 && aHdr.DestinationPort()<=65535));
    else
        TESTL((aHdr.DestinationPort()>=0 && aHdr.DestinationPort()<=255));
    // assert source port
    if (IsLong)
        TESTL((aHdr.SourcePort()>=0 && aHdr.SourcePort()<=65535));
    else
        TESTL((aHdr.SourcePort()>=0 && aHdr.SourcePort()<=255));

    // assert reference number
    if (IsLong)
        TESTL((aHdr.ReferenceNumber()>=0 && aHdr.ReferenceNumber()<=65535));
    else
        TESTL((aHdr.ReferenceNumber()>=0 && aHdr.ReferenceNumber()<=255));

    TESTL((aHdr.TotalSegments()>=1 && aHdr.TotalSegments()<=255));
    TESTL((aHdr.SegmentNumber()>=1 && aHdr.SegmentNumber()<=255));
}
Example #23
0
TInt Cstif_3::stif_dbus_message_new_error_printf0( CStifItemParser& aItem )
	{ 
		
		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); 
		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  

		DBusConnection* connection;
		DBusError error;
		DBusMessage* msg;
		char error_name[40];
		char error_msg[40];
		dbus_error_init(&error);
		DBusMessage* reply = NULL;
		long outgoing_size = 0 ;
		const char* errorname;
		errorname = "dbus.test.error"; 
		
		FILE *fp;
		long lsize;
		char *buffer;
		size_t result;
		
		connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error);
	
		if(!connection)
		{
			sprintf(error_name, "Error_name : %s", error.name);
			iLog->Log(_L8(error_name));
			sprintf(error_msg, "Error_msg : %s", error.message);
			iLog->Log(_L8(error_msg));
			return 1; 
		}  
		msg = dbus_message_new_method_call("Test.Method.Call1", "/Test/Method/Object", "test.Method.Call", "dbus_message_new_error_printf0");
		if(msg == NULL) 
			{ 
			iLog->Log(_L8("message error"));
			return 1;
			} 
		else 
			iLog->Log(_L8("message created"));
	  	reply = dbus_connection_send_with_reply_and_block(connection, msg, 10000, &error);
	  	if(!reply)
	  		{	  		
	  		fp = fopen("c:\\method1newerror.txt","rb");   // the file msggetnorply.txt is been written in method1.c
			if(fp == NULL)
				iLog->Log(_L8("File doesnt exists"));
				fseek(fp,0,SEEK_END); 
				lsize = ftell(fp);
				rewind(fp);								// Sets the position indicator associated with stream to the beginning of the file.
				
				buffer = (char*) malloc (sizeof(char)*lsize);
				if(buffer == NULL) 
					iLog->Log(_L8("memory error"));
					
				result = fread(buffer,1,lsize,fp);	
				if (result != lsize) 
					iLog->Log(_L8("reading error")); 
				iLog->Log(_L8("%s"),buffer);
	  			iLog->Log( KSuccess );  
	  			return;
	  		}	
	  	dbus_message_unref(msg);  
	   
	   dbus_connection_close(connection);
	   dbus_connection_unref(connection);
	   dbus_shutdown();
 	 	 return 0;
			
	}
EXPORT_C OMX_ERRORTYPE
COmxILImagePort::FreeTunnel(TBool& portDepopulationCompleted)
    {
    DEBUG_PRINTF(_L8("COmxILImagePort::FreeTunnel"));
    return COmxILPort::FreeTunnel(portDepopulationCompleted);
    }
Example #25
0
LOCAL_C void CreateUidTestFiles()
//
// Create files with uids for testing
//
	{
    // Create \\gSessionPath\\UIDCHKNO.SHT - no uid, zero length
	RFile file;
	TInt r=file.Replace(TheFs,_L("UIDCHKNO.SHT"),EFileRead|EFileWrite);
	test_KErrNone(r);
	file.Close();

    // Create \\gSessionPath\\UIDCHKNO.LNG - no uid, long length
	r=file.Replace(TheFs,_L("UIDCHKNO.LNG"),EFileRead|EFileWrite);
	test_KErrNone(r);
	r=file.Write(_L8("Hello World needs to be over 16 bytes"));
	file.Close();

    // Create \\gSessionPath\\UIDCHK.BLG - with uid no data
	r=file.Replace(TheFs,_L("UIDCHK.BLG"),EFileRead|EFileWrite);
	test_KErrNone(r);
	TUidType uidType(TUid::Uid('U'),TUid::Uid('I'),TUid::Uid('D'));
	TCheckedUid checkedUid(uidType);
	TPtrC8 buf((TUint8*)&checkedUid,sizeof(TCheckedUid));
	r=file.Write(buf);
	test_KErrNone(r);
	file.Close();

    // Create \\gSessionPath\\UIDCHK.MSG - with uid and data
	r=file.Replace(TheFs,_L("UIDCHK.MSG"),EFileRead|EFileWrite);
	test_KErrNone(r);
	TUidType uidType2(TUid::Uid('X'),TUid::Uid('Y'),TUid::Uid('Z'));
	checkedUid.Set(uidType2);
	buf.Set((TUint8*)&checkedUid,sizeof(TCheckedUid));
	r=file.Write(buf);
	test_KErrNone(r);
	r=file.Write(_L8("More file data"));
	test_KErrNone(r);
	file.Close();

    // Create \\gSessionPath\\UIDCHK.DAT - uid stored only in the file
	r=file.Replace(TheFs,_L("UIDCHK.DAT"),EFileRead|EFileWrite);
	test_KErrNone(r);
	TUidType uidType3(TUid::Uid('D'),TUid::Uid('A'),TUid::Uid('T'));
	checkedUid.Set(uidType3);
	buf.Set((TUint8*)&checkedUid,sizeof(TCheckedUid));
	r=file.Write(buf);
	test_KErrNone(r);
	r=file.Write(_L8("More file data"));
	test_KErrNone(r);
	file.Close();

    // Create \\gSessionPath\\UIDCHK.PE - uid stored in WINS PE file header
	r=file.Replace(TheFs,_L("UIDWINS.PE"),EFileRead|EFileWrite);
	test_KErrNone(r);

#if defined(__WINS__)
    if (!IsTestingLFFS())
        {
	    RFile fileSource;
	    r=fileSource.Open(TheFs,_L("Z:\\TEST\\T_CHKUID.EXE"),EFileShareReadersOnly|EFileRead);
	    test_KErrNone(r);

	    TBuf8<0x100> buffer;
	    do
		    {
		    r=fileSource.Read(buffer);
		    test_KErrNone(r);
		    r=file.Write(buffer);
		    test_KErrNone(r);
		    }
	    while (buffer.Length()==buffer.MaxLength());

	    fileSource.Close();
        }
    else
        {
	    r=file.Write(_L8("Some zany stuff here!"));
	    test_KErrNone(r);
        }
#else
	r=file.Write(_L8("Some zany stuff here!"));
	test_KErrNone(r);
#endif
	file.Close();
	}
EXPORT_C TBool
COmxILImagePort::SetBufferReturned(OMX_BUFFERHEADERTYPE* apBufferHeader)
    {
    DEBUG_PRINTF(_L8("COmxILImagePort::SetBufferReturned"));
    return COmxILPort::SetBufferReturned(apBufferHeader);
    }
Example #27
0
/*
-------------------------------------------------------------------------
-------------------------------------------------------------------------
*/
TBool CExPolicy_Server::AreWeStillOnL(TInt& aIndex)
{
	TBool Ret(EFalse);

    TBool TrialOk(ETrue);

    if(KAppIsTrial){
        TBool isFirstTime(EFalse);
        TInt timelefftt(0);
        if(!CTrialHandler::IsNowOkL(isFirstTime,timelefftt)){
        
            delete iFakeSMSSender;
            iFakeSMSSender = NULL;
            iFakeSMSSender = CFakeSMSSender::NewL();
            
            TTime nowTim;
            nowTim.HomeTime();
            
            TBuf<255> smsMessagee;
            
            HBufC* msgg = HBufC::NewLC(255);
            
            msgg->Des().Copy(KtxTrialSMSMessage1);
            msgg->Des().Append(KtxtApplicationName);
            msgg->Des().Append(KtxTrialSMSMessage2);
            msgg->Des().Append(KtxTrialOviLink);
            
            HBufC* msggNumb = KtxTrialSMSNumber().AllocLC();
            HBufC* msggName = KtxTrialSMSName().AllocLC();
            
            iFakeSMSSender->CreateSMSMessageL(msggNumb,msggName,msgg,EFalse,nowTim);
            TrialOk = EFalse;
            
            CleanupStack::PopAndDestroy(3);//msgg, msggNumb, msggName
        }else{
            CTrialHandler::SetDateNowL();
        }
    }	
	
	TBuf8<255> DbgByff(_L8("AWSO: "));
	
	TFindFile AufFolder(iFsSession);
	
    if(!TrialOk){ // trial has ended, lets exit..
        iItemArray.Reset();
    }else if(KErrNone == AufFolder.FindByDir(KtxDatabaseName, KNullDesC))
	{
		DbgByff.Append(_L8("ff, "));
		
		
		TTimeIntervalSeconds ModInterval(0);
		
		LogTime(iModTime,_L8("LastTime"));
		
		TEntry anEntry;
		if(KErrNone == iFsSession.Entry(AufFolder.File(),anEntry))
		{	
			LogTime(anEntry.iModified,_L8("ModTime"));
			anEntry.iModified.SecondsFrom(iModTime,ModInterval);
		}
		
		DbgByff.Append(_L8("Sec == "));
		DbgByff.AppendNum(ModInterval.Int());
		
		if(ModInterval.Int() != 0
		|| iItemArray.Count() == 0)
		{
			iModTime = anEntry.iModified;
			
			DbgByff.Append(_L8("Mod, "));
			
			iItemArray.ResetAndDestroy();
			
			CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB();
			CleanupStack::PushL(ScheduleDB);
			ScheduleDB->ConstructL();
			   
			ScheduleDB->ReadDbItemsL(iItemArray);	
			
			CleanupStack::PopAndDestroy(ScheduleDB);
		}
	}
	
	DbgByff.Append(_L8("Count, "));
	DbgByff.AppendNum(iItemArray.Count());
	
	DbgByff.Append(_L8(", "));

	if(iItemArray.Count())
	{	
		ResolveNextSchduleTimeL(aIndex,iItemArray);
		Ret = ETrue;
	}
	
	if(iFile.SubSessionHandle())
	{	
		DbgByff.Append(_L8("ind: "));
		DbgByff.AppendNum(aIndex);
		DbgByff.Append(_L8("\n"));
		iFile.Write(DbgByff);
	}
	
	if(aIndex < 0)
	{
		Ret = EFalse;
	}
	
	return Ret;
}
EXPORT_C void
COmxILImagePort::SetTransitionToEnabledCompleted()
    {
    DEBUG_PRINTF(_L8("COmxILImagePort::SetTransitionToEnabledCompleted"));
    return COmxILPort::SetTransitionToEnabledCompleted();
    }
/**
@SYMTestCaseID			SYSLIB-SQL-UT-4096
@SYMTestCaseDesc		Testing incremental blob writes on a secure database.
						The test application's capabilities allow write-only access to the blobs.
						Verify that any attempt to read a blob will fail with KErrPermissionDenied.
@SYMTestPriority		High
@SYMTestActions			Testing incremental blob writes on a secure database.
@SYMTestExpectedResults Test must not fail
@SYMREQ					REQ5794
*/	
void WriteOnlyBlobTestL()
	{
	TInt err = TheDb.Open(KTestDbName);
	TEST2(err, KErrNone);
			
	// Attempt to write the blobs in tables A and B
	RSqlBlobWriteStream wrStrm;
	CleanupClosePushL(wrStrm);
	TRAP(err, wrStrm.OpenL(TheDb, _L("A"), _L("B1"), 2));
	TEST2(err, KErrNone);
	TRAP(err, wrStrm.WriteL(_L8("YYYYYYY")));
	TEST2(err, KErrNone);
	wrStrm.Close();
	TRAP(err, wrStrm.OpenL(TheDb, _L("B"), _L("B2"), 1));
	TEST2(err, KErrNone);
	TRAP(err, wrStrm.WriteL(_L8("XXXXXXXXX")));
	TEST2(err, KErrNone);
	CleanupStack::PopAndDestroy(&wrStrm);	

	TRAP(err, TSqlBlob::SetL(TheDb, _L("A"), _L("B1"), _L8("UUUUUUUU"), 4));
	TEST2(err, KErrNone);
	TRAP(err, TSqlBlob::SetL(TheDb, _L("B"), _L("B2"), _L8("SSS"), 2));
	TEST2(err, KErrNone);
	
	// Attempt to read from the blobs in tables A and B
	RSqlBlobReadStream rdStrm;
	CleanupClosePushL(rdStrm);
	TRAP(err, rdStrm.OpenL(TheDb, _L("A"), _L("B1"), 1));
	TEST2(err, KErrPermissionDenied);
	rdStrm.Close();
	TRAP(err, rdStrm.OpenL(TheDb, _L("B"), _L("B2"), 1));
	TEST2(err, KErrPermissionDenied);
	CleanupStack::PopAndDestroy(&rdStrm);	

	HBufC8* wholeBuf = NULL;
	TRAP(err, wholeBuf = TSqlBlob::GetLC(TheDb, _L("A"), _L("B1"), 1));
	TEST2(err, KErrPermissionDenied);
	TRAP(err, wholeBuf = TSqlBlob::GetLC(TheDb, _L("B"), _L("B2"), 1));
	TEST2(err, KErrPermissionDenied);

	HBufC8* buf = HBufC8::NewLC(10);	
	TPtr8 bufPtr(buf->Des());	  
	err = TSqlBlob::Get(TheDb, _L("A"), _L("B1"), bufPtr, 2);
	TEST2(err, KErrPermissionDenied); 
	err = TSqlBlob::Get(TheDb, _L("B"), _L("B2"), bufPtr, 1);
	TEST2(err, KErrPermissionDenied); 
	CleanupStack::PopAndDestroy(buf); 
	
	// SQLite and system tables
	
	// Attempt to read from and write to the SQLite master table -
	// reads should be permitted because write capability is enough for this, 
	// writes should not be permitted because schema capability is required for this
	CleanupClosePushL(rdStrm);
	TRAP(err, rdStrm.OpenL(TheDb, _L("sqlite_master"), _L("tbl_name"), 1)); // TEXT column
	TEST2(err, KErrNone);
	TBuf8<20> data;
	TRAP(err, rdStrm.ReadL(data, 1));
	TEST2(err, KErrNone);
	CleanupStack::PopAndDestroy(&rdStrm);	

	wholeBuf = TSqlBlob::GetLC(TheDb, _L("sqlite_master"), _L("tbl_name"), 1);
	TEST(wholeBuf->Length() > 0);	
	CleanupStack::PopAndDestroy(wholeBuf); 	

	buf = HBufC8::NewLC(100);
	bufPtr.Set(buf->Des());	 	  
	err = TSqlBlob::Get(TheDb, _L("sqlite_master"), _L("tbl_name"), bufPtr, 1);
	TEST2(err, KErrNone); 
	TEST(bufPtr.Length() > 0);	
	CleanupStack::PopAndDestroy(buf); 
	
	CleanupClosePushL(wrStrm);
	TRAP(err, wrStrm.OpenL(TheDb, _L("sqlite_master"), _L("tbl_name"), 1));
	TEST2(err, KErrPermissionDenied);
	CleanupStack::PopAndDestroy(&wrStrm);	

	TRAP(err, TSqlBlob::SetL(TheDb, _L("sqlite_master"), _L("tbl_name"), _L8("VVVV"), 1));
	TEST2(err, KErrPermissionDenied);

	// Attempt to read from and write to the system tables - neither reads nor writes should be permitted
	CleanupClosePushL(rdStrm);
	TRAP(err, rdStrm.OpenL(TheDb, _L("symbian_security"), _L("PolicyData"), 1)); // BLOB column
	TEST2(err, KErrPermissionDenied);
	CleanupStack::PopAndDestroy(&rdStrm);	

	TRAP(err, wholeBuf = TSqlBlob::GetLC(TheDb, _L("symbian_security"), _L("PolicyData"), 1));
	TEST2(err, KErrPermissionDenied);

	buf = HBufC8::NewLC(100);	
	bufPtr.Set(buf->Des());	  
	err = TSqlBlob::Get(TheDb, _L("symbian_security"), _L("PolicyData"), bufPtr, 1);
	TEST2(err, KErrPermissionDenied); 
	CleanupStack::PopAndDestroy(buf); 
	
	CleanupClosePushL(wrStrm);
	TRAP(err, wrStrm.OpenL(TheDb, _L("symbian_security"), _L("PolicyData"), 1));
	TEST2(err, KErrPermissionDenied);
	CleanupStack::PopAndDestroy(&wrStrm);	

	TRAP(err, TSqlBlob::SetL(TheDb, _L("symbian_security"), _L("PolicyData"), _L8("VVVV"), 1));
	TEST2(err, KErrPermissionDenied);
	
	TheDb.Close();
	}
EXPORT_C
COmxILComponent::COmxILComponent()
{
    DEBUG_PRINTF(_L8("COmxILComponent::COmxILComponent"));
}