Brew interview questions and answers -P3

1)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.
2.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().
3)Can incoming SMS messages be emulated with the SDK?
SMS emulation will be available in version 1.1 of the BREW SDK.
4.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.
5.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.
The recommended workaround for BREW SDK Version 1.0.1 is for the user to press 'No' twice (i.e. press Select Key twice). When the Privacy Alert Yes/No dialog is displayed, all key events up until the first Select key press go to the Dialog. After the first Select key (for the dialog), subsequent key events go to the application.
Steps are outlined below:
1.Added a boolean 'madeVoiceCall' in the Applet structure
2. If ITAPI_MakeVoiceCall() returns Success, set madeVoiceCall to TRUE
retValue = ITAPI_MakeVoiceCall(pMe->p_tapi, PHONE_NUM,
AEECLSID_SAMPLEAPP);
ITAPI_Release(pMe->p_tapi);
if(retValue == SUCCESS) {
pMe->madeTapiCall = TRUE;

}
3.Handle EVT_KEY in the app handler function. If the Select key was pressed and madeVoiceCall is TRUE, the user has selected No in response to the Privacy Alert. Set madeVoiceCall = FALSE and redraw screen.
case EVT_KEY:
if (wParam == AVK_SELECT && pMe->madeTapiCall ==
TRUE) {
// Redraw screen
pMe->madeTapiCall = FALSE;
}
return TRUE;
4. If the user selected 'Yes' to the Privacy Alert, the application would have been suspended. When resumed, the madeVoiceCall flag must be cleared.
case EVT_APP_RESUME:
if(pMe->madeTapiCall == TRUE) {
pMe->madeTapiCall = FALSE;

}
… … …
… … …
return TRUE;
6)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.
7.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:
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().
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.
8.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.
9.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.
For example:
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);

No comments: