×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    passing parameters

    hi all,

    how could I use this code to receive parameter from GraphicsPlugin.exe in this function
    Code:
    	_LIT(KMyExeFile,"GraphicsPlugin.exe");
    	_LIT(KMyExeFileCmd,"");
    	 
    	RProcess proc;
    	
    //	proc.SetParameter("signal",_L8("w"))
    	
    	User::LeaveIfError(proc.Create(KMyExeFile,KMyExeFileCmd));
    	// start the process running! Don't forget this.
    	proc.Resume();
    	// Closes the handle, not the process.
    	proc.Close();
    Last edited by phpgenerator; 2010-06-24 at 13:36.

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,347

    Re: passing parameters

    This article will give you some idea: http://wiki.forum.nokia.com/index.ph...ine_and_S60_UI
    Nokia Developer Wiki Moderation team

  3. #3
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Re: passing parameters

    this is very complicated

    is there any thing that is simpler

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: passing parameters

    You could use Publish and Subscribe (RProperty class). Define it anywhere, Set in the GUI and Get it in the caller code.

  5. #5
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Re: passing parameters

    what do you mean by anywhere ??

  6. #6
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: passing parameters

    what is the type of GraphicsPlugin.exe , GUI or non-GUI.

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: passing parameters

    The story so far is that Phpgenerator wants to get some input from the user, into some kind of plugin. So GraphicsPlugin.exe is a GUI application, and it is supposed to return its result (password, number of eggs in the refrigerator, something) to the plugin.

    Phpgenerator: anywhere means anywhere before you set it. In the previous line, in the plugin, or somewhere else in GraphicsPlugin.exe, it does not matter for the first experiment.

  8. #8
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Re: passing parameters

    hello ,


    I tried to use RProperty

    I did not understand from examples what is this [ const TUid KMyPropertyCat = {0x10012345}; ]

    and this is my code in caller

    Code:
    LOCAL_C void MainL()
    	{
    	console->Write(_L("Hello, world caller!\n"));
    
    	// Define RProperty key
    	    TUint EMyPropertyKey = 0;
    	    // Define RProperty category	    
    	    const TUid KMyPropertyCat = {0x10012345};
    	    // Defining policy
    	    static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
    		static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt);
    		// Define a property to be integer type
    		TInt result = RProperty::Define(EMyPropertyKey,RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
    		//Check if existed	
    		if (result != KErrAlreadyExists)
    		{
    			User::LeaveIfError(result);
    		}
    		// Subscribe to the property to notified when changed
    		RProperty property;
    		TInt r = property.Attach(KMyPropertyCat,EMyPropertyKey,EOwnerThread);
    		User::LeaveIfError(r);
    	
    		// Wait for the previously attached property to be updated
    //		TRequestStatus status;
    //		property.Subscribe(status);
    //		User::WaitForRequest(status);
    		
    		// Call other application
    		_LIT(KMyExeFile,"hello_called.exe");
    		_LIT(KMyExeFileCmd,"");
    		 
    		RProcess proc;
    		User::LeaveIfError(proc.Create(KMyExeFile,KMyExeFileCmd));
    		// start the process running! Don't forget this.
    		proc.Resume();
    			
    		// Notification complete, retrieve the value.
    		TInt aValue;
    		property.Get(aValue);
    		// Close property, delete it and return value to ServiceL
    		property.Close();
    		property.Delete(EMyPropertyKey);
    	
    		proc.Close(); // Closes the handle, not the process.
    	}
    and this is the code for called applciation

    Code:
    LOCAL_C void MainL()
    	{
    		console->Write(_L("Hello, world called!\n"));
    	
    		// Define RProperty key
    		TUint EMyPropertyKey = 0;
    		// Define RProperty category	    
    		const TUid KMyPropertyCat = {0x10012345};
    			    
    		// Subscribe to the property to notified when changed
    		RProperty property;
    		TInt result = property.Attach(KMyPropertyCat,EMyPropertyKey,EOwnerThread);
    		User::LeaveIfError(result);
    		
    		// Set the RProperty value
    		result = RProperty::Set(KMyPropertyCat,EMyPropertyKey,5);
    		User::LeaveIfError(result);
    		
    		console->Write(_L("Called end !\n"));
    	}

    what do you think is there any thing logically wrong


    thanks

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: passing parameters

    Think of it as a two-level array: "Properties[KMyProperyCat][EMyPropertyKey]".
    The bad thing about the example is the 0x10012345 - it is a too low number, and probably falls into the protected category (the KUidSystemCategoryValue what the documentation mentions). Using your own UID (the 0xE1234567 one) would be safer.
    That Define call is a bit suspicious, since it does not use KMyProperyCat - does it compile?
    At the first try I would not care about security stuff, and just write
    Code:
    TInt result = RProperty::Define(KMyProperyCat,EMyPropertyKey,RProperty::EInt);

  10. #10
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Re: passing parameters

    when using ur statement it gives me in runtime error leave code = -46

    and when using mine it gives me leave code = -1

    both compiled successfully

    I'll debug and post to you

  11. #11
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Re: passing parameters

    TInt result = RProperty::Define(KMyPropertyCat,EMyPropertyKey,RProperty::EInt);
    //Check if existed
    if (result != KErrAlreadyExists)
    {
    User::LeaveIfError(result); // this is the line of error leave code = -46
    }

    Is this condition means that It couldnot define my property or what

  12. #12
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Re: passing parameters

    I think I am on the right way but I miss some steps or squence of steps

    could you give me a logical sequence of steps like

    caller ==> define property, attach to property, call called process, receive value
    called ==> attach to property, set value

    Is this sequence right ??

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: passing parameters

    The logic is fine, just you are still using the erroneous 0x10012345 I guess, at least that is what -46 suggests: http://wiki.forum.nokia.com/index.ph...OS_Error_Codes
    Search for RProperty on http://library.forum.nokia.com, and click on the second hit. Then check the very first (and only) Define method described on that page, especially the tiny blue text.
    Unfortunately I have no patience to find the value of KUidSystemCategoryValue online, but it is at the very beginning of e32property.h in the SDK
    Quote Originally Posted by e32propery.h
    // e32\include\e32property.h
    //
    // Copyright (c) 2002-2003 Symbian Ltd. All rights reserved.
    //

    #ifndef __E32PROPERTY_H__
    #define __E32PROPERTY_H__

    #include <e32cmn.h>

    /**
    @publishedAll
    @released

    Property category UID value reserved for System services.
    */
    static const TInt32 KUidSystemCategoryValue=0x101f75b6;
    now 0x10012345 is smaller than 0x101f75b6, that is why the example is bad.
    And no, the solution is not adding WriteDeviceData capability to your code (which would result in that you could not test it with self-signing, etc.), but to modify to something else, like your own UID (to avoid clashes), or as a minimal approach to 0xE0012345.

  14. #14
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Re: passing parameters

    OK I used 0xE0012345 but still the same problem when get the value from the property I found it -8936762 "rubbish data"

    I found a thread on forum talking about avoiding using define method that use category and using third overloaded one
    also ignoring -1 exception as it is a problem of emulator

    and recommended to define method on listner not sender

    so I will try that and tell you results

    thanks

  15. #15
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: passing parameters

    Though in your earlier codes there were traces of waiting for the GUI to complete, in your current code you do not wait for anything. Which is wrong: you define the property, start the GUI process, and read the property in the next line.
    Any of RProcess::Logon, RProcess::Rendezvous, RProperty::Subscribe can help you in that.

Similar Threads

  1. Passing parameters through URL
    By chatrapati.nokia.santhosh in forum General Development Questions
    Replies: 4
    Last Post: 2010-03-22, 15:25
  2. Passing custom parameters from AppUi to a View
    By atleta in forum Symbian User Interface
    Replies: 2
    Last Post: 2010-01-22, 12:03
  3. Passing download parameters to application
    By heitorfr in forum Symbian
    Replies: 6
    Last Post: 2007-10-31, 15:37
  4. Passing parameters to MIDlets?
    By clawler@zicorp.com in forum Mobile Java General
    Replies: 4
    Last Post: 2006-06-27, 06:54
  5. passing command line parameters?
    By prbhat in forum Symbian User Interface
    Replies: 2
    Last Post: 2004-04-23, 04:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×