March 16, 2018

Sreekanth B

Binary Runtime Environment for Wireless Interview Questions Answers

How To Compile An Application To Run On A Handset?

To build applications for the phone requires the ARM Developer Suite of tools, which are used to compile and link a project that has been developed using the PC-based BREW SDK, and related tools. Running an application built using the ARM tools requires a BREW-enabled phone, a data cable for establishing a serial connection to the phone, and file copying software such as QUALCOMM's BREW AppLoader application. See How to Build a Downloadable BREW Application for more details.

How To Upload A Device Configurator File (.qsc) To A Phonethe ?

The device configurator file (.qsc) is used by the BREW Emulator application, and is not required to run applications on the phone.

How To Debug Output On Emulator And Phone?

When an application is running on the BREW Emulator, DBGPRINTF outputs messages to the Visual C++ Debug Window. Currently, DBGPRINTF messages are not available while running on a phone. Support for outputting debug messages to a host PC via serial connection is under development.

What Compilers Can Be Used To Compile Brew Applications?

The ARM BREW Builder can be used to compile BREW applications.

What Guidelines Should Be Followed When Compiling An Application In Thumb Mode?

function AEEMod_Load() must be moved to a different source file and this file must be compiled in ARM mode. AEEMod_Load() must always be compiled in ARM mode.

All files that are compiled in thumb mode MUST have the INTERWORK compiler option turned on. If this option is NOT turned on in the make file, the app will very likely crash.

What To Do If We Installed Arm Brew Builder Or Arm Development Suite Into A Path With Spaces?
The solution is to modify your makefile in the following fashion:

Comment out the ARMBIN, ARMINC, and ARMLIB declaration.
Add the full path to the ARMCC, LD, and HEXTOOL variables. Make sure you double quote the path.
What Are The Operating System Requirements Of The Brew Sdk?

Due to the requirement for Unicode support, the SDK runs only on the Microsoft Windows NT™ 4.0, Windows 2000™ and Windows XP™ platforms. Windows 98 is not supported by the BREW SDK.

Does Brew Support Multi-threading?

BREW does not support multi-threading. BREW does have support for cooperative multi-tasking.

Can We Link To Windows Dlls From The Sdk?

No. You should treat the SDK as a fully integrated stand-alone platform, which includes avoiding the C Standard Libraries. BREW has provided a port of the most common functions.

How To Transfer Compiled Applications To A Phone?

Use BREW AppLoader to upload applications to the phone. The following example shows files and locations for an application with the name " brewApp."

/brew/ brewApp.mif

Generated by BREW MIF Editor.
/brew/ brewApp/ brewApp.bar

Generated by BREW Resource Editor.
/brew/ brewApp/ brewApp.mod

Compiled and linked with ARM BREW Builder.
/brew/ brewApp/ brewApp.sig

Digital Signature.
All directory and file names on the phone must be in lower case. Any additional files specific to your application may also be copied to the application directory, or subdirectories of the application directory.

The Digital Signature file is generated using the BREW TestSig Generator, then renamed with the name of the application. The first part of the .sig filename must be the same as the first part of the .mod filename.

After uploading files, reset the phone.

On What Devices Is Brew Supported?

Currently, support for BREW is only available for devices based on the following QUALCOMM chipsets: MSM3100, MSM3300, MSM5000, MSM5100, and MSM5105. In addition, for a particular phone or other device to support BREW, it must be "BREW enabled" with a version of the BREW runtime provided by the device's manufacturer.

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.

What Difference Is There Between Using The Phone's "end" Key To Close An Applet, And Using The "clear" Key To Close An Applet?

A key, that when pressed, will close the current application. Most OEMs designate this to be the AVK_CLR key.

A key, that when pressed, will close all applications. Most OEMs designate this to be the AVK_END key.
When AVK_END is pressed, BREW will immediately send EVT_APP_STOP to the active applet without first sending the AVK_END key. In addition, the FreeAppData() callback routine provided to AEEApplet_New() will be called prior to unloading the applet; no other events or callbacks will occur.
When AVK_CLR is pressed, BREW will first send this event to the applet. If the applet does not handle the event (i.e. returns FALSE in HandleEvent), only then BREW will close the application. In the implementation of your AVK_CLR handler, remember to also call FreeAppData as follows:
case AVK_CLR:

if (pMe->OnMainMenu == TRUE) {
// App is on main menu. Therefore pressing CLR key should cause app to exit
HelloWorld_FreeAppData(pi); //clean up
return FALSE; //return FALSE so that BREW will now close application
}
else { // Not on main menu.
// Therefore pressing CLR key should cause app to undo one level of menu
// nesting. Show previous menu in menu hierarchy
return TRUE;
}
Make sure that your FreeAppletData() properly cleans up all allocated memory and resources. All objects and interfaces created by CreateInstance, CreateDialog, MALLOC, etc., must have an associated call to Release or FREE.

How Do I Deal With A Low Battery Warning?

BREW sends the running application an EVT_APP_SUSPEND event in the case of a Low Battery Warning. In order to handle low battery condition, you must correctly handle EVT_APP_SUSPEND and EVT_APP_RESUME events.

What Is The Difference Between Ishell_sendevent() And Ishell_ Postevent()?

XML is no way clashes with HTML, since they are for two different purposes.

ISHELL_SendEvent() :

In the case of ISHELL_SendEvent(), the event is immediately sent to the application of the specified Class ID. If an instance of that class is not currently present, the AEE Shell creates one, and then invokes its IAPPLET_HandleEvent() function with the specified event code and data parameters. Unless it chooses to start itself, the application terminates after it completes processing of the event.
The ISHELL_SendEvent() function allows for control over the destination applet. This function sends the event directly to the destination applet.
ISHELL_PostEvent() :

ISHELL_PostEvent() is similar, except that the destination class's IAPPLET_HandleEvent() function is not called immediately. The event is placed in a queue and is sent at a later time, which allows the calling application to continue its processing without interruption.
The processing of events posted using ISHELL_PostEvent() is deferred until the next iteration of the event loop. This is useful in providing continued execution while allowing other events to be processed.
What Notification Events Can An App Register For?

notifications:

TAPI (Class ID: 0x01001007)
NMASK_TAPI_STATUS
0x0001
TAPI Status change event
NMASK_TAPI_SMS_TEXT
0x0002
Incoming SMS
NMASK_TAPI_SMS_TS
0x0004
SMS message on specific Teleservice ID
INETMGR
NMASK_OPENED
0x0001
Network layer is available
NMASK_CLOSED
0x0002
Network layer is closed
NMASK_IDLE
0x0004
Network layer available and idleNote

How To Test Application For Proper Handling Of Suspend/resume Events On A Non- Provisioned Phone?

On the Kyocera 3035, you can test your app's handling of Suspend/Resume events by enabling automatic Keyguard (Main Menu->Settings->Keyguard) before running your app. When the Keyguard kicks in, the running app will receive a Suspend Event. The app will receive Resume event when the screen is unlocked.

On the Sharp Z-800, you can test your app's handling of Suspend/Resume events by setting the alarm to go off a few minutes in the future (Main Menu->Setup/Tools->Alarm->Daily Alarm) and then running the BREW app. Please note that in order for the app to be suspended when the alarm goes off, BREW Priority Setting must be off (Main Menu->Setup/Tools->BREW Priority Setting).

How To Recover The Phone From An "undefined Exception"?

"Undef Inst Exception" stands for "undefined instruction exception," and means that the program pointer has jumped to a code segment that contains an undefined instruction. This can be the result of memory corruption, a stack overrun, or version-related incompatibilities between applet code and the BREW image on the phone.

Memory is tighter on the phone than when running on the emulator. Therefore, memory and stack overrun problems will be more likely to show up on the phone. You should double check memory related areas of your code, especially auto variable arrays and the maximum total size of allocated memory. To clear the phone, pull the battery out for a few seconds.

What Is A "re-entrant Data Abort?

"The "Re-entrant Data Abort" exception is often caused by stack overrun. When an applet is running on the phone the stack size is small, and you are more likely to see stack overrun problems than when running on the emulator. Solutions to this problem are reducing the size or number of objects on the stack, and using objects allocated on the heap instead of automatic variables.

Note: Version-related incompatibilities between applet code and the BREW image on the phone can also lead to this type of exception.

What Is A "pref Abort Exception?

"A "Pref Abort Exception" usually indicates that memory important to the phone operating system has been trashed. The two most common causes of this exception are data corruption (i.e. running off the end of an array), and stack overruns.

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.

Note: It is recommended that large buffers be allocated on the heap rather than on the stack as automatic variables.


When Reading From A Socket The Phone Reads Whatever It Can In One Go, While The Emulator Reads Large Packets In Chunks. Why?

This is a limitation of the phone.

Program should call ISOCKET_Readable() to be informed when more data can be read from the stream. The callback routine registered by ISOCKET_Readable() will be invoked whenever data becomes available---you can usually call ISOCKET_Read() at this point. Continue calling ISOCKET_Readable() for as long as your program expects more data.

rv = ISOCKET_Read(piSock, (byte *)szBuf, sizeof(szBuf));
if (rv == AEE_NET_WOULDBLOCK) {
// WOULDBLOCK => no more data available at the moment
// Register the callback to read the data later.
ISOCKET_Readable(piSock, CommonReadCB, (void*)pMe);
return;
}
else if (rv == AEE_NET_ERROR) {
// error reading from socket
ReleaseNetAndSocket (pMe);
}
else if (rv > 0) {
// rv bytes of data has been read from the socket into
// szBuf
// Read remaining data
ISOCKET_Readable(piSock, CommonReadCB, (void*)pMe);
}
else { // rv == 0
// There is no more data to be received.
// The peer has shut down the connection.
ReleaseNetAndSocket (pMe);
}

How Can We Check The Status Of My Sockets And Ppp Connection?

We can check on the status of the PPP connection (active, inactive, opening or closing) using INETMGR_NetStatus().

NetState netState = NET_INVALID_STATE;
AEENetStats netStats;
netState = INETMGR_NetStatus (pINetMgr, &netStats);
We can use INETMGR_OnEvent() to monitor both the status of the PPP connection and socket connections. Refer to NetMgrEvent enum in AEENet.h for a list of all network and socket events.
// Register to receive Network and Socket events
INETMGR_OnEvent(piNet, (PFNNETMGREVENT)CheckNetStatus,
(void*)pMe, TRUE);
//Callback invoked when Network/Socket event is received
static void CheckNetStatus(void* cxt,
NetMgrEvent evt, uint32 dwData) {
SampleApp *pMe = (SampleApp*)cxt;
if(evt == NE_PPP) {
// network event. dwData = NetState enum value
// refer NetState data structure in BREW API Reference doc
}
if(evt == NE_SO_CLOSING || evt == NE_SO_CLOSED) {
// socket event - closing or closed.
// DwData is pointer to socket
}
… …
return;
}

Is It Possible To Transfer Data Between Two Phones?

Peer to peer connections between two phones have been found to be unreliable, failing when the phones are on the same subnet. It is best therefore to use a proxy server, transferring data between the phones using the server as a go between.

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.

This behavior is caused by not freeing all allocated memory before exiting the application. Any buffer you allocate using MALLOC or IHEAP_Malloc() must be freed using FREE or IHEAP_Free(). For any instance of a BREW class that you create, you must call the corresponding release function to free that instance.

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.

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.

BREW applets, when executed, are loaded into RAM; any RAM left over can be used for memory allocation, loading resources, creating controls, etc. How much RAM is available depends on the type of phone, and its configuration. On a QCP-3035, for instance, the available RAM is 90K, 30K of which belongs to BREW and other phone related tasks, leaving 60K available for use by an applet. The memory available on each of the phones running BREW is available here.

Another limiting factor for applet size is heap fragmentation. If the largest available memory block is smaller than the size of the applet, then the applet will not be loaded. Use IHEAP_CheckAvail() to determine whether a memory block of sufficient size can be allocated. IHEAP_GetMemStats() can be used to determine the amount of RAM already used. If you have an applet that is too large for a particular device, a work-around is to split the application into multiple applets. Memory Allocation provides more information on how to avoid heap fragmentation.

Note: In order test a low memory condition on the BREW Emulator reduce the heap size in the Device Configuration file by the appropriate amount. BREW's System Info screen reports the amount of available flash memory, not the amount of available RAM.

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.

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().

An app needs to create IHeap interface only when it wants to get current memory usage statistics (IHEAP_GetMemStats()) or check if a memory block of a certain size can be allocated (IHEAP_CheckAvail()).

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.

Since the size of the mod file a is a lot less then the dll that runs in the emulator, the emulator approximates the size of the mod file to be 10% of dll.
To properly run this test, create a separate directory that contains only the MIF of the application under test and have emulator point to this new directory (File->Change MIF Dir).

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.

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().

Can Incoming Sms Messages Be Emulated With The Sdk?

SMS :SMS emulation will be available in version 1.1 of the BREW SDK.

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.

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:

Added a boolean 'madeVoiceCall' in the Applet structure
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;
}

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;

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;

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.

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.

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.

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);

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.

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.

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);
}

With No Tcp/ip Flush Command Available In Brew, How Can I Confirm That A Command Is Sent Right Away?

It is not possible to determine when a TCP/IP command is sent; BREW does not provide this capability.

What Is The Largest Packet Size Supported By Brew?

The maximum packet size is OEM dependant, and may vary from one manufacturer's phone to another. BREW has no control over this limitation.

When Transmitting Large Files, Do We Have To Break The File Up Into Packets Before Sending, Or Does Brew Do This For Me?

You should simply send what you can, and ISOCKET_Write() will tell you how much data was actually sent. If there is data remaining to be sent, simply offset your data pointer by the amount indicated by your last call to ISOCKET_Write().

For Example:
void CommonWriteCB (void *pUser) {
char *psz = NULL;
int cbWrite;
… … …
SampleApp * pMe = (SampleApp*)pUser;
// pszData is the data to be written
psz = pszData;
cbWrite = STRLEN (pszData);
// Loop till all the bytes are written.
while (cbWrite > 0) {
rv = ISOCKET_Write(pMe->m_pISocket, (byte *)psz,
(uint16)cbWrite);
if (rv == AEE_NET_WOULDBLOCK) {
// No byte were written successfully. Register
// callback to try again later.
ISOCKET_Writeable(pMe->m_pISocket,
CommonWriteCB, (void *)pMe);
return;
} else if (rv == AEE_NET_ERROR) {
// Write Error.
ReleaseNetAndSocket(pMe);
return;
}
// In case of parital write, loop and write the rest
cbWrite -= rv;
psz += rv;
}
… … …
}

How Many Sockets Can Be Opened Simultaneously?

This limit is OEM specific, and will vary depending on the device that your applet is running on---it is not set by BREW.

Note: Multiple TCP sockets are not supported on the Kyocera 3035. It allows one TCP socket and one UDP socket at a given time.

Are Network Callbacks Invoked In The Context Of The Main Thread, And If So How Is The Data Integrity Preserved In The Current Context?

All network callbacks occur within the same thread context, at some point in time after the caller returns control to the AEE event loop. If your application is busy doing something, callbacks will be queued, then invoked once your application returns control to the AEE event loop, ensuring data integrity..

Can A Brew-enabled Device Be Used As A Server?

In addition to the obvious memory and performance limitations, it is not possible to listen on a socket connection when a BREW application is running on a phone. These factors make implementing a server on BREW difficult at best.

Is There Any Way To Tell If A Socket Is Already Connected?

There are two ways to determine if a socket is connected. The easiest is to check the return value of ISOCKET_Connect(). When a socket is already connected, ISOCKET_Connect() will return EISCONN.

It is also possible to monitor the state of a socket connection by registering for the socket status change events NE_SO_CLOSING, and NE_SO_CLOSED with INETMGR_OnEvent(). Using this method, your application can avoid trying to connect an already connected socket.

For more information about network and socket events, including NE_SO_CLOSING and NE_SO_CLOSED, please refer to the following include file: AEENet.h

For Example:

// Register to receive Network and Socket events
INETMGR_OnEvent(piNet, (PFNNETMGREVENT)CheckNetStatus,
(void*)pMe, TRUE);
//Callback invoked when Network/Socket event is received
static void CheckNetStatus(void* cxt, NetMgrEvent evt,
uint32 dwData)
{
SampleApp *pMe = (SampleApp*)cxt;
if(evt == NE_SO_CLOSING || evt == NE_SO_CLOSED) {
// flag set to false to indicate socket is disconnected
pMe->m_SocketConnected = FALSE;
ReleaseNetAndSocket(pMe);
}
if(evt == NE_SO_CONNECTED) {
// flag set to true to indicate socket is connected
pMe->m_SocketConnected = TRUE;
}
return;
}

Why Does Isocket_release() Return One When We Are Expecting A Return Value Of Zero?

When an application calls ISOCKET_Release(), the internal state of the ISocket object changes to "closing," and BREW begins waiting for the asynchronous "closed" event. Since the closed event is received in a callback, the reference count of the ISocket object is incremented to prevent it from being released before its internal state changes to closed.

Why Does Ishell_createinstance Return Eclassnotsupport When I Try And Create An Instance Of The Net Manager (aeeclsid_net)?

This is because of the permissions on the MIF file for your applet. Please open your MIF file in the MIF editor and check the checkbox for Network privileges, then save

Can We Have A Listening Tcp Socket?

No. You use UDP, specifically, ISOCKET_Bind and ISOCKET_RecvFrom

Does Brew Support Blocking Sockets?

BREW uses asynchronous sockets. You can use ISOCKET_Readable or ISOCKET_Writeable to be notified when it is safe to read/write.


How Can We Create A Dialog?

Use the BREW Resource Editor to create a dialog. You can also construct the dialog manually by creating data structures in your application to define the contents of the dialog.

Note: If a bmp file is being used, make sure that the bmp format is supported and that the bmp file is a valid full path, all in lowercase.

Once the dialog has been created, it will have a resource ID and a resource file (.bar file). Use ISHELL_CreateDialog() to create the dialog:

ISHELL_CreateDialog(pMe->a.pIShell, SAMPLEAPP_RES_FILE,

RESOURCE_ID, NULL);

// SAMPLEAPP_RES_FILE is the resource file (.bar file) and
// RESOURCE_ID is the resource ID specified in the resource
// editor

Process the following events (return TRUE at the very least) in the app handler function:

case EVT_DIALOG_START:
return TRUE;
case EVT_DIALOG_INIT:
return TRUE;
case EVT_DIALOG_END:
return TRUE;

Call ISHELL_EndDialog when the dialog object is no longer needed. ISHELL_EndDialog(pMe->a.pIShell);

How Can We Create A Scroll Bar If Menu Is Larger Than The Screen Size?

The screen rectangle in which the menu is to be drawn (specified by IMENUCTL_SetRect) must exceed the screen height by at least the height of a single menu item. Otherwise the menu item will be clipped and no scroll bar will appear.

How Cancwe Add Images To The Items In An Imenuctl?

We can use the IMENUCTL_AddItemEx method with CtlAddItem structure.

Can We Remove The Multitap Item From The Softkey Menu Associated With My Text Control?

Yes, We can remove it by following the steps outlined below:

Associate the soft key menu with your text control using ITEXTCTL_SetSoftKey().
Call IMENUCTL_DeleteAll() to delete the Multitap item.
Add items using IMENUCTL_AddItem().
Is It Possible To Get/manipulate The Palette Information Of The Device?

No. The palettes are hard-coded by the vendor and will vary from device to device.

Can We Modify The Display Buffers Directly?

No. There is no way for BREW to access these and the display data is stored as the vendor's proprietary format.

When We Terminate A Data Call By Closing An Open Socket, Why Does The Phone Still Indicate That A Data Call Is In Progress?

After the last connected socket is closed, BREW waits for a certain linger time before terminating the PPP connection. Hence the lingering call-in-progress indication.

The default linger time is 30 seconds. To change the linger time, use INETMGR_SetLinger().

Why Does Connect Callback Not Timeout When Service Is Lost (while Attempting To Connect) Or The Server Does Not Respond?

This is due to a bug in the BREW version 1.0.1 SDK - connect callback is not invoked under the following circumstances:

Service is lost while connect is being attempted
Server does not respond
As a workaround, you should implement a timer in association with the callback. If the connect callback does not occur in 30 seconds, you should timeout the connection.

For example:

// initialize pMe->connectCBInvoked = FALSE;
// Set timer for 30 seconds before invoking ISOCKET_Connect()
ISHELL_SetTimer(pMe->a.m_pIShell, 30000, ConnectTimeout_CB, (void *)pMe);
ISOCKET_Connect(pMe->m_pISocket, nodeINAddr, AEE_htons(USAGE_TEST_PORT),
SampleApp_ConnectCB, pMe);
// Set flag indicating connect CB was called
void SampleApp_ConnectCB(void *cxt, int err) {
SampleApp *pMe = (SampleApp*)cxt;
// Set flag indicating connect CB was called
pMe->connectCbInvoked = TRUE;
if (err) {
DisplayOutput((IApplet*)pMe, 3, "Connect failed!");
return;
}
DisplayOutput((IApplet*)pMe, 3, "Connected!");
}
// When timer expires, check if connect CB was invoked
static void ConnectTimeout_CB(void* cxt) {
SampleApp *pMe = (SampleApp *)cxt;
if(pMe->connectCbInvoked == FALSE) {
// Callback was not invoked within 30seconds - cancel connect callback
ISOCKET_Cancel(pMe->m_pISocket, 0, 0);
DisplayOutput((IApplet*) pMe, 3, "Connection timed out");
}
else {
// Callback invoked. Set flag to default value FALSE
pMe->connectCbInvoked = FALSE;
}
}

Note: Multiple TCP sockets are not supported on the Kyocera 3035. It allows one TCP socket and one UDP socket at a given time.

What Precautions Should We Take When I Invoke Inetmgr_gethostbyname() To Perform Dns Lookup?

You must ensure that your app cancels its pending DNS callback, if any, using CALLBACK_Cancel() in all exit routes. This includes when the app is suspended and when the app is stopped (both via the End key and the Clear key).

For example, if you used the following code to lookup a DNS address:

CALLBACK_Init(&pMe->cbkLookup, GetHostByNameCB, pMe);
INETMGR_GetHostByName(pINetMgr,&pMe->dnsresult, hostName,
&pMe->cbkLookup);
You should use the following code to cancel the callback in all exit routes:
// Check if the callback can be cancelled. If NULL it has
// already happened and cannot be cancelled.
if(pMe->cbkLookup.pfnCancel != NULL) {
CALLBACK_Cancel(&pMe->cbkLookup);
}

The callback cancel code should be incorporated in the Suspend event handler code ( EVT_APP_SUSPEND), the app's FreeAppData function (which is called when the app is stopped, i.e. receives EVT_APP_STOP event), and in the Clear key event handler code (EVT_KEY and keycode AVK_CLR).

Note: Please note that your app will not pass TRUE BREW Testing if it does not properly cancel its pending DNS callback. Some symptoms that might indicate that your app is not canceling its p ending DNS callback are:,/p>

hone crashes upon starting up app
Phone displays "Please Re-insert Battery" error upon starting up app
Both might imply that the previously running app did not cancel its pending DNS callback.

Are There Any Restrictions On What Value We Can Set My Application's Network Linger Time To?
The INETMGR_SetLinger() function is provided to give developers flexibility in designing their application. However, it is not recommended that you alter the OEM's chosen default linger time (usually 30 seconds), unless your application has a compelling reason to do so. Altering the default linger time in either direction may cause your application to fail TRUE BREW Testing, or carrier rejection of your application.

What Image Formats Are Supported In Brew?

BREW supports any BMP file with a color depth up to that which is provided on the device it is running on. BREW does not yet support GIF and JPEG images. For now, you need to convert GIF and JPEG images into BMP images. PNG format and BREW Compressed Image (BCI) format will be supported in BREW SDK version 1.1.

In SDK versions prior to 1.1, the emulator is capable of emulating only 1, 4, and 8 bit color depth BMPs. In version 1.1, the emulator can also display 2 bit color depth BMPs

What Is The Transparent Color On Color And Monochrome Phones?

Magenta is the transparent color for color devices. White is the transparent color on monochrome and 4-level gray-scale devices.

How Can We Move The Cursor To The End Of The Text Input?

The cursor can be moved to the end of the string by continuously invoking ITEXTCTL_HandleEvent() method n times on the string, where n is the length of the string.
For example:

while(len) {
ITEXTCTL_HandleEvent(pMe->m_pIText, EVT_KEY,
AVK_RIGHT, dwParam);
len--;
}

Note: This does not currently work on the Kyocera 3035, unless dwParam is set to 10 (corresponds to AVK_RIGHT). Kyocera is working on fixing this issue such that dwParam will not need to be explicitly set. Setting dwParam = 10 will not have any adverse affect on the Sharp Z-800 handset.

A new API - ITEXTCTL_SetCursorPos(), will be added in BREW SDK version 1.2 to set the Text Control's cursor position.

How Can We Create A Text Control With Horizontal And Vertical Scrollbars?

If the text is larger than the Text Control size, then a vertical or horizontal scrollbar will appear and you can navigate through the text using the directional keys.

Why Do We Get Memory Errors Such As "memheap.c 0696" When Using Idisplay_bitblt() To Draw A Bitmap Image?

Ensure that you are freeing the memory allocated by CONVERTBMP. Check the last Boolean parameter of CONVERTBMP. If True, a reallocation was done and the memory must be freed using SYSFREE.

For example:

pBmp = CONVERTBMP (pDataBytes, &imageInfo, &bVal);
IDISPLAY_BitBlt (pIDisplay, xDest, yDest, cxDest,
cyDest, pBmp, xSrc, ySrc, dwRopCode);
IDISPLAY_Update (pIDisplay);
if(bVal) //free only if realloc was done
SYSFREE (pBmp);

How Can We Suppress The Title Area From Showing On My Istatic?

The title area cannot currently be suppressed in SDK version 1.0. This has been added in BREW version 1.1.

How Can We Determine The Character Limit For The Display Of Application Names On The Phone?

Different phones have different display characteristics, so there is no unique answer to this question. You can determine whether your application name will fit on the phone's display by comparing the width of the application name to the width of the display.

Use IDISPLAY_MeasureText() to determine the pixel width of your application name string. Use ISHELL_GetDeviceInfo() to determine the pixel width of the screen

Does Brew Support Animation?

BREW SDK version 1.0 includes support for animated BMP. This is done by placing the frames side-by-side and specifying the width of each frame with IIMAGE_SetParm with the IPARM-CXFRAME flag. Please see the IIMAGE example in the Examples directory

BREW SDK Version 1.1 has added support for BREW Compressed Image (BCI) animation. A BCI file contains one or more compressed small graphic image(s), each with a specified duration in milliseconds. The duration represents how long you want each image to be shown before it is replaced by the next image in the series. You can use the BCI Authoring Tool included in BREW SDK Version 1.1 to create your BCI file. Please refer to 'Using the BREW Compressed Image Authoring Tool' document included in the SDK for more information.

How Can We Control Animation By Time?

One way to do this is to use the IImage interface and set the rate of animation (IImage_SetParm).

An example in which the animation rate is set to 750ms is shown below:

IIMAGE_SetParm(pMe->m_pIImage, IPARM_RATE, 750, 0);

You can also use a timer to trigger the image display function. Use ISHELL_SetTimer() to set a timer:

ISHELL_SetTimer(pMe->a.m_pIShell, TIMER_RATE, (PFNNOTIFY)(ManipulateBitmap), pMe);

After TIMER_RATE ms expires, ManipulateBitmap function will be triggered, within which you can manipulate your image.

What Is The Difference Between Multi-tap And T9 Text Entry Modes For Text Input?

In Multi-tap mode, a key must be tapped several times in order to specify a letter. For example, to specify the letter 'r', tap the number '7' three times. In T9 mode, a key is tapped only once per letter. T9 Text Input determines the most commonly used word matching the input numeric sequence. If more than once word matches the sequence, the most common word is selected, with the ability to scroll to the next most commonly used word.

The default text entry mode is Multi-tap. T9 text entry mode is not supported on the emulator.

How Can We Draw A Line In A Specific Color?

IDISPLAY_DrawHLine() and IDISPLAY_DrawVLine() always draw lines in black. Therefore setting CLR_USER_LINE to the desired color and then invoking IDISPLAY_DrawHLine() or IDISPLAY_DrawVLine() will not work.

The definitions of these two IDISPLAY macros are below. To draw a line in a color other than black, use the code contained in the macro definition and change to the desired fill color.

#define IDISPLAY_DrawHLine(p,x,y,len)
{AEERect rc;SETAEERECT(&rc,(x),(y),(len),1); IDISPLAY_FillRect((p),&rc,
RGB_BLACK);}
#define IDISPLAY_DrawVLine(p,x,y,len)
{AEERect rc;SETAEERECT(&rc,(x),(y),1,(len)); IDISPLAY_FillRect((p),&rc,
RGB_BLACK);}

Subscribe to get more Posts :