关注国内外最新的Web应用程序

2008年2月2日星期六

Introduction to BREW - a mobile handset application development platform

From xiangxiangouhongyuan的专栏

Introduction

As we know, Mobile phones are a wonderful means for communicating with our dear ones in addition to helping us to maintain our contact lists, to do lists etc. As time passed with additional features on these devices piling they made way for Smartphones which in addition to providing phone functionality also provided the functionality of a Personal Digital Assistant (PDA). A Smartphone also allows new applications to be installed on it. To manage these ever increasing list of functionalities, a Smartphone needs a operating system. Currently there are various smartphone operating systems in the market like Symbian, Microsoft Windows Mobile, Palm OS etc. BREW comes in this category.

As a technology hobbyist, I have been exploring BREW for sometime. As such I found resources in the web. But being a impatient reader and lacking in telecom domain knowledge, I found it difficult to understand some aspects of BREW. I also couldn't get the full picture of how BREW works. As a result, I have to look at various sources from which I got a full picture. In this article, I'm just sharing all the information I accumulated to get a full picture of how BREW works. First I will give a overall introduction of BREW and after that I will concentrate on giving introduction to developmental aspects of it.
Objective

At the end of the article you will know
What is a application development platform ?
How does BREW fit in to the role as a application development platform for Mobile Handsets?
What makes BREW different from other handset platforms like Windows Smartphone, Symbian etc?
What are the merits and demerits of using BREW to develop applications for Mobile Handsets?
What are the various phases of BREW application development life cycle?
What type of applications can be developed in BREW platform?
What are the basic components of a BREW application and how does it work?
How to setup a development environment to start developing applications for BREW platform?
What are the steps to develop a basic 'Hello World' application in BREW?
Where can I get more information about BREW platform?
Target Audience
People interested in Mobile handset application development
Background

The term Platform is used to describe a hardware or software configuration of a computer. In case of hardware configuration we used the term to depicit the processor architecture of the computer. Examples being Intel x86 platform, PowerPC platform etc. In case of software configurations, we use the term 'platform' to depicit the operating system the computer is running. Examples being windows platform, Macintosh platform etc. Operating systems sit on top of the machine hardware. So they must be ported for different hardware platforms which they want to support.

An Application Development Platform or Framework is basically a collection of tools and libraries which enable developers to develop application targetting a hardware of software platform. Some of the well known application development platforms like Java, .NET framework target and get ported on various software platforms or operating systems. BREW is a application development platform or framework which targets and get ported on various hardware platforms. In short unlike Java or .NET framework which sits on top of operating systems, BREW sits on top of hardware layer of the device.
BREW Overview
stands for Binary Runtime Environment for Wireless. As the term 'Binary Runtime' suggests, BREW runs on top of hardware platform and can be ported to different hardware platforms.
Product of QUALCOMM Internet Services (QIS, a division of Qualcomm Wireless & Internet (QWI) group of QUALCOMM
Currently supported on all QUALCOMM handset hardware but like other application development platforms, can be ported to non-QUALCOMM Handsets
Can co-exist in a handset with any other mobile operating system
Size wise, is about 150k much smaller than most of other handset operating systems available in the market
To the telecom domain guys, it is said to be air interface independent ie it can run on CDMA or GSM/GPRS or UMTS handsets. But again currently it is running only on CDMA handsets
Enables native application development in C,C++. Applications can also be developed in Java using a Java Virtual Machine (JVM) developed for BREW platform. Recently, IBM has come up with a Java Virtual Machine for BREW
Handset manufacturers can integrate BREW into their device by using the BREW Porting kit provided by QUALCOMM
BREW Application Development Cycle
Software developers can develop applications in C/C++ using the freely downloadable BREW SDK
The SDK comes with a application called BREW Emulator (known as BREW Simulator from version 3.0). This application simulates the look and behavior of a BREW handset device and can be used to test and debug BREW applications during development process.
Applications to be executed on BREW Emulator are compiled to native code of the operating system on which the Emulator is running and linked with a compatible x86 BREW runtime library. For instance, if BREW SDK is installed in a windows machine, BREW applications to be executed on BREW Emulator are compiled to windows native code and linked with a x86 compatible BREW runtime library
After the application has been tested thoroughtly with Emulator, it has to be compiled and link into ARM binary form to run in BREW handset. For that QUALCOMM provides a GNU Cross compiler which can be freely downloaded and RealView Compilation Tools for BREW which is available for a fee
Unlike other mobile handset platforms, BREW applications cannot be directly tested on BREW handsets. QUALCOMM has implemented this feature for reasons of security as BREW gives complete control over handset's hardware
Before testing the applications, they should be digitally signed. QUALCOMM provides tools for generating digital signatures only to content providers and Authenticated BREW Developers
After digitally signing the applications, they can be uploaded to a BREW handset using a USB or serial cable using a tool called AppLoader. The AppLoader tool is part of the BREW Testing and Commercialization Utilities provided by QUALCOMM which are available only to BREW Authenticated Developers
Once the application has been thoroughly internally tested, it must be submitted to QUALCOMM for TRUE BREW Testing. Again True BREW Testing is available only for BREW Authenticated developers
After the application passes True BREW testing, it may be offered to Mobile Network operators supporting BREW handsets from which it can be download by subscribers to their handsets
Merits of BREW Platform
Since BREW runs directly on top of hardware layer, application execution is fast when compared to other application frameworks like Java Mobile Edition.
BREW API is consistent across supported handsets than other application frameworks like Java Mobile Edition API
Since BREW from version 2.0 allows direct access to screen buffer, developers have lot of control while creating Graphics intensive applications like Games
Handset manufacturers can add new features and fix bugs over-the-air to already deployed BREW handsets by using BREW extensions. BREW extensions are additional code modules written by OEMs and third party software vendors to include additional functionalities in the handsets. Some Examples for BREW extensions are Java Virtual Machine, Game engines etc.
DeMerits of BREW Platform
Unlike other handset platforms, applications cannot be directly tested on BREW handsets
Only BREW Authenticated Developers can test and deploy applications in handsets. Becoming a BREW Authenticated Developer involves a set of procedures which is not freely available for individuals
Testing and debugging of BREW applications difficult and cumbersome due to differences in emulation and actual hardware environments
BREW Application Development Concepts

BREW application environment supports a event driven architecture similar to Microsoft Windows, Macintosh and other opeating systems. There are two types of applications which can be created on BREW. One is Applet and the other is Extension. An Applet is a GUI application having a user interface and reusable code encapsulated in one or more classes if any. An extension is a reusable code module written by OEMs and third party software vendors to include additional functionalities in the handsets. Some examples for extensions are Java Virtual Machine, Game engines etc.Extensions can be loaded or unloaded on needed basis.

Each BREW application is represented by a single Module object and one or more applets and classes. Each Applet or Class must have a unique 32 bit identifier known as a Class ID. Dummy Class IDs can be used during development process. Unique Class IDs have to be inserted before the application is tested in the BREW handset. QUALCOMM provides a Web based tool called BREW ClassID Generator which allows developers to generate unique Class IDs. Note that this tool is only available to BREW Authenticated Developers.

Each BREW application is associated with a corresponding Module Information File (MIF)which is required to ship along with it. The Module Information File contains vital information about a BREW application like
Supported classes
Supported applets
Applet details like title, icon etc
Class IDs for each of application's applets and classes
Classes exported for use by other applications
The Module Information file for application can be generated using BREW MIF Editor tool which comes with SDK. Language and device specific data for BREW applications can be stored in resource files making localization possible. The application resource files and its corresponding headers can be generated using BREW Resource Editor tool which comes with SDK.

BREW SDK overview

BREW SDK is can be downloaded for free from QUALCOMM site. QUALCOMM has provided detailed instructions on the steps to install the SDK on the pdf document Starting with BREW. The user guide document which comes with the SDK also gives detailed information on the same in addition to many other useful details.

The SDK provides a appwizard addin for Microsoft Visual Studio 6.0 which generates skeletal code for a BREW application making it easy to get started with application development. This addin is available from BREW SDK 1.1 version onwards. Again step by step instructions on using the appwizard to develop a BREW application has been given in the SDK user guide as well as in the pdf document Starting with BREW.

Other development environments like Visual Studio.NET and Visual Studio 2005 can be used to create BREW applications. But developers have manually link the SDK headers and libraries to compile the application code. Again detailed instructions documents are provided by QUALCOMM on this aspects. The SDK also includes a rich set of example application which are very helpful for developers to learn various aspects of BREW development.
Writing our first BREW application

Again lots of documentation in this aspect has been already provided by QUALCOMM. Some of them are as follows:
Creating BREW application from scratch
Starting with BREW
Creating BREW applications using Visual Studio.NET
Creating BREW applications with Visual Studio 2005

Conclusion

I thought it would be better for stop this article with these information. I hope by reading this article you guys would have got a general picture of how BREW works and a eagerness to explore it further. On the contrary some of you would also be feeling sleepy or lost or angry or hungry or blank by now. Can't rule out that also. I have also felt like that after reading other's articles :) To those people, I would request them to send their feedback on suggestions to improve this article.
Resources
How smartphone works
How cell phone works
How telephone works
Application Specific Integrated Circuits
BREW knowledge base
Writing BREW extensions
BREW application development step by step guide
Ten Developer commandments of BREW
History
published on 28/07/2006
updated on 31/07/2006 - some typing mistakes
updated on 14/08/2006 - adding objectives and target audience sections and some more links

Technorati 标签:

没有评论:

标签分类