21.What is an "SWI Exception?"An "SWI Exception" is usually related to heap memory mismanagement. The most common causes of heap memory corruption are: overwriting the bounds of your allocated arrays, freeing objects more than once, and writing to wild or NULL pointers.
In addition to the more common causes, stack overrun can also lead to SWI Exceptions. 22.Why does the emulator display a blank screen with my application's name when my application exits?Problem: When an application exits while running on the emulator, instead of returning to the main menu screen, a blank screen is displayed with the application name in the upper left corner. 23.How does the memory architecture in BREW work?BREW device has Flash RAM and Heap RAM. You can treat Flash RAM as a hard drive. Programs are stored there, but not run from it. You can treat Heap RAM as you would always treat a memory heap. Say you have an application that is 35k in size. This will take 35k from the Flash RAM to store on the device. When the application is run, the 35k will be loaded into Heap RAM in its entirety plus however much Heap RAM it needs to allocate. When the applet is released, this Heap RAM is freed. It will still occupy space on the Flash RAM until it is removed from the device. 24.What is the size limit for an applet?The size of a BREW applet is limited by the amount of free file system space that is available, and by the amount of available RAM. 25.Why can't an applet be run directly from flash RAM?BREW loads the apps into Heap RAM because files on EFS are stored as non- contiguous blocks. 26.What's the difference between MALLOC() and IHEAP_Malloc() function in BREW-SDK?MALLOC and IHEAP_Malloc() are identical, just as FREE and IHEAP_Free() are identical. In earlier versions of the BREW SDK, malloc was part of the IHEAP Interface, and was later made into a helper function for ease of use. Both are still available for backward compatibility, but it is recommended that, use MALLOC and FREE rather than IHEAP_Malloc() and IHEAP_Free(). 27.What events must an applet handle?In addition to the obvious EVT_APP_START and EVT_APP_STOP, your applet must support EVT_APP_SUSPEND and EVT_APP_RESUME in order to pass True BREW Testing. 28.How to test an application on the emulator to determine if it behaves properly under low memory conditions?This can be achieved by reducing the heap size in the device configurator file (.qsc file) to almost the size of the .mod file. Any run time allocations by the applications should fail and you can test if your application deals with those failures correctly.
29.How to send SMS messages from a BREW application?Currently, BREW does not expose a means to send SMS messages from within a BREW applet. BREW applications can only receive SMS messages. 30.Can an SMS message be sent to an inactive applet?Yes, SMS notification events can be delivered to an application, even if it is not currently active. To do so, BREW first loads the applet, and then sends the EVT_APP_MESSAGE event to it. The application may start itself by calling ISHELL_StartApplet(), or can "silently" process the event without calling ISHELL_StartApplet(). 31.Can incoming SMS messages be emulated with the SDK?SMSSMS emulation will be available in version 1.1 of the BREW SDK. 32.What settings are required to allow a running BREW application to be suspended when a non-BREW SMS message is received on the Sharp Z-800?On the Sharp Z-800 handset, you must set the following in order to receive non-BREW SMS: Main Menu -> Setup/Tool -> BREW Setting -> OFF.
33.When making a voice call using ITAPI_MakeVoiceCall, responding No to the Privacy Alert hangs the application. What is the workaround?This is a bug in BREW SDK version 1.0.1, and will be fixed in an upcoming release.
retValue = ITAPI_MakeVoiceCall(pMe->p_tapi, PHONE_NUM,
AEECLSID_SAMPLEAPP); ITAPI_Release(pMe->p_tapi); if(retValue == SUCCESS) { pMe->madeTapiCall = TRUE; } case EVT_KEY:
if (wParam == AVK_SELECT && pMe->madeTapiCall == TRUE) { // Redraw screen pMe->madeTapiCall = FALSE; } return TRUE; case EVT_APP_RESUME:
if(pMe->madeTapiCall == TRUE) { pMe->madeTapiCall = FALSE; } … … … … … … return TRUE; 34.After making a voice call using ITAPI_MakeVoiceCall, why does my application seem to be restarted when I respond 'No' to the "Return to Application" prompt?Make sure that the parameter clsReturn (application to start when the call ends) in the call to ITAPI_MakeVoiceCall is 0 (zero). If you specify clsReturn as your app's Class ID, then BREW tries to create another instance of your app, rather than resume your app. 35.What guidelines should follow when making a voice call immediately after a data call?After the last socket is released, BREW waits for the network linger time (default linger time is 30s) to expire before terminating the PPP connection. The actual tearing down of the PPP connection takes about 3s. Therefore, (linger time + 3 seconds) must elapse between releasing the last socket and invoking ITAPI_MakeVoiceCall(). You should introduce a (linger time + 3 seconds) timer between releasing the last socket and making the voice call. For example:
Note: In BREW SDK version 2.0, this 3-second lag is built into BREW. The application will not need to implement the additional 3 seconds in its timer.
ReleaseNetAndSocket(pMe); //LINGER_TIME below is in seconds ISHELL_SetTimer(pMe->a.m_pIShell, (LINGER_TIME +3) * 1000, Timer_CB, (void *)pMe); In the timer callback code, you can make the voice call using ITAPI_MakeVoiceCall(). 36.When making a voice call immediately after a data call, why do we see the Privacy Alert again instead of "Return to Application"?Refer to above FAQ In addition to the more common causes, stack overrun can also lead to SWI Exceptions. Note: It is recommended that large buffers be allocated on the heap rather than on the stack as automatic variables. 37.How do I obtain the phone number of the device on which my application is running?An application can obtain the phone number of the device on which it is running by calling ITAPI_GetStatus(). The phone number is in TAPIStatus.szMobileID. TAPIStatus tapiStat;
if (ITAPI_GetStatus(pMe->p_tapi, &tapiStat) == EBADPARM) { DisplayOutput((IApplet*)pMe, 6, "TAPI Status fetch failed"); } DisplayOutput((IApplet*)pMe, 4, "Mobile ID:"); DisplayOutput((IApplet*)pMe, 5, tapiStat.szMobileID); 38.When will BREW offer HTTP Support?HTTP Support is available through the AEEWeb interface in version 1.1 of the BREW SDK and above. With earlier versions of the SDK, use the ISocket interface to connect to a server's HTTP port, and send HTTP "get" and "post" requests. 39.Why does GetHostByName() not work on my phone?For INETMGR_GetHostByName() to function correctly, the phone's Domain Name Server (DNS) settings must be properly configured. This is generally taken care of by the Service Provider, in which case the phone should be returned to the place of purchase, or an authorized service center so that its DNS settings can be properly configured. 40.Why do we get the value of 0.0.0.0 in dnsresult.addrs when I use GetHostByName()?This may be due to incorrect implementation of error handling in the GetHostByName() callback function. The error handling implementation in the GetHostByName() callback of the NetSocket example is incorrect. You can use the following sample implementation: if(pMe->dnsresult.nResult > 0 && pMe->dnsresult.nResult
<= AEEDNSMAXADDRS) { // DNS lookup success // Process dnsresult.addrs for(i = 0; i < pMe->dnsresult.nResult; i++) { SPRINTF(szMsg,"Addr=: %x",pMe->dnsresult.addrs[i]); DisplayOutput(pMe,i+4,szMsg); } } else { // DNS Failure - error code is dnsresult.nResult SPRINTF(szMsg, "DNS: error %d", pMe->dnsresult.nResult); DisplayOutput(pMe, 2, szMsg); } |