Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

I am a newbie in Brew.
I need to get an image from server,I want to get that image as a background and want to move ahead in my application whille fetching image in the background.
Please help me to write a code that will run in the background to fetch the image data in the bacground

Manish

Hi ManishJ,
To move your application in background; you need to perform following 2 things:
//////////////////////
1. Close your applet by calling API...
ISHELL_CloseApplet(pme->a.m_pIShell, FALSE);
/*****Pl Take note that second Param is FALSE,*****/
2. In your Applet's main Event Handling function; handle EVT_APP_STOP as:
case EVT_APP_STOP:
*((boolean*) dwParam) = FALSE;
/////////////////////
This 2 things willl put your applet in Background.
Hope this will get rid to ur problem:
SoftEast :) :o

Hi ManishJ,
To move your application in background; you need to perform following 2 things:
//////////////////////
1. Close your applet by calling API...
ISHELL_CloseApplet(pme->a.m_pIShell, FALSE);
/*****Pl Take note that second Param is FALSE,*****/
2. In your Applet's main Event Handling function; handle EVT_APP_STOP as:
case EVT_APP_STOP:
*((boolean*) dwParam) = FALSE;
/////////////////////
This 2 things willl put your applet in Background.
Hope this will get rid to ur problem:
SoftEast :) :o

Softeast's solution alows your application to run in background, however, application will not be able to draw on the screen and get user key presses.
Since you wrote "want to move ahead in my application whille fetching image in the background" - I assume that's not exactly what you want.
Probably what you really want is leave application running foreground, interacting with user, it's just the image download process should run at the same time, seemelessly to user. If this is it then:
1. HTTP communication is asynchronous anyway, so, all you have to do is just call IWEB_GetResponse with a properly specified callback and go on with your application.
2. as long as your application handles events properly, without consuming too much CPU and returning control to BREW ASAP - you will get a callback when server response will arrive. If your application is event-driven - that would be it. There is no need for a special code written. All is done in a WEB transport callback.
If your application wants to do some time consuming computation meanwhile - you'll have to break it to as many small steps as possible and return control to BREW, setting a callback with ISHELL_Resume. Callback should perform the next step and return control to BREW again, scheduling the next step by calling ISHELL_Resume again.
Breaking long computations like this will allow BREW to get control once in a while and perform it's duties, like calling your transport callback.

Softeast's solution alows your application to run in background, however, application will not be able to draw on the screen and get user key presses.
Since you wrote "want to move ahead in my application whille fetching image in the background" - I assume that's not exactly what you want.
Probably what you really want is leave application running foreground, interacting with user, it's just the image download process should run at the same time, seemelessly to user. If this is it then:
1. HTTP communication is asynchronous anyway, so, all you have to do is just call IWEB_GetResponse with a properly specified callback and go on with your application.
2. as long as your application handles events properly, without consuming too much CPU and returning control to BREW ASAP - you will get a callback when server response will arrive. If your application is event-driven - that would be it. There is no need for a special code written. All is done in a WEB transport callback.
If your application wants to do some time consuming computation meanwhile - you'll have to break it to as many small steps as possible and return control to BREW, setting a callback with ISHELL_Resume. Callback should perform the next step and return control to BREW again, scheduling the next step by calling ISHELL_Resume again.
Breaking long computations like this will allow BREW to get control once in a while and perform it's duties, like calling your transport callback.

Hi,
It works , But now I have to place two request to the server simultaneously.
I don't know how I can place two request to the server. Please help me.
Manish
archi wrote:Softeast's solution alows your application to run in background, however, application will not be able to draw on the screen and get user key presses.
Since you wrote "want to move ahead in my application whille fetching image in the background" - I assume that's not exactly what you want.
Probably what you really want is leave application running foreground, interacting with user, it's just the image download process should run at the same time, seemelessly to user. If this is it then:
1. HTTP communication is asynchronous anyway, so, all you have to do is just call IWEB_GetResponse with a properly specified callback and go on with your application.
2. as long as your application handles events properly, without consuming too much CPU and returning control to BREW ASAP - you will get a callback when server response will arrive. If your application is event-driven - that would be it. There is no need for a special code written. All is done in a WEB transport callback.
If your application wants to do some time consuming computation meanwhile - you'll have to break it to as many small steps as possible and return control to BREW, setting a callback with ISHELL_Resume. Callback should perform the next step and return control to BREW again, scheduling the next step by calling ISHELL_Resume again.
Breaking long computations like this will allow BREW to get control once in a while and perform it's duties, like calling your transport callback.

Hi,
It works , But now I have to place two request to the server simultaneously.
I don't know how I can place two request to the server. Please help me.
Manish
archi wrote:Softeast's solution alows your application to run in background, however, application will not be able to draw on the screen and get user key presses.
Since you wrote "want to move ahead in my application whille fetching image in the background" - I assume that's not exactly what you want.
Probably what you really want is leave application running foreground, interacting with user, it's just the image download process should run at the same time, seemelessly to user. If this is it then:
1. HTTP communication is asynchronous anyway, so, all you have to do is just call IWEB_GetResponse with a properly specified callback and go on with your application.
2. as long as your application handles events properly, without consuming too much CPU and returning control to BREW ASAP - you will get a callback when server response will arrive. If your application is event-driven - that would be it. There is no need for a special code written. All is done in a WEB transport callback.
If your application wants to do some time consuming computation meanwhile - you'll have to break it to as many small steps as possible and return control to BREW, setting a callback with ISHELL_Resume. Callback should perform the next step and return control to BREW again, scheduling the next step by calling ISHELL_Resume again.
Breaking long computations like this will allow BREW to get control once in a while and perform it's duties, like calling your transport callback.

manishj wrote:Hi,
It works , But now I have to place two request to the server simultaneously.
I don't know how I can place two request to the server. Please help me.
Manish
Excepting some newest versions of Brew SDK, Brew doesn't support multithreading environment. So It doesn't seem feasible to send two simultaneous requests to server. Although you can hit the server in sequential manner.
~~~~~~
SoftEast
~~~~~~

manishj wrote:Hi,
It works , But now I have to place two request to the server simultaneously.
I don't know how I can place two request to the server. Please help me.
Manish
Excepting some newest versions of Brew SDK, Brew doesn't support multithreading environment. So It doesn't seem feasible to send two simultaneous requests to server. Although you can hit the server in sequential manner.
~~~~~~
SoftEast
~~~~~~

Softeast wrote:Excepting some newest versions of Brew SDK, Brew doesn't support multithreading environment. So It doesn't seem feasible to send two simultaneous requests to server. Although you can hit the server in sequential manner.
~~~~~~
SoftEast
~~~~~~
Hi ,
Now I am using SDK 2.13 to get the support of thread.
But now I got stuck into using threads to place two request to server simultaneously

Softeast wrote:Excepting some newest versions of Brew SDK, Brew doesn't support multithreading environment. So It doesn't seem feasible to send two simultaneous requests to server. Although you can hit the server in sequential manner.
~~~~~~
SoftEast
~~~~~~
Hi ,
Now I am using SDK 2.13 to get the support of thread.
But now I got stuck into using threads to place two request to server simultaneously