×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    May 2010
    Posts
    72

    Passing parameter from symbian c++ to a javascript function

    hello all,

    I want to know how to call javascript code in symbian c++ code

    Actually I want to send text from c++ to javascript and js will print it on page

    so Any ideas

    thanks
    Last edited by phpgenerator; 2010-06-17 at 07:41.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: Passing parameter from symbian c++ to a javascript function

    Hi phpgenerator,

    the most used approach is the one that you've already seen with API Bridge: using a local HTTP server, sending requests from your widget and reading back the response sent from the C++ layer.

    Are you looking for alternatives to API Bridge itself?

    Pit

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

    Re: Passing parameter from symbian c++ to a javascript function

    Hi jappit,

    I want the reverse sending requests from c++ layer to ApiBridge

    thanks

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

    Re: Passing parameter from symbian c++ to a javascript function

    hi jappit,

    Ok what about ECOM what is it exactly and how can I use it in this situation

  5. #5
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: Passing parameter from symbian c++ to a javascript function

    Hi,

    the ECOM interface allows you to write and plug your custom plugins into API Bridge (some Symbian C++ experts could add more details here ).

    Coming back to your needs: you cannot send direct requests from the C++ layer to the JavaScript one, but you can implement some alternative approaches. The simplest would be to perform polling from the JavaScript layer, so sending periodic requests to API Bridge (e.g.: one per second), and reading back its responses.

    Do you think this could work in your case?
    Pit

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

    Re: Passing parameter from symbian c++ to a javascript function

    Hi jappit,

    I think that I can use the example of EchoServelt and change the content of

    [ void CEchoServlet::ServiceL( MHttpRequest* req ) ]

    and write my own implementation

    what do you think ??

  7. #7
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: Passing parameter from symbian c++ to a javascript function

    EchoServlet is a good starting point to write your own plugins, as it contains the very base structure for reading data sent from the JavaScript layer, and sending back the response, so that you can focus exclusively on your own plugin functionality.

    Pit

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

    Re: Passing parameter from symbian c++ to a javascript function

    hi jappit,

    I made this code
    is it right as a concept or what



    [

    void CEchoServlet::ServiceL( MHttpRequest* req )
    {
    //Get the parameters from the request
    RQueryParser qp;
    qp.ParseL( req->GetRequest()->GetQuery() );

    //Read the parameters from the query
    TPtrC8 msg = qp.GetValue( _L8( "msg" ) );
    TPtrC8 err = qp.GetValue( _L8( "err" ) );

    //Check if the "err" parameter was passed
    if(err.Length()) {
    //Respond with an error
    req->GetResponse()->SetStatus(500);
    req->GetResponse()->SendL(err);
    }


    CMyControl* ctrl = new(ELeave) CMyControl;
    CleanupStack::PushL(ctrl);

    ctrl->ConstructL(TRect(0, 0, 176, 208));

    CleanupStack::PopAndDestroy(ctrl);

    qp.Close();
    }


    ]

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

    Re: Passing parameter from symbian c++ to a javascript function

    hi jappit,

    I want to ask something

    If I want to use EchoServelet to create gui after receiving request from javascript then
    I think I need to make applciation in runtime and create my gui on it

    Am I right or I can use gui directly and this gui will apppear behind the browser (I am talking regarding to the last code I paste )

    thanks

  10. #10
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: Passing parameter from symbian c++ to a javascript function

    Hi phpgenerator,

    I've currently no precise answer about your last question: will let you know if I find any (some Symbian C++ experts can surely help here!! )

    Pit

Similar Threads

  1. How to call javascript function in Symbian
    By waterInSky in forum Symbian C++
    Replies: 0
    Last Post: 2008-10-22, 16:18
  2. Passing & returning parameter to/from function
    By jarruots in forum Symbian C++
    Replies: 3
    Last Post: 2006-11-21, 12:17
  3. Passing parameter to Application
    By jigneshshah in forum Symbian C++
    Replies: 1
    Last Post: 2005-08-31, 03:32
  4. parameter passing through url
    By kevin1964 in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2004-04-07, 16:21
  5. Parameter passing
    By Nokia_Archive in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-05-15, 02:55

Posting Permissions

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