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

Developer

Forums

Forums:

Hi,

My application connect to a server, download a file, parse and then display.

My application can't launch on the emultor. I think the problem is initAppData() and freeAppData(). I really don't understand what to innitiate in the function. What should be included in there? I just want a simple version of it so my application can start on emulator.

I just want to see the flash screen and then stop. I will add menu functions later. Here's my initAppData() and freeAppData():

static boolean Catalog_InitAppData(CApp * pApp)
{
AEEDeviceInfo di;
IShell * pIShell = pApp->a.m_pIShell;

// Initialize Data Members
pApp->m_pIWeb = NULL;
pApp->m_pIWebResp = NULL;
pApp->m_BodyBuffer = NULL;
pApp->m_BodySize = 0;
pApp->m_BodyAllocSize = 0;
pApp->m_pIMainMenu = NULL;
pApp->m_pISpeedMenu = NULL;
pApp->m_pHighway = NULL;

// Create each of the controls used by the application.
if((ISHELL_CreateInstance(pIShell, AEECLSID_FILEMGR, (void**)(&pApp->m_pIFileMgr)) != SUCCESS) ||
(ISHELL_CreateInstance(pIShell, AEECLSID_HTML, (void**)(&pApp->m_pHTMLViewer)) != SUCCESS) ||
(ISHELL_CreateInstance(pIShell, AEECLSID_NET, (void**)(&pApp->m_pINetMgr)) != SUCCESS) ||
(ISHELL_CreateInstance(pIShell, AEECLSID_WEB, (void **)(&pApp->m_pIWeb)) != SUCCESS))
{
IAPPLET_Release((IApplet*)pApp);
return FALSE;
}

// Set callback for HTML viewer
// IHTMLVIEWER_SetNotifyFn(pApp->m_pHTMLViewer, (PFNHVIEWNOTIFY)ND_NotifyCB, pApp);
// IHTMLVIEWER_SetProperties(pApp->m_pHTMLViewer, HVP_SCROLLBAR);

// Get device screen rect
ISHELL_GetDeviceInfo(pApp->a.m_pIShell, &di);
SETAEERECT(&pApp->m_rc, 0, 0, di.cxScreen, di.cyScreen);

static void Catalog_FreeAppData(App* pApp )
{
// Release other interfaces
ReleaseObj((void**)&pApp->m_pIFileMgr);
ReleaseObj((void**)&pApp->m_pHTMLViewer);
ReleaseObj((void**)&pApp->m_pINetMgr);
ReleaseObj((void**)&pApp->m_pIWeb);

This is my structure:

typedef struct _App
{
//First element of this structure must be AEEApplet.
AEEApplet a ;
int m_cxWidth; // device width and height
int m_cx_Height;
int m_nCursorX; // cursor bitmap x and y cordinates
int m_nCursorY;
IImage * m_pIImage; // IImage interface ptr

//App specific data
IFileMgr* m_pIFileMgr;
IWeb* m_pIWeb;
IWebResp* m_pIWebResp;
AEERect m_rc;
IHtmlViewer * m_pHTMLViewer;
INetMgr * m_pINetMgr;
AEECallback m_Callback;

char* m_BodyBuffer;
int m_BodySize;
int m_BodyAllocSize;
IMenuCtl* m_pIMainMenu;
IMenuCtl* m_pISpeedMenu;

uint16 m_cxScreen, m_cyScreen;
AEERect m_MenuFrame;
boolean m_bDeviceIsMono;
IImage* m_pLogo; // Logo
IImage* m_pSplashImage; // Splash
IImage* m_pHighway;
int m_nCurrentAnimID;

boolean m_bAnimPlaying;
boolean m_bIsProgressDisp;
boolean m_bDownloadErr;
boolean m_bSuspended;

} App;

Thank you.

Quote:
// Initialize Data Members
pApp->m_pIWeb = NULL;
pApp->m_pIWebResp = NULL;
pApp->m_BodyBuffer = NULL;
pApp->m_BodySize = 0;
pApp->m_BodyAllocSize = 0;
pApp->m_pIMainMenu = NULL;
pApp->m_pISpeedMenu = NULL;
pApp->m_pHighway = NULL;
is not necessary. BREW will initialize your application structure and give your before entering your CreateInstance call.
Quote:
IAPPLET_Release((IApplet*)pApp);
You shouldn't do this. BREW will release your application.
FreeAppdata is the last function BREW will call, before unloading your module. In your free app data function it is good practice to do the following
if ( pApp->m_pIFileMgr )
{
IFileMgr_Release ( pApp->m_pIFileMgr );
pApp->m_pIFileMgr = NULL;

Quote:
// Initialize Data Members
pApp->m_pIWeb = NULL;
pApp->m_pIWebResp = NULL;
pApp->m_BodyBuffer = NULL;
pApp->m_BodySize = 0;
pApp->m_BodyAllocSize = 0;
pApp->m_pIMainMenu = NULL;
pApp->m_pISpeedMenu = NULL;
pApp->m_pHighway = NULL;
is not necessary. BREW will initialize your application structure and give your before entering your CreateInstance call.
Quote:
IAPPLET_Release((IApplet*)pApp);
You shouldn't do this. BREW will release your application.
FreeAppdata is the last function BREW will call, before unloading your module. In your free app data function it is good practice to do the following
if ( pApp->m_pIFileMgr )
{
IFileMgr_Release ( pApp->m_pIFileMgr );
pApp->m_pIFileMgr = NULL;

Thank you, Ruben.
I realized the mistakes and corrected them.
But it still won't show up on the emulator. It displays this message:
"This application has been unloaded to save memory. You must download a new version".
What does that mean?
My app name is Catalog. Does it cause any conflicts?

Thank you, Ruben.
I realized the mistakes and corrected them.
But it still won't show up on the emulator. It displays this message:
"This application has been unloaded to save memory. You must download a new version".
What does that mean?
My app name is Catalog. Does it cause any conflicts?

check with folder names, binary file name, mif file names, sig file names and their locations.

check with folder names, binary file name, mif file names, sig file names and their locations.

What behavior are you seeing when you try to invoke your application on the Emulator? It's quite possible that the source of the problem is something other than your init function, it's hard to tell without more information.
In general, the InitAppData() method should be used to instantiate the members of your applet structure, as you seem to be doing. The FreeAppData() method is called when your application ends, and should be used to free any memory allocated in the init method. This method should also perform any other actions necessary to allow your application to terminate gracefully.

What behavior are you seeing when you try to invoke your application on the Emulator? It's quite possible that the source of the problem is something other than your init function, it's hard to tell without more information.
In general, the InitAppData() method should be used to instantiate the members of your applet structure, as you seem to be doing. The FreeAppData() method is called when your application ends, and should be used to free any memory allocated in the init method. This method should also perform any other actions necessary to allow your application to terminate gracefully.

See this thread for information on specifying application and mif folders in the emulator. The message you're seeing is caused when the emulator is unable to find the applet DLL.

See this thread for information on specifying application and mif folders in the emulator. The message you're seeing is caused when the emulator is unable to find the applet DLL.

Thanks, I changed the DLL path to be the same with MIF and it worked. Then, I changed it back to Debug folder and it still works. This is really wield....
What could be the problem? I just want to know:D

Thanks, I changed the DLL path to be the same with MIF and it worked. Then, I changed it back to Debug folder and it still works. This is really wield....
What could be the problem? I just want to know:D

For BREW to find your dll it needs to reside in the folder with the same name. In your case someapp.dll needs to be in "someapp" folder not in someapp\debug folder. Change the output folder in your project settings.
LNK6004: Means the dll is either deleted or changed since last time MSDEV linker did incremental link. MSDEV will generate new dll with full linking. It should not cause any problem for you

For BREW to find your dll it needs to reside in the folder with the same name. In your case someapp.dll needs to be in "someapp" folder not in someapp\debug folder. Change the output folder in your project settings.
LNK6004: Means the dll is either deleted or changed since last time MSDEV linker did incremental link. MSDEV will generate new dll with full linking. It should not cause any problem for you