57
URI Launcher for Manufacturers

Acrobat Document

Embed Size (px)

Citation preview

Page 1: Acrobat Document

URI Launcher for Manufacturers

Page 2: Acrobat Document

QUALCOMM Incorporated5775 Morehouse Drive

San Diego, CA. 92121-1714U.S.A

.

This documentation was written for use with Brew Mobile Platform, software version 1.0. This document and the Brew MobilePlatform software described in it are copyrighted, with all rights reserved. This document and the Brew Mobile Platform softwaremay not be copied, except as otherwise provided in your software license or as expressly permitted in writing by QUALCOMMIncorporated.

Copyright© 2010 QUALCOMM IncorporatedAll Rights Reserved

Not to be used, copied, reproduced in whole or in part, nor its contents revealed in any manner to others without the express writtenpermission of Qualcomm.

This technical data may be subject to U.S. and international export, re-export or transfer ("export") laws. Diversion contrary to U.S.and international law is strictly prohibited.

The BREW MP logo and MSM are trademarks of QUALCOMM Incorporated.Brew is a registered trademark of QUALCOMMIncorporated.

QUALCOMM is a registered trademark of QUALCOMM Incorporated in the United States and may be registered in other countries.Other product and brand names may be trademarks or registered trademarks of their respective owners.

Sample Code Disclaimer:This QUALCOMM Sample Code Disclaimer applies to the sample code of QUALCOMM Incorporated (“QUALCOMM”) to which itis attached or in which it is integrated (“Sample Code”). Qualcomm is a trademark of, and may not be used without express writtenpermission of, QUALCOMM.

Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, QUALCOMM provides the Sample Code on an"as is" basis, without warranties or conditions of any kind, either express or implied, including, without limitation, any warranties orconditions of title, non-infringement, merchantability, or fitness for a particular purpose. You are solely responsible for determiningthe appropriateness of using the Sample Code and assume any risks associated therewith. PLEASE BE ADVISED THATQUALCOMM WILL NOT SUPPORT THE SAMPLE CODE OR TROUBLESHOOT ANY ISSUES THAT MAY ARISE WITH IT.

Limitation of Liability. In no event shall QUALCOMM be liable for any direct, indirect, incidental, special, exemplary, or consequentialdamages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or businessinterruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence orotherwise) arising in any way out of the use of the Sample Code even if advised of the possibility of such damage.

HT80-VT500-118 Rev. BApril 23, 2010

Page 3: Acrobat Document

URI Launcher for Manufacturers

i

ContentsURI Launcher for Manufacturers.........................................................................................2

Solution Analysis.................................................................................................................. 3Solution description.................................................................................................. 3URI commands...........................................................................................................5

URI command table.............................................................................................. 6Sample URI command........................................................................................ 27

URI Launcher application....................................................................................... 27INative Launcher API...............................................................................................28Returning data back to Brew MP applications.................................................... 29

contacts:SelectContacts...................................................................................... 30calendar:View...................................................................................................... 31docviewer:IsFileTypeSupported...........................................................................31

Error handling.........................................................................................................32Device pack changes.............................................................................................. 34System impact ....................................................................................................... 34Side effect ............................................................................................................... 35Affected versions.....................................................................................................35Affected files............................................................................................................ 35Steps for reproducing the problem....................................................................... 35

Solution Implementation.................................................................................................... 36URI Launcher Application implementation.......................................................... 36

File: LauncherApp.h............................................................................................ 36File: LauncherApp.c.............................................................................................36

INativeLauncher implementation............................................................................49File: AEENativeLauncher.h..................................................................................49File: OEMNativeLauncher.c.................................................................................50

Document Viewer Application implementation.....................................................54File: VZWDocViewerError.h.................................................................................54

Solution verification............................................................................................... 55

Page 4: Acrobat Document

URI Launcher for Manufacturers

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 2

URI Launcher for Manufacturers

Unique Resource Identifier (URI) Launcher provides a mechanism by which a Brew® MP applicationcommunicates with a native application (either OEM native or Brew MP) via URI-formatted messages.Based on the message contents, the application may take various actions, such as just processing themessage without launching itself or starting up in the foreground.

A typical usage for the URI Launcher mechanism is to communicate between a Brew MP application andan OEM native application; however, a Brew MP application can also use it to communicate with anyanother Brew MP application. It relies on MIME-type registration for the URI scheme name to determinethe destination application.

This may allow Brew MP applications to leverage and use existing functionalities from OEM nativeapplications if OEMs provide a path via the URI Launcher implementation. This document provides adetailed description of the URI Launcher architecture, example URI schemes, and guidelines on howOEMs can implement this feature.

This may allow Brew MP applications to leverage and use existing functionalities from OEM nativeapplications if OEMs provide a path via the URI Launcher implementation. This document provides adetailed description of the URI Launcher architecture, example URI schemes, and how applications canuse this feature.

For OEMs, guidelines on how to implement this feature are also included.

Keywords

URI Launcher, OEM Native Application, URI Scheme, URI Launcher Application, INativeLauncher API

Page 5: Acrobat Document

URI Launcher for Manufacturers Solution description

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 3

Solution Analysis

This section contains the solution analysis for URI Launcher.• Solution description on page 3• URI commands on page 5• URI Launcher application on page 27• INative Launcher API on page 28• Returning data back to Brew MP applications on page 29• Error handling on page 32• Device pack changes on page 34• System impact on page 34• Side effect on page 35• Affected versions on page 35• Affected files on page 35• Steps for reproducing the problem on page 35

Solution description

The URI Launcher architecture relies on unique URI scheme names being sent to Brew MP, which isreferred to as URI commands in this document. Brew MP applications send native OEM applications(which can be either Brew MP or OEM native) URI commands that need to be handled. Handling of suchURI commands can range from simply launching the OEM native applications in a certain state (e.g.,the address book in the top/initial screen or the new entry screen) to just processing certain commandswithout launching any native application.

The following shows the URI Launcher architecture:

Page 6: Acrobat Document

URI Launcher for Manufacturers Solution description

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 4

URI Launcher architecture

As the figure shows, Brew MP applications send URI commands through ISHELL_PostURL(). Thesecommands are received by the URI Launcher Application, which parses and delivers commands to theappropriate native OEM application through the INativeLauncher API. The API ISHELL_PostEventEx()with the event EVT_APP_POST_URL is used to return any data that is expected for the URI command.Each of these components is further described in detail in the following sections.

Note: In the case of OEM native applications written in Brew MP, the native applications can alternativelyhandle the URI command directly, thus bypassing the URI Launcher Application. The following shows thevarious alternative methods for launching the Brew MP native OEM application:

Page 7: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 5

URI commandsThis section describes the available URI commands. The URI command table on page 6 includesURI commands and examples of the commands, where appropriate.

Note: The URI command table on page 6 uses the following conventions:

• Square brackets imply optional arguments.• An asterisk implies one or more repetitions of the contents in the curly braces following the asterisk.

URI commands typically consist of the following structure:

scheme “:” hier-part [ “?” <param1> = <value1> *{ & <paramN> = <valueN> } ]

• scheme: Typically refers to the native OEM application to be launched (defined in the URIcommand table on page 6); for example, scheme might be set to textmsg for the textmessaging client or contacts for the Address Book application.

• hier-part: Typically refers to the state in which the native application should be launched. Thelist of possible states depend on the scheme part of the URI command and are defined in the URIcommand table on page 6. For example, the textmsg scheme (native application) might havethe hier-part (state) set to Inbox, Sent, Drafts, Compose, or Reply.

• param: Refers to any additional parameters that can be sent with a URI command. Depending onthe URI command, some of the parameters may be mandatory or optional. As shown in the URIstructure above, param appears in the URI command after the ? symbol and multiple params areseparated by the & symbol. For example, the textmsg:Compose URI command might be sent withthe param number or email to specify the recipient for the text message.

Note: The name of the param may be appended with a numeral. For example, the param numbermay be sent as number1, number2, etc. Developers are especially required to append a numeralwhen multiple parameters of the same type can be sent with a URI command. For example, thenumber param of the URI command textmsg:Compose is typically appended with a numeral todistinguish between the different numbers when sending a text message to multiple recipients. Theappended number is incremented for every additional parameter of the same type. An example URIcommand with numerals attached to params is provided in Sample URI command on page 27.

Note: The sender and uid parameters are two unique parameters that may be optionallysent by the developer with any URI command (except for the URI commands such ascontacts:SelectContact , docviewer:IsFileTypeSupported, or vkeypad:Show, where these

Page 8: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 6

parameters are mandatory). If these parameters are provided in any URI command, then the OEMis required to send a response back to the Brew MP application. The response should contain thestatus of the URI operation. These parameters are further discussed in Error handling on page32.

• value: Refers to the specific payload associated with a specific param. The range of possible valuesthat can be specified, depend on the param itself. For example, the param number only takes digits,whereas the param email takes an email-formatted string as payload.

For additional information on the URI structure, refer to RFC 3986 (http://tools.ietf.org/html/rfc3986).

Before sending a URI, the Brew MP application encodes the URI according to RFC 3986 (http://tools.ietf.org/html/rfc3986). This will be done using the Brew MP API IWEBUTIL_UrlEncode(). Refer to theC/C++ API Reference for additional information regarding this API.

In particular, note that the entire URI is not encoded. Only the payload (value) passed in the URI isencoded. For example, the URI command:

contacts:Search?Criteria=John Doe

will be encoded to

contacts:Search?Criteria=John+Doe

and not

contacts%3ASearch%3FCriteria%3DJohn+Doe

URI command table

URI Description

Section: CONTACTS

contacts:List Launch the CONTACT LIST screen.

Note: Image is a sample UI, and the actual UImay differ.

contacts:Add?<parameter>

where

<parameter> ::=

number=<numeric string> |

Launch the SAVE screen which allows the userof the handset to either create a new contactor append an existing contact. Exactly oneparameter: either the parameter number or theparameter email will be required.

Page 9: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 7

email=<string>

Note: Image is a sample UI, and the actual UImay differ.

For example:

contacts:Add?email=John.Doe%40qualcomm.com

This decodes to:

contacts:[email protected]

Typical response codes to this URI includeAddrBook Error Codes from AEEError.h andAEEAddrBook.h such as AEE_ADDR_FULL,AEE_ADDR_EBADSTATE, etc.

contacts:AddRecord[?*{ fid1=<AEEAddrFieldID>&data1=<data>} ]

Launch the ADD CONTACT screen whichallows the user to add a new contact to theaddress book. The URI command takes optionalparameters where <fid> refers to the BrewMP AddrBook field ID AEEAddrFieldID and<data> refers to the specific value corresponding<fid> . If any parameters are specified, thesefields should be automatically populated in theADD CONTACT screen. If no parameters arespecified, then the ADD CONTACT screencontains empty fields:

Page 10: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 8

Note: Image is a sample UI, and the actual UImay differ.

For example:

contacts:AddRecord?fid1=22&data1=8581112222&fid2=15&data2=John.Doe%40qualcomm.com

This decodes to:

contacts:AddRecord?fid1=22&data1=8581112222&fid2=15&[email protected]

Typical response codes to this URIinclude AddrBook Error Codes fromAEEError.h and AEEAddrBook.h suchas AEE_ADDR_INVALID_FIELD_ID,AEE_ADDR_INVALID_FIELD_VALUE, etc.

contacts:EditRecord? rid=<Record ID> [ &*{ fid1=<AEEAddrFieldID>&data1=<data> } ]

Launch the EDIT CONTACT screen for thecontact specified by <rid> , where <rid>refers to the Record ID obtained by theBrew MP API IADDRREC_GetRecID().Any optional parameters are specified byfid1=<fid1>&data1=<data1> as described inthe URI command contacts:AddRecord. Ifparameters are specified, the user is taken to theEDIT CONTACT screen with the fields for thatcontact modified as specified by the parametersand its values. If no parameters are specified,the user is simply taken to the EDIT CONTACTscreen for that particular contact.

Note: Image is a sample UI, and the actual UImay differ.

For example:

contacts:EditRecord?rid=21&fid1=5&data1=John+Doe&fid2=22&data2=8581112222

Typical response codes to this URIinclude AddrBook Error Codes fromAEEError.h and AEEAddrBook.h,

Page 11: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 9

such as AEE_ADDR_INVALID_REC,AEE_ADDR_INVALID_FIELD_ID, orAEE_ADDR_INVALID_FIELD_VALUE.

contacts:Search?criteria=<string> Search the contacts lists with the provided searchstring. This URI displays the search results tothe user from within the native OEM application.If the UI consists of only the Quick Searchfeature, then the first contact that matches thesearch criteria in the address book should beselected. For example, if the developer searchesfor the criteria TE, the following screen may bedisplayed:

Note: Image is a sample UI, and the actual UImay differ.

For example:

contacts:Search?Criteria=John+Doe

contacts:SelectContacts?sender=<ClassID>&uid=<string>

This URI launches the native address book andallows the user to select contacts from a list of allthe contacts in the address book. The selectedlist of contacts is then available to the BrewMP application using the protocol described inReturning data back to Brew MP applications onpage 29.

For example:

contacts:SelectContacts?Sender=2719855983&uid=gsc1

where 2719855983 is the ClassID of the BrewMP application calling the URI and gsc1 is arandom string chosen to uniquely identify this URIcommand invocation.

Section: MESSAGING

messaging:Top Launch the MESSAGING menu on the handset.

Page 12: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 10

Note: Image is a sample UI, and the actual UImay differ.

messaging:SendNew Launch the NEW MSG screen on the handset.

Note: Image is a sample UI, and the actual UImay differ.

Section: TEXT MESSAGE

textmsg:Inbox Launch the INBOX screen of the nativemessaging application.

textmsg:Sent Launch the SENT messages screen of the nativemessaging application.

textmsg:Drafts Launch the DRAFTS screen of the nativemessaging application.

textmsg:Compose[? *{ <parameters> } ]

where

parameters ::=

number1=<numeric string> |

email1=<string> |

group1=<category name> |

list1 = <string>

rid1=<Record ID>&fid1=<AEEAddrFieldID> |

bodyfreetext=<string> |

Launch the CREATE TXT MESSAGE screento compose a new text message. The URIcommand takes zero or more parameters forthe To field. The parameters can be a phonenumber, an email address, a distribution list,a list of contact names comma-delimited, ora specific entry from the Address Book (forexample, the Office phone number of thecontact corresponding to Record ID). If noparameters are specified then the To fieldshould be left blank. The group1 parametercan only be a category name so the OEMscan search all contact records pertaining to the

Page 13: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 11

bodyhyperlink=<string> |

bodyphonenumber=<string> |

attach1=<fs path>

category using the pim_IRecordStore_SearchAPI to fill the To field. In addition, one ormore content(s), such as iCalendar files (seeRFC 2445 at http://www.tools.ietf.org/html/rfc2445) or vCard files (see RFC2426 - http://www.ietf.org/rfc/rfc2426.txt), can also be sent asa parameter specified by attach1 where <fs path>corresponds to the Brew MP file system path forthe attachment(s).

The URI command also takes one of the bodyparameters for the Content field.

The bodyfreetext parameter can be any textwithin the size limit of the receiving application.

For example:

textmsg:Compose?bodyfreetext=This+is+the+text+copied+from+the+browser

The bodyhyperlink parameter can be special textthat has a URL associated with it. This can beeither a hyperlink text, page URL, or an emailaddress. Text associated with the URL and theURL address each starts from a new line whenthey are sent.

For example:

textmsg:Compose?bodyhyperlink=Verizon+Wireless%5Cnhttp%3A%2F%2Fverizonwireless.com%2F&sender=17206875&uid=1

This decodes to:

textmsg:Compose?bodyhyperlink=Verizon Wireless\nhttp://verizonwireless.com/

Verizon Wireless is the text associated with theURL and http://verizonwireless.com/ is the URLaddress.

Another example:

textmsg:Compose?bodyhyperlink=Email%5Cnmailto%3Avzserivce%40verizonwireless.com&sender=17206875&uid=1

This decodes to:

textmsg:Compose?bodyhyperlink=Email\nmailto:[email protected]

Email is the text associated with the URL [email protected] is the emailaddress.

Page 14: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 12

The bodyphonenumber parameter can be specialtext that has a phone number.

For example:

textmsg:Compose?bodyphonenumber=908-555-1212

The following is a typical usage for this URIcommand with a list1 parameter:

Browsing the web and reading the sentence"Let's join together!! Would you call John, Tim,Paul?" If the user drags and selects "John, Tim,Paul," for example, and now wants to send atext message to those contacts, the applicationdevelopers can use the following URI :

textmsg:Compose?list1=John,Tim,Paul

This decodes to:

textmsg:Compose?list1=John%2CTim%2CPaul&sender=17206875&uid=gsc1

Note: Image is a sample UI and the actual UImay differ.For example:

textmsg:Compose?number1=8581112222&rid1=21&fid1=17&rid2=25&fid2=22

Example message to a distribution list:

textmsg:Compose?group1=5

Typical response codes to this URIinclude AddrBook Error Codes fromAEEError.h and AEEAddrBook.h

Page 15: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 13

such as AEE_ADDR_INVALID_REC ,AEE_ADDR_INVALID_FIELD_ID ,AEE_ADDR_INVALID_FIELD_VALUE , etc.

textmsg:Reply? *{ <parameters> }

where

parameters ::=

number1=<numeric string> |

email1=<string> |

group1=<category name> |

list1 = <string> |

rid1=<RecordID>&fid1=<AEEAddrFieldID>

Launch the REPLY - TXT MSG screen withthe To field prefilled. Specifying at least oneparameter is mandatory.

Note: Image is a sample UI, and the actual UImay differ.

For example:

textmsg:Reply?rid1=21&fid1=17

Typical response codes to this URIinclude AddrBook Error Codes fromAEEError.h and AEEAddrBook.hsuch as AEE_ADDR_INVALID_REC ,AEE_ADDR_INVALID_FIELD_ID ,AEE_ADDR_INVALID_FIELD_VALUE , etc.

Section: PICTURE MESSAGE

picturemsg:Compose[? *{ <parameters> } ]

where

parameters ::=

number1=<numeric string> |

email1=<string> |

group1=<category name> |

list1 = <string>

rid1=<Record ID>&fid1=<AEEAddrFieldID> |

bodyfreetext=<string> |

bodyhyperlink=<string> |

bodyphonenumber=<string> |

attach1=<fs path>

Launch the CREATE PIC MSG screen tocompose a new picture message. The URIcommand takes zero or more parameters forthe To field. The parameters can be a phonenumber, an email address, a distribution list,a list of contact names comma-delimited, ora specific entry from the Address Book (forexample; the Office phone number of thecontact corresponding to Record ID). If noparameters are specified then all fields shouldbe left blank. The group1 parameter can onlybe a category name that the OEMs can searchall contact records pertaining to the categoryusing pim_IRecordStore_Search API to fillthe To field. In addition, one or more mediacontent(s), such as picture files, iCalendar files(see RFC 2445 at http://www.tools.ietf.org/html/rfc2445), or vCard files (see RFC2426 - http://

Page 16: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 14

www.ietf.org/rfc/rfc2426.txt), can also be sent asa parameter specified by attach where <fs path>corresponds to the Brew MP file system path forthe attachment(s). If the OEM supports only oneattachment, then only the first attachment in theURI command will be used.

The URI command also takes one of the bodyparameters for the Content field.

The bodyfreetext parameter can be any textwithin the size limit of the receiving application.

For example:

picturemsg:Compose?bodyfreetext=This+is+the+text+copied+from+the+browser

The bodyhyperlink parameter can be special textthat has a URL associated with it. This can beeither a hyperlink text, page URL, or an emailaddress. Text associated with the URL and theURL address each starts from a new line whenthey are sent.

For example:

picturemsg:Compose?bodyhyperlink=Verizon+Wireless%5Cnhttp%3A%2F%2Fverizonwireless.com%2F&sender=17206875&uid=1

This decodes to:

picturemsg:Compose?bodyhyperlink=VerizonWireless\nhttp://verizonwireless.com/

Verizon Wireless is the text associated with theURL and http://verizonwireless.com/ is the URLaddress.

Another example:

picturemsg:Compose?bodyhyperlink=Email%5Cnmailto%3Avzserivce%40verizonwireless.com&sender=17206875&uid=1

This decodes to:

picturemsg:Compose?bodyhyperlink=Email\nmailto:[email protected]

Email is the text associated with the URL [email protected] is the emailaddress.

The bodyphonenumber parameter can be specialtext that has a phone number.

For example:

Page 17: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 15

picturemsg:Compose?bodyphonenumber=908-555-1212

A typical usage for this URI command is the list1parameter.

Browsing web and reading the sentence "Let'sjoin together!! Would you call John, Tim, Paul?"The user drags and selects some words that"John, Tim, Paul" now want to send a picturemessage can throw the following URI:

picturemsg:Compose?list1=John,Tim,Paul

This decodes to:

picturemsg:Compose?list1=John%2CTim%2CPaul&sender=17206875&uid=gsc1

Note: Image is a sample UI, and the actual UImay differ.

For example:

picturemsg:Compose?number1=858111222&attach1=fs%3A%2F%7A0x0102382c%2Fsample.jpg&attach2=fs%3A%2F%7A0x0102382c%2Ftest.bmp

This decodes to:

picturemsg:Compose?number1=8581112222&attach1=fs:/~0x0102382c/sample.jpg&attach2=fs:/~0x0102382c/test.bmp

where sample.jpg and test.bmp reside in theAEEFS_MCF_PICTURE_DIR directory.

Typical response codes to this URIinclude AddrBook Error Codes fromAEEError.h and AEEAddrBook.hsuch as AEE_ADDR_INVALID_REC,AEE_ADDR_INVALID_FIELD_ID,AEE_ADDR_INVALID_FIELD_VALUE,etc as well as File Error Codes such asEBADFILENAME

Page 18: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 16

Section: VIDEO MESSAGE

videomsg:Compose[? *{ <parameters> } ]

where

parameters ::=

number1=<numeric string> |

email1=<string> |

group1=<category name> |

list1 = <string> |

rid1=<Record ID>&fid1=<AEEAddrField> |

bodyfreetext=<string> |

bodyhyperlink=<string> |

bodyphonenumber=<string> |

attach1=<fs path>

Launch the CREATE VIDEO MSG screento compose a new text message. The URIcommand takes zero or more parameters forthe To field in the image below. The parameterscan be a phone number, an email address, adistribution list, a list of contact names comma-delimited, or a specific entry from the AddressBook (for example; the Office phone numberof the contact corresponding to Record ID).The group1 parameter can only be a categoryname that the OEMs can search all contactrecords pertaining to the category usingpim_IRecordStore_Search API to fill the To field.If no parameters are specified then all fieldsshould be left blank. In addition, one or moremedia content(s) such as video files, iCalendarfiles (see RFC 2445 at http://www.tools.ietf.org/html/rfc2445), vCard files (see RFC2426 - http://www.ietf.org/rfc/rfc2426.txt) can also be sent asa parameter specified by attach where <fs path>corresponds to the Brew MP file system path forthe attachments. If the OEM supports only oneattachment, then only the first attachment in theURI command will be used.

The URI command also takes one of the bodyparameters for the Content field.

The bodyfreetext parameter can be any textwithin the size limit of the receiving application.

For example:

videomsg:Compose?bodyfreetext=This+is+the+text+copied+from+the+browser

The bodyhyperlink parameter can be specialtext that has a URL associated with it. This caneither be a hyperlink text, page URL, or an emailaddress. Text associated with the URL and theURL address each starts from a new line whenthey are sent.

For example:

videomsg:Compose?bodyhyperlink=Verizon+Wireless%5Cnhttp%3A%2F%2Fverizonwireless.com%2F&sender=17206875&uid=1

This decodes to:

videomsg:Compose?bodyhyperlink=VerizonWireless\nhttp://verizonwireless.com/

Page 19: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 17

where Verizon Wireless is the text associatedwith the URL and http://verizonwireless.com/ isthe URL address.

Another example:

videomsg:Compose?bodyhyperlink=Email%5Cnmailto%3Avzserivce%40verizonwireless.com&sender=17206875&uid=1

This decodes to:

videomsg:Compose?bodyhyperlink=Email\nmailto:[email protected]

where Email is the text associated with the URLand [email protected] is the emailaddress.

The bodyphonenumber parameter can be specialtext that has a phone number.

For example:

videomsg:Compose?bodyphonenumber=908-555-1212

A typical usage for this URI command is the list1parameter:

Browsing the web and reading the sentence"Let's join together!! Would you call John, Tim,Paul?" If the user drags and selects "John, Tim,Paul," for example, and now wants to send atext message to those contacts, the applicationdevelopers can use the following URI :

videomsg:Compose?list1=John,Tim,Paul

This decodes to:

videomsg:Compose?list1=John%2CTim%2CPaul&sender=17206875&uid=gsc1

Note: Image is a sample UI, and the actual UImay differ.

Page 20: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 18

For example:

videomsg:Compose?number1=8581112222&attach1=fs%3A%2F%7A0x0102382E%2Fsample.mpg

This decodes to:

videomsg:Compose?number1=8581112222&attach1=fs:/~0x0102382E/sample.mpg

where sample.mpg resides in theAEEFS_MCF_MOVIE_DIR directory.

Typical response codes to this URIinclude AddrBook Error Codes fromAEEError.h and AEEAddrbook.hsuch as AEE_ADDR_INVALID_REC ,AEE_ADDR_INVALID_FIELD_ID ,AEE_ADDR_INVALID_FIELD_VALUE ,etc., as well as File Error Codes such asEBADFILENAME

Section: VOICEMAIL

voicemsg:Inbox Launch Voicemail.

vmstats:Received?

normal=<uint32>&urgent=<uint32>&timestamp=<uint32>

This URI is sent by any application (either nativeor a dynamic Brew MP upgrade) to convey thenumber of new unread voicemail messages.

The parameters:• normal - corresponds to the number of

unread voicemail messages with normalpriority.

• urgent - corresponds to the number ofunread voicemail messages with urgentpriority.

• timestamp - corresponds to the timeat which the URI was sent. This valuewill be populated by the sender of theURI command using the Brew MP APIGETTIMESECONDS(). If needed, the OEMcan construct the date and time at whichthe URI was sent, using the Brew MP APIGETJULIANDATE().

For more information on these APIs, refer tothe C/C++ API Reference. A typical usage forthis URI command is to notify the idle screen orthe menu from where voicemail is launched, ofnew voicemails. In response to this notification,the idle screen or the menu may be updated toindicate arrival of new voicemails.

For example:

Page 21: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 19

vmstats:Received?normal=0&urgent=1&timestamp=891706613

In addition, if there are no new unread normalor urgent voicemails, these parameters shouldcorrespondingly be set to '0' as shown in theexample above.

Section: IM

im:Top Launch the Instant Messaging application.

Section: CALL HISTORY

callhist:Received Launch the Call History Received Calls screen.

callhist:Sent Launch the Call History Dialed Calls screen.

callhist:Missed Launch the Call History Missed Calls screen.

callhist:All Launch the Call History All Calls screen.

Section: EMAIL

email:Top Launch native Email application.

email:Compose[?To1=<string> |

bodyfreetext=<string> |

bodyhyperlink=<string> |

bodyphonenumber=<string> |

attach1=<fs path>]

Launch email compose screen. The screenhas the To field prefilled. In addition, one ormore media content(s) such as picture, videofiles, iCalendar files (see RFC 2445 at http://www.tools.ietf.org/html/rfc2445), vCard files (seeRFC2426 - http://www.ietf.org/rfc/rfc2426.txt) canalso be sent as a parameter specified by attach1,where <fs path> corresponds to the Brew MPfile system path for the attachments. If the OEMsupports only one attachment, then only the firstattachment in the URI command is used.

For example:

email:Compose?To1=John%2EDoe%40qualcomm%2Ecom

Typical response codes to this URI includeBasic Error Codes from AEEError.h such asEINVALIDFORMAT , etc.

The URI command also takes one of the bodyparameters for the Content field.

The bodyfreetext parameter can be any textwithin the size limit of the receiving application.

For example:

email:Compose?bodyfreetext=This+is+the+text+copied+from+the+browser

The bodyhyperlink parameter can be specialtext that has a URL associated with it. This caneither be a hyperlink text, page URL, or an emailaddress. Text associated with the URL and the

Page 22: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 20

URL address each starts from a new line whenthey are sent.

For example:

email:Compose?bodyhyperlink=Verizon+Wireless%5Cnhttp%3A%2F%2Fverizonwireless.com%2F&sender=17206875&uid=1

This decodes to:

email:Compose?bodyhyperlink=VerizonWireless\nhttp://verizonwireless.com/

where Verizon Wireless is the text associatedwith the URL and http://verizonwireless.com/ isthe URL address.

Another example:

email:Compose?bodyhyperlink=Email%5Cnmailto%3Avzserivce%40verizonwireless.com&sender=17206875&uid=1

This decodes to:

email:Compose?bodyhyperlink=Email\nmailto:[email protected]

where Email is the text associated with the URLand [email protected] is the emailaddress.

The bodyphonenumber parameter can be specialtext that has phone number.

For example:

email:Compose?bodyphonenumber=908-555-1212

Section: TOOLS

calculator:Top Launch calculator.

calendar:Top Launch calendar.

calendar:View?path=<fs path>&source=<string> This URI launches the native calendar applicationand allows the user to view a iCalendar file(see RFC 2445 at http://www.tools.ietf.org/html/rfc2445). The action performed by the user(such as Accept/Decline/Tentative/Cancel) arethen sent to the Brew MP application using theprotocol described in Returning data back toBrew MP applications on page 29.

Note: While sender and uid parameters areoptional, if they are not provided, then the BrewMP application will not be notified by the user inthe native calendar application.

Page 23: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 21

For example:

calendar:View?path=fs%3A%2Fshared%2Fevent%2Eics&source=John%2EDoe%40qualcomm%2Ecom&sender=2719855983&uid=gsc2

where path is the file location for the calendarobject, source is the recipient to whom thiscalendar object was sent, 2719855983 is theClassID of the Brew MP application calling theURI, and gsc2 is a random string chosen touniquely identify this URI command invocation.

alarmclock:Top Launch alarm clock.

Section: SETTINGS

mastervolume:Top Launch volume control settings.

Section: DOCUMENT VIEWER

docviewer:Top This URI command is used to launch the nativedocument viewer for files including media typessupported by the device (such as JPEG andMP3) and Microsoft Office documents (such asDOC, XLS, and PPT) .

This URI launches the OEM native DocumentViewer application (Document Viewerapplication) to list all the available files under themy_document folder on the RMC for operationvia the user interface to the user.

Note: While sender and uid parameters areoptional, if they are not provided, then the BrewMP application will not be notified by the OEM onaction taken by the Document Viewer application.

For example:

docviewer:Top?sender=2719855983&uid=gsc1

where 2719855983 is the ClassID of the BrewMP application calling the URI and gsc1 is arandom string chosen to uniquely identify this URIcommand invocation.

The Document Viewer application will includeFile: VZWDocViewerError.h on page 54and support the granularity of error detection.Similarly, Brew MP application developers alsoshould include the header file and handle thesespecific responses (with a <status_code>)to determine the failures. These OEM nativeapplication-defined errors are further discussed inError handling on page 32.

A typical response code to this URI includesVZWDV_NOMEDIA which is defined in

Page 24: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 22

VZWDocViewerError.h and error codes fromAEEError.h.

docviewer:IsFileTypeSupported?fileext=<string> This URI is sent by an application (either nativeor a dynamic Brew MP upgrade) to check withthe Document Viewer application supports thisfile type.

A typical usage for this URI command is that themobile email has received an indication fromthe server that there is a DOC attachment withan email, and the mobile email application willcall this new command to check with the nativedocument viewer to see if DOC is supported. Ifsupported, it will provide an option for the enduser to click on an icon to view this. If DOC is notsupported, it will not provide the option to clickon this icon, rather just display that there is anattachment with this email.

Another typical usage for this URI commandis that any application can query whether theattachment file type is supported. If supported,the file is highlighted with the View optionenabled to view the file in the Document Viewerapplication. Even if the attachment file is notsupported by the platform, the file needs tobe highlighted so that the user can save thedocument although it is not supported by theplatform and grey out the View option.

This URI command is typically handled in thebackground and no suspend/resume events areexpected.

Whether the file type is supported or not isthen sent to the Brew MP application using theprotocol described in Returning data back toBrew MP applications on page 29.

For example:

docviewer:IsFileTypeSupported?fileext=DOC&sender=2719855983&uid=gsc1

where 2719855983 is the ClassID of the BrewMP application calling the URI and gsc1 is arandom string chosen to uniquely identify this URIcommand invocation.

docviewer:View?path=<fs path> This URI launches the Document Viewerapplication to present the content of the filespecified in the <fs path>. This native applicationenables users to conveniently browse MicrosoftOffice (such as Word, Excel or PowerPoint) andPDF documents stored on the external memorysupported on the device.

Page 25: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 23

Supported file formats are DOC, DOCX, PPT,PPTX, XLS, XLSX, and PDF.

Note: While sender and uid parameters areoptional, if they are not provided, then the BrewMP application will not be notified by the OEM onaction taken by the Document Viewer application.

For example:

docviewer:View?path=fs%3A%2Fcard0%2Froot%2Fsynched%2Fdocuments%2Fsample.docx&sender=2719855983&uid=gsc1

This decodes to:

docviewer:View?path=fs:/card0/root/synched/documents/sample.docx&sender=2719855983&uid=gsc1

where a sample DOCX resides in the ExternalMemory Card Content Directory supported fordocuments, 2719855983 is the ClassID of theBrew MP application calling the URI, and gsc1 isa random string chosen to uniquely identify thisURI command invocation.

The Document Viewer application will includeFile: VZWDocViewerError.h on page 54and support the granularity of error detection.Similarly, Brew MP application developers alsoshould include the header file and handle thesespecific responses (with a <status_code>)to determine the failures. These OEM nativeapplication-defined errors are further discussed inError handling on page 32.

A typical response code to this URI includesthe following that are defined in File:VZWDocViewerError.h on page 54, or adecimal valued string defined in AEError.h:

• VZWDV_FILENOEXISTS• VZWDV_FILEUNSUPPORTED• VZWDV_FILEVERSIONNOTSUPPORT• VZWDV_BADFILENAME• VZWDV_FILE_CORRUPT• VZWDV_FILE_TOOSMALL• VZWDV_FILE_TOOBIG• VZWDV_NOTOWNER• VZWDV_UNABLETOLOAD• VZWDV_UNKNOWN

Section: BROWSER

browser:Top This URI launches the native HTML browserapplication to the URL value as set in theHomepage parameter.

Page 26: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 24

browser:View?URL=<string> This URI launches the native HTML browser andnavigates to the specified URL string.

Note: While sender and uid parameters areoptional, if they are not provided, then the BrewMP application will not be notified by the OEMon action taken by the native HTML browserapplication.

For example:

browser:View?URL=http%3A%2F%2Fwww.verizonwireless.com%2Fb2c%2Fvzwfly.html&sender=17206875&uid=gsc1

This decodes to:

browser:View?URL=http://www.verizonwireless.com/b2c/vzwfly.html&sender=17206875&uid=gsc1

where URL is the path of the content supportedby the native HTML browser, 17206875 is theClassID of the Brew MP application calling theURI, and gsc1 is a random string chosen touniquely identify this URI command invocation.

Also, 2719855983 is the ClassID of the BrewMP application calling the URI and gsc1 is arandom string chosen to uniquely identify this URIcommand invocation.

Note: Both HTTP and HTTPS schemas aresupported.

In addition, HTML objects or any other contentssupported by the browser can also be sent as aparameter specified by the URL where <string>corresponds to the Brew MP file system path.

For example:

browser:View?URL=fs%3A%2Fcard0%2Froot%2Fsynched%2Fdocuments%2Fsample.html&sender=2719855983&uid=gsc1

Typical response codes to this URI include weberrors from AEEError.h such as:

• WEB_ERROR_PROTOCOL• WEB_ERROR_BADURL• WEB_ERROR_BADHOSTNAME• WEB_ERROR_UNSUPSCHEME• WEB_ERROR_ADDRUNKNOWN• WEB_ERROR_CONNECT

Wapbrowser:View?URL=<string> This URI launches the Native WAP Browser andnavigates to the specified URL string.

Page 27: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 25

The URI Launcher Application will register thisMIME type only when the device supports twodifferent browser applications. In which case, anapplication developer can decide whether to usethe normal browser URI or WAP browser URI.

For example, if OEMs support an HTML Browserand a WAP Browser, the application developerwho needs to throw a WAP URL can querythe support for this wapbrowser scheme usingISHELL_GetHandler API before throwing theURL String.

If OEMs support a single browser to handledifferent web URL strings, the URI LauncherApplication will not register for this WAP browserMIME type. In this case, application developerswill use the browser URI.

Note: While sender and uid parameters areoptional, if they are not provided, then the BrewMP application will not be notified by the OEMon action taken by the native WAP browserapplication.

For example:

Wapbrowser:View?URL=http%3A%2F%2Fwww.verizonwireless.com%2Fb2c%2Fvzwfly.html&sender=17206875&uid=gsc1

This decodes to:

Wapbrowser:View?URL=http://www.verizonwireless.com/b2c/vzwfly.html&sender=17206875&uid=gsc1

where URL is the path of the content supportedby the WAP browser, 17206875 is the ClassIDof the Brew MP application calling the URI, andgsc1 is a random string chosen to uniquelyidentify this URI command invocation.

Also, 2719855983 is the ClassID of the BrewMP application calling the URI and gsc1 is arandom string chosen to uniquely identify this URIcommand invocation.

Note: Both HTTP and HTTPS schemas aresupported.

In addition, HTML objects or any other contentsupported by the WAP browser can also besent as a parameter specified by the URL where<string> corresponds to the Brew MP file systempath.

For example:

Page 28: Acrobat Document

URI Launcher for Manufacturers URI commands

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 26

Wapbrowser:View?URL=fs%3A%2Fcard0%2Froot%2Fsynched%2Fdocuments%2Fsample.html&sender=2719855983&uid=gsc1

Typical response codes to this URI include weberrors from AEEError.h such as:

• WEB_ERROR_PROTOCOL• WEB_ERROR_BADURL• WEB_ERROR_BADHOSTNAME• WEB_ERROR_UNSUPSCHEME• WEB_ERROR_ADDRUNKNOWN• WEB_ERROR_CONNECT

Section: VOICECOMPOSER

voicecomposer:Top Launch Native Voice Composer application.

Section: VIRTUAL KEYPAD

vkeypad:Show[? *{ <parameters> } ]

where

parameters ::=

sender=<numeric string> |

uid=<string> |

prefill=<string> |

style=<keypad_style>

This URI command is used to launch the virtualkeypad application on the device to allow textinput without a physical keypad. The parameters:

sender - the classid of the application that islaunching the virtual keypad (in decimal

uid - an identifier string which has some meaningto the launching application. May indicate, forexample, which text box should receive the text.

prefill (optional) - text which should be pre-filled in the virtual keypad text field when itlaunches. This text will be UTF-16 convertedto the URL encoding specified in RFC 3986.The IWebUtil_UrlDecode() API may be used todecode the string back to standard UTF-16.

style (optional) - determines the display styleof the virtual keypad (default is "qwerty"). Thefollowing styles should be supported:

• qwerty: landscape mode traditionalQWERTY keypad

• dialer: portrait mode 0-9 dialpad• predictive: portrait mode predictive text

entry keypad• multitap: portrait mode multitap keypad• password: hidden character keypad

Section: Notepad

notepad:Compose [?bodyfreetext=<string> |

bodyhyperlink=<string> |

attach1 = <fs path>

This URI launches the Native notepad applicationto compose a new text. The URI Command takeszero or more parameters for the content field. Inaddition, one or more text based objects such astext files, iCalendar files (see RFC 2445 at http://www.tools.ietf.org/html/rfc2445), vCard files (seeRFC2426 - http://www.ietf.org/rfc/rfc2426.txt) canalso be sent as a parameter specified by attach1

Page 29: Acrobat Document

URI Launcher for Manufacturers URI Launcher application

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 27

where <fs path> corresponds to the Brew MP filesystem path for the attachments.

The URI command takes the bodyfreetextparameters for the Content field.

The bodyfreetext parameter can be any textwithin the size limit of the receiving application.

For example:

notepad:Compose?bodyfreetext=This+is+the+text+copied+from+the+browser

The bodyhyperlink parameter can be specialtext that has a URL associated with it. This caneither be a hyperlink text, page URL or a emailaddress. Text associated with the URL and theURL address shall each starts from a new linewhen they are sent.

For example:

notepad:Compose?bodyhyperlink=Verizon+Wireless%5Cnhttp%3A%2F%2Fverizonwireless.com%2F&sender=17206875&uid=1

This decodes to:

notepad:Compose?bodyhyperlink=VerizonWireless\nhttp://verizonwireless.com/

where Verizon Wireless is the text associatedwith the URL and http://verizonwireless.com/ isthe URL address.

Sample URI command

A typical invocation of a URI command might be as follows:

"textmsg:Compose? number1=8581112222&number2=8581113333&rid1=12&fid1=15"

The URI command above, consists of the scheme (native application) textmsg, the hier-part (state)Compose and three parameters. The parameters consist of two phone numbers and one contact from theaddress book where the address book contact is identified by rid(Record Id) and the address book field byfid (here 15 corresponds to AEE_ADDRFIELD_EMAIL). These are explored further in the URI commandtable on page 6. Also note that there is no restriction on the parameters specified. Therefore, all threeparameters could, in fact, refer to the same contact (i.e., the first two numbers could possibly belong tothe same contact referred by rid).

URI Launcher applicationThis section assumes that the reader is familiar with creating static applications.

The URI Launcher Application is a static application that registers itself as the handler for each of theURI commands defined in the URI command table on page 6. It receives URI commands via the

Page 30: Acrobat Document

URI Launcher for Manufacturers INative Launcher API

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 28

AEEEvent EVT_APP_POST_URL within its HandleEvent() method. These URI commands are parsedand the appropriate native OEM application is then launched through the INativeLauncher API.

Parsing the URI commands can be achieved by using the IWEBUTIL_ParseFormFields() API asdemonstrated by the sample code provided in the URI Launcher Application implementation on page36. It is highly recommended that OEMs parse the URI commands (to extract the scheme and hier-part) in the URI Launcher Application instead of delegating this to the OEM native applications.

The URIs in the URI command table on page 6 are exported as MIME-types within the MIF of theURI Launcher Application. For more information on how to export MIME-types, refer to the Linking MIMEtypes section in the Tools Reference provided in the Brew MP Library. When exporting MIME types, onlythe scheme of the URI command is registered as a MIME type; e.g., to register the following URIs:

textmsg:Inboxtextmsg:Senttextmsg:Draftstextmsg:Composetextmsg:Compose?Number=<phoneNumber>textmsg:Compose?Email=<emailAddress>textmsg:Compose?Name=<name>textmsg:Compose?Name=<name>&Type=<numberType>textmsg:Reply?Number=<number>textmsg:Reply?Email=<email>textmsg:Reply?Name=<name>textmsg:Reply?Name=<name>&Type=<numberType>

The following only needs to be registered in the MIF of the URI Launcher Application:

textmsg

When adding MIME-types, the Base Class should be left as AEECLSID_APP and the Handler Classshould be left as the ClassID of the URI Launcher Application.

A reference implementation of the URI Launcher has been provided in the URI Launcher Applicationimplementation on page 36.

INative Launcher APIThis section assumes that the reader is familiar with integrating native applications with Brew MP. Thesesections discuss how to suspend Brew MP and start native applications and then resume Brew MP afterthe native applications have completed their tasks.

The INativeLauncher API is used by the URI Launcher Application to start native applications. Asdiscussed in Solution description on page 3, the URI Launcher scheme allows native applications tobe started in certain states; for example

textmsg:Compose?Name=John+Doe&Type=Office

is used to start the native SMS application in the following screen:

Page 31: Acrobat Document

URI Launcher for Manufacturers Returning data back to Brew MP applications

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 29

Note: Image is a sample SMS application UI, and the actual SMS application may differ.

This assumes the following:

• The native OEM applications can be launched in different states as specified in the URI commandtable on page 6. For example, the native SMS application can be started in any of the followingstates:

• Inbox• Sent Messages• Drafts• Create• Reply

The example above assumes that the native SMS application can be started directly in the Createstate. All the possible states that a native application (scheme) can take are listed in the URIcommand table on page 6.

• The native OEM applications can accept arguments specified by param1=value1&param2=value2....The example above assumes that the native application can take a contact name (John Doe) and aphone number type (Office) and fill this information in the "To" textbox. All the possible "parameters"are listed in the URI command table on page 6.

Thus, the INATIVELAUNCHER_LaunchNativeApp() API takes the argument appID, which refers to thenative OEM application to launch, state which is the hier-part and pdwArgs which specifies any paramswith values. Additionally, the Brew MP API ISHELL_PostEventEx() can be used to send an event to thenative application (see URI Launcher application on page 27).

Based on the event received, the native application can start itself using ISHELL_StartApplet() asrequired.

A reference implementation of the URI launcher has been provided in theINativeLauncher implementationon page 49.

Returning data back to Brew MP applicationsThis section covers how a native application can return data back to the Brew MP application that issuedthe URI command. Brew MP uses ISHELL_PostEventEx() with the event EVT_APP_POST_URL as ameans to communicate data from the native applications back to the Brew MP applications.

The following are the topics in this section:• contacts:SelectContacts on page 30

Page 32: Acrobat Document

URI Launcher for Manufacturers Returning data back to Brew MP applications

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 30

• calendar:View on page 31• docviewer:IsFileTypeSupported on page 31• vkeypad:Show on page

contacts:SelectContacts

When the URI command "contacts:SelectContacts?sender=<ClassID>&uid=<string>" is issued, Brew MPis suspended and the native Address Book application is launched in the Contacts Selection screen, asdiscussed in INative Launcher API on page 28. The following shows a typical example of a ContactsSelection screen.

Note: Image is a sample Contacts selection screen UI, and the actual UI may differ.Once the user has finished making the selection, the native OEM application should return the list ofselected contacts as a string using the ISHELL_PostEventEx() API with EVT_APP_POST_URL as theevent. The response should contain:

• The uid string populated in the original URI request, followed by the string ":response?", and theresponse payload. See below for constructing a typical response.

• The payload consists of an ampersand-delimited list of the following parameters (refer to Errorhandling on page 32 for more details):

• The status=<status code>, where <status_code> is any decimal valued string defined inAEError.h that corresponds to the result of the URI operation performed. on possible errors.

• The launch=<launch_status>, where <launch_status> is either a 1 or 0 depending on thelaunch error.

• An ampersand-delimited list of "rid=<RecordID>&fid=<FieldID>" entries where RecordIDcorresponds to the Brew MP record ID and FieldID corresponds to the AEEAddrFieldID ofthe selected record. If no contacts are selected, the payload should be left blank. For moreinformation on Brew MP record IDs, refer to the Brew MP API IADDRBOOK_GetRecByID(),and for more information on AEEAddrFieldID refer to the C/C++ API Reference.

For a request with the URI "contacts:SelectContacts?sender=<clsID>&uid=gsc1", a response might beconstructed as follows:

gsc1:response?status=0&launch=1&rid1=5&fid1=22&rid2=8&fid2=22

As represented above, <clsId> is obtained from the sender parameter of the URI command,"gsc1" corresponds to the uid string populated in the URI command, "5" and "8" correspond toAddressBook record IDs for the selected entries, and "22" corresponds to the AEEAddrFieldIDAEE_ADDRFIELD_PHONE_CELL associated with the selected record. The above response can besent from the native OEM application to the calling Brew MP application. If an error is encountered whenparsing the URI command before the native OEM application is invoked then the error status can besent from the URI Launcher Application itself. Refer to Error handling on page 32 and the referenceimplementation for more details:

Page 33: Acrobat Document

URI Launcher for Manufacturers Returning data back to Brew MP applications

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 31

A reference implementation for parsing the contacts:SelectContacts URI command is provided in URILauncher Application implementation on page 36 and INativeLauncher implementation on page 49.

calendar:View

The above approach of using the classID, the uID string, and the Brew MP API ISHELL_PostEventEx canbe generalized to any URI command where data is expected to be returned back to the caller.

The calendar:View command contains the file system path to an iCalendar file that should be displayedwithin the native Calendar application. The user may perform an ACCEPT/DECLINE/TENTATIVE/CANCEL operation when viewing the iCalendar file. This response should be sent back to the Brew MPapplication using the following response URI:

<uid>:response?status=<status>&launch=<launch>&action=<action>

where <action> is one of the following integers:• 0 - User chose "ACCEPT"; OEM must store the event in the calendar database• 1 - User chose "DECLINE"• 2 - User chose "TENTATIVE"; OEM must store the event in the calendar database• 3 - User performed a CANCEL operation (such as hitting the Cancel key to quit); OEM must store

the event in the calendar database (as tentative)Note:

1. The operation performed by the user (ACCEPT/DECLINE/TENTATIVE/CANCEL) should be storedin the calendar object using the PARTSTAT parameter. The source user can be identified throughthe source parameter in the URI command. Refer to RFC 2445 (http://tools.ietf.org/html/rfc2445) formore information on the PARTSTAT parameter. A mapping has been provided for your referencebelow:

User Operation PARTSTAT value

ACCEPT ACCEPTED

DECLINE DECLINED

TENTATIVE TENATIVE

CANCEL NEEDS-ACTION

2. If the user performs the ACCEPT/TENTATIVE or CANCEL operation, the OEM should store thecalendar event in the native calendar database.

3. The sender and uid parameters are optional for this command. If these parameters are notpopulated, no response regarding user action is expected to be sent back.

docviewer:IsFileTypeSupported

docviewer:IsFileTypeSupported URI command contains the extension of the file that needs to be checkedfor whether the Document Viewer application supports this file type.

When the URI command " docviewer:IsFileTypeSupported? fileext=DOC &sender=<clsID>&uid=gsc1" isissued, Document Viewer application should send the response back to the Brew MP application usingthe following response URI:

<uid>:response?status=<status>&launch=<launch>&bsupported=<bsupported>

where < bsupported > is one of the following integers:• 0 - Document Viewer application doesn't support this file type.• 1 - Document Viewer application support this file type.

Page 34: Acrobat Document

URI Launcher for Manufacturers Error handling

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 32

This response is sent using the ISHELL_PostEventEx() API, with the event EVT_APP_POST_URL. Theresponse payload should include the following data:

The uid string populated in the original URI request, followed by the string ":response?" and theresponse payload. The response payload is a UTF-16 string, encoded according to RFC 3986formatting, containing the text entered by the user.

A typical response string might look as follows:

<uid>:response? status=<status>&launch=<launch>&text=%C0%FF%A1%FF%AE%FF%0A%00h%00e%00l%00l%00o%00w%00o%00r%00l%00d%00

The payload of which decodes to:

gsc1:response?status=0&launch=1&text=HelloWorld

Error handlingThis section covers how the OEM should handle erroneous parameters in the URI command. Familiarizeyourself with the contents in URI commands on page 5 through Returning data back to Brew MPapplications on page 29 before proceeding.

As mentioned earlier, the parameters sender and uid are optional parameters that might be populatedwith any URI command. The sender parameter is a base-10 numeric string that corresponds to the classID (AEECLSID) of the application that sent the URI command. The uid parameter corresponds to aunique string constructed by the sender of the URI command to differentiate various invocations of thesame URI command. If these parameters are populated, then the OEM must send a response back to theBrew MP application, containing the success or failure result for the URI operation. If these parametersare not provided then the OEM is not expected to return any response back to the Brew MP applicationthat invoked the URI command. The following describes a typical response:

"uid:response?status=<status_code>&launch=<launch_status>"

where:• uid corresponds to the uid string that was populated with the URI command• <status_code> is any decimal valued string defined in AEError.h or other Brew MP SDK header

files that correspond to the result of the URI operation performed. Further description of these errorcodes are provided below.

<launch_status> is a decimal value, set to either one of the following values:• 1 - If the operation was successful or if it is possible to continue processing the URI command

in spite of errors. For example, it might be possible to continue processing the URI commandcontacts:AddRecord even if there are errors in the parameters specified. In this instance, theOEM can ignore the erroneous parameters and present the user with the "ADD RECORD"screen with the fields pre-populated with any parameters that were successfully parsed. Inaddition, a launch status of 1 is also used for successful launches when there are no errors.

• 0 - If it is not possible to continue processing the URI command at all.Error conditions that arise when parsing URI commands can be broken down into the followingsubgroups:

• Error with the scheme part of the URI command. These result from application coding errorsthat can be avoided by application developers ensuring that the scheme is supported on thehandset before invoking the URI. This is done by the application developer using the Brew MP APIISHELL_GetHandler() before invoking the URI. No OEM error handling is expected for these typesof errors.

• Error with the hier-part of the URI command. These errors can be caught in the URI LauncherApplication when extracting the hier-part from the URI command. If the hier-part is erroneous (i.e.either unsupported or invalid) and the sender and uid parameters have been populated in the URI,

Page 35: Acrobat Document

URI Launcher for Manufacturers Error handling

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 33

then the OEM should send a response (with a <status_code>) of EUNSUPPORTED back to theBrew MP application. An invalid hier-part is any state that is not listed in the URI command table onpage 6 for a particular scheme. Unsupported hier-part corresponds to states that are listed inthe URI command table on page 6 but that will not be supported on the handset. For example,the URI command "contacts:xyz" should result in EUNSUPPORTED since xyz is an invalid hier-partfor the scheme contacts. A reference implementation for parsing the contacts:SelectContacts URIcommand is provided in URI Launcher Application implementation on page 36.

• Errors in the parames section of the URI command. These errors can also be caught in the URILauncher application when parsing the URI command before invoking the corresponding nativeOEM application. These errors are typically common across all URIs and result due to incompleteor invalid parameters in the URI commands. Incomplete parameters result when mandatoryparameters are missing. For example; if the rid parameter is missing in the URI command"contacts:EditRecord". These should result in a response of ENEEDMORE back to the Brew MPapplication. Invalid URI commands correspond to parameter names that are unsupported or invalid(refer to the URI command table on page 6). This should result in a response of EBADPARMback to the Brew MP application.

• Errors in the values specified in the URI command. These errors are typically discovered in theOEM native application. For example, continuing the contacts:EditRecord?rid=<value> exampleabove, if an invalid <value> is set for rid, the OEM can respond AEE_ADDR_INVALID_REC backto the Brew MP application. These error codes will depend upon the granularity of error detectionsupported in the OEM native applications and a minimum response of EFAILED should be sent inthe case of failures where further narrowing of the error condition cannot be done. Typical returncodes have been specified in the URI command table on page 6 for each URI command.Finally, if values are missing in the URI command, then the OEM should send a response ofEINCOMPLETEITEM back to the Brew MP application.OEM native application-defined errors are typically discovered in the OEM native applicationspecific to a particular requirement of the OEM. For example, RMC is required in the device touse the Document Viewer application. Without RMC in the device, for a request with the URI"docviewer:Top?sender=<clsID>&uid=gsc1," a response might be constructed as follows:

gsc1:response?status=VZWDV_NOMEDIA&launch=1

As represented above, <clsId> is obtained from the sender parameter of the URI command, "gsc1"corresponds to the uid string populated in the URI command. VZWDV_NOMEDIA is the DocumentViewer application-defined error response (with a <status_code>) sent back to the Brew MPapplication.

These error codes are defined outside the range of error codes in AEEError.h or other Brew MPSDK header files. These error codes will depend upon the granularity of error detection supportedin the OEM native applications and a minimum response of EFAILED should be sent in the case offailures where further narrowing of the error condition cannot be done. Typical return codes havebeen specified in the URI command table on page 6 for each URI command.

To reiterate, if unexpected or erroneous parameters (or their values) are encountered, the OEM shouldignore these erroneous parameters and their values and continue processing the rest of the URIcommand, whenever possible. If it is possible to launch the native application and a response is expectedto be sent back to the Brew MP application (i.e., sender and uid has been populated in the URI), then<launch_status> should be set to 1, otherwise it should be set to 0.Note: It is highly recommended that OEMs parse the URI commands (to extract the scheme and hier-part) and monitor the error status at this stage of processing in the URI Launcher Application insteadof delegating this to the OEM native applications. As indicated above, for errors in hier-part or paramsportion of the URI command, the error response can be sent from the URI Launcher application. Forother errors encountered after the native OEM application is launched, the native OEM application isresponsible for sending the error response URI to the calling application using the above approach.

Page 36: Acrobat Document

URI Launcher for Manufacturers Device pack changes

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 34

The following table contains a summary of the error conditions and their corresponding status codes.

Condition Status Code

No errors SUCCESS

Generic failures EFAILED

Invalid or unsupported hier-part EUNSUPPORTED

Mandatory parameters missing the URI command ENEEDMORE

Invalid or unsupported parameter names EBADPARM

Missing values for parameters specified in the URIcommand

EINCOMPLETEITEM

Specific errors resulting from the URI command inthe native application

Any error code in AEEError.h or other Brew MPSDK header files. Typical error codes have beenprovided in the URI command table on page 6.

OEM native application-specific errors to aparticular requirement of the OEM

These error codes are defined outside the rangeof error codes in AEEError.h or other Brew MPSDK header files. These error codes depend onthe granularity of error detection supported in theOEM native applications.

Finally, refer to Returning data back to Brew MP applications on page 29 for how responsesare sent back to Brew MP application; in particular, see the Brew MP APIs AEE_GetShell() andISHELL_PostEventEx() discussed in that section. For example, a successful result is as follows:

"<uid>:response?status=0&launch=1"

Device pack changesAppend the following in your device pack DSD file (DevicePack.dsd):

<String Id="9210" Name="IDS_DD_URILAUNCHER_SUPP"> <Text>1</Text> </String>

These modifications will add a new field in the device pack called "URILAUNCHER Services" with supportfor URILauncher set to "Yes". Submit the schema file and the DSD file to Qualcomm when submittingyour device for the Brew MP commercialization process.

System impactWhile implementing the URI Launcher solution, OEMs should take care to minimize system performanceimpact when transitioning from a Brew MP application to a native application. For instance, the time delaybetween sending a URI command and launching a native application should be minimized by optimizingthe code in OEMNativeLauncher.c as much as possible. In certain scenarios, it is recommendedto display a message from the native application if the URI command takes a long time to process.For example, the contacts:Search?Criteria=... URI command requires searching the address bookusing the search criteria provided. For this URI command, the OEM may display a message similar to"Searching…" from within the native application if the search process takes a long time.

Page 37: Acrobat Document

URI Launcher for Manufacturers Side effect

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 35

Side effectAs discussed in INative Launcher API on page 28, native applications may require modificationsto enable them to be started up in different states so that they can accept parameters from Brew MPapplications.

Market impact

There is no market impact from the side effect described in this section.

Solution interdependency

The provided solution carries no implementation interdependency.

Affected versionsThe solution is independent of any hardware version or type (such as MSM™ version or AMSS release)and does not rely on any server component.

The OEM is recommended to comply with the carrier's BREW specifications.

Affected files• LauncherApp.h: Header file for the URI Launcher Application• LauncherApp.c: Implementation of the URI Launcher Application• AEENativeLauncher.h: Header file for the INativeLauncher API• OEMNativeLauncher.c: Implementation of the INativeLauncher API

Steps for reproducing the problemNot applicable

Page 38: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 36

Solution Implementation

This section contains the following topics:• URI Launcher Application implementation on page 36• INativeLauncher implementation on page 49• Solution verification on page 55

URI Launcher Application implementationThis section contains the following reference implementation for the URI Launcher Application.

• File: LauncherApp.h on page 36• File: LauncherApp.c on page 36

File: LauncherApp.h

#ifndef LAUNCHERAPP_H#define LAUNCHERAPP_H/*======================================================FILE: LauncherApp.hSERVICES: URI Launcher App include file.GENERAL DESCRIPTION:This file contians the definitions for URI Launcher appCopyright © 2008 QUALCOMM Incorporated.All Rights Reserved.QUALCOMM Proprietary/GTDR=====================================================*/

#include "LauncherApp.bid"

#endif // LAUNCHERAPP_H

File: LauncherApp.c

/*=========================================================================FILE: LauncherApp.cSERVICES: URI Command handlingDESCRIPTIONThis file implements the URI Launcher application that takes URI commandsfrom Brew MP applications and launches native OEM applications using theINativeLauncher APIPUBLIC CLASSES:N/ACopyright © 2008 QUALCOMM Incorporated.All Rights Reserved.QUALCOMM Proprietary/GTDR===========================================================================*/#include "AEEAppGen.h"#include "AEEShell.h"#include "AEEStdlib.h"#include "AEENativeNotifier.h"#include "AEENativeLauncher.h"#include "AEEWeb.h"#include "AEEConfig.h"#include "LauncherApp.h"

// These definitions correspond to the URI command names and// will be used when parsing URI commands to invoke // appropriate native applications. These definitions will be

Page 39: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 37

// used to identify which mapping function should be called// for each URI ‘scheme’ defined. Add additional// native applications as needed:

#define URL_TEXTMSG "textmsg"#define URL_PICTUREMSG "picturemsg"#define URL_VOICEMSG "voicemsg"#define URL_IM "im"#define URL_CONTACTS "contacts"#define URL_CALLHISTORY "callhist"#define URL_EMAIL "email"#define URL_CALCULATOR "calculator"#define URL_CALENDAR "calendar"#define URL_ALARMCLOCK "alarmclock"#define URL_NOTEPAD "notepad"#define URL_MASTERVOLUME "mastervolume"

// The role of the URI Launcher app is highly customizable.// These definitions correspond to URI command names.// An OEM can check the ‘hier-part’ of the URI send by the Brew MP application // against the definitions below and send an an error response// back to the Brew MP application if it requires a response.// Also the definitions below can be used by an OEM// to directly parse states in the URI Launcher app// instead of delegating it to the Native apps.// Add additional URI commands as needed:

#define URL_CONTACTS_TOP "contacts:List"#define URL_CONTACTS_ADD "contacts:Add"#define URL_CONTACTS_APPEND "contacts:AddRecord"#define URL_CONTACTS_SEARCH "contacts:Search"#define URL_GETSELCONTACTS "contacts:SelectContacts"

#define MAX_URL_LENGTH 256#define MAX_URL_MAP 64

// This URI MIME type is mandatory to be registered by// the URI Launcher App and will be used by Brew MP// applications to figure out the classID of the// URI Launcher App

typedef struct _LauncherURLMap LauncherURLMap;

typedef struct _CLauncherApp CLauncherApp;

typedef int (*PFNURLMAPFN)(CLauncherApp *pme, const LauncherURLMap * urlMap, uint32 dwParam);

typedef struct _LauncherURLMap { // Map URIs to Native App IDs and Handler functions const char* urlName; uint16 appID; PFNURLMAPFN pMapFn;} LauncherURLMap;

typedef struct _CLauncherApp { AEEApplet a; // Applet structure INativeLauncher * m_pInl; // INativeLauncer pointer to launch Native apps char *m_arguments; // Arguments passed to the Native apps thru INativeLauncher boolean m_bResp; // Caller needs a response on the status of the URI command char *m_pRespPayload; // Response sent to the Calling App from URI Launcher app AEECLSID m_cls; // Sender Class ID LauncherURLMap m_URLMap[MAX_URL_MAP]; // A Map of URI commands to function handlers} CLauncherApp;

Page 40: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 38

#ifdef AEE_STATIC // {static int LauncherApp_CreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj);static int LauncherApp_Load(IShell *ps, void * pHelpers, IModule ** pMod);#endif // } AEE_STATIC

static int LauncherApp_InitAppletData(IApplet * pIApplet);static int LauncherApp_FreeAppletData(IApplet * pIApplet);static boolean LauncherApp_HandleEvent(IApplet * pIApplet, AEEEvent eCode, uint16 wParam, uint32 dwParam);static int LauncherApp_ParseURL(CLauncherApp *pme, uint32 dwParam);static void LauncherApp_LaunchNativeApp(CLauncherApp *pme, uint16 wParam, uint16 state, uint32 dwParam);static int LauncherApp_NoParsing(CLauncherApp *pme, const LauncherURLMap * urlMap, uint32 dwParam);static int LauncherApp_ContactsParse(CLauncherApp *pme, const LauncherURLMap * urlMap, uint32 dwParam);static int LauncherApp_HandleContactSelection(CLauncherApp *pme, uint16 state, uint32 dwParam) ;

static const char urlTextMsg[] = { URL_TEXTMSG };static const char urlPictureMsg[] = { URL_PICTUREMSG };static const char urlVoiceMsg[] = { URL_VOICEMSG };static const char urlIM[] = { URL_IM };static const char urlContacts[] = { URL_CONTACTS };static const char urlCallHistory[] = { URL_CALLHISTORY };static const char urlEmail[] = { URL_EMAIL };static const char urlCalculator[] = { URL_CALCULATOR };static const char urlCalendar[] = { URL_CALENDAR };static const char urlAlarmClock[] = { URL_ALARMCLOCK };static const char urlNotepad[] = { URL_NOTEPAD };static const char urlMasterVolume[] = { URL_MASTERVOLUME };

#ifdef AEE_STATIC // {static int LauncherApp_Load(IShell *ps, void * pHelpers, IModule ** pMod){ return(AEEStaticMod_New((int16)(sizeof(AEEMod)),ps,pHelpers,pMod,(PFNMODCREATEINST) LauncherAp p_CreateInstance,(PFNFREEMODDATA)NULL));}static int LauncherApp_CreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)#else // } AEE_STATIC {/*===========================================================================FUNCTION: AEEClsCreateInstance

DESCRIPTIONThis function is invoked while the app is being loaded. All Modules must provide this function. Ensure to retain the same name and parameters for this function.In here, the module must verify the ClassID and then invoke the AEEApplet_New() functionthat has been provided in AEEAppGen.c.

After invoking AEEApplet_New(), this function can do app specific initialization. In thisexample, a generic structure is provided so that app developers need not change app specificinitialization section every time except for a call to InitAppData(). This is done as follows:InitAppData() is called to initialize AppletData instance. It is app developers responsibility to fill-in app data initialization code of InitAppData(). App developeris also responsible to release memory allocated for data contained in AppletData -- this can be done in FreeAppletData().

PROTOTYPE:int AEEAppCreateInstance(AEECLSID clsID, IShell* pIShell, IModule* pIModule,IApplet** ppApplet)

PARAMETERS:clsID: [in]: Specifies the ClassID of the applet which is being loaded

Page 41: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 39

pIShell: [in]: Contains pointer to the IShell interface.

pIModule: pin]: Contains pointer to the IModule interface to the current module to whichthis app belongs

ppApplet: [out]: On return, *ppApplet must point to a valid AEEApplet structure. Allocationof memory for this structure and initializing the base data members is done by AEEApplet_New().

DEPENDENCIESnone

RETURN VALUESUCCESS: If the app needs to be loaded and if AEEApplet_New() invocation was successfulEFAILED: If the app does not need to be loaded or if errors occurred in AEEApplet_New().If this function returns FALSE, the app will not be loaded.

SIDE EFFECTSnone===========================================================================*/int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule * po, void ** ppObj)#endif // } !AEE_STATIC{ int nRet = EFAILED; switch( ClsId ) {case AEECLSID_LAUNCHERAPP: nRet = ENOMEMORY; if (AEEApplet_New(sizeof(CLauncherApp), ClsId, pIShell, po, (IApplet**)ppObj, (AEEHANDLER)LauncherApp_HandleEvent, (PFNFREEAPPDATA)LauncherApp_FreeAppletData) ) { if( (nRet = LauncherApp_InitAppletData((IApplet *)*ppObj)) != AEE_SUCCESS ){ DBGPRINTF("*Launcher* Init Failed: %d", nRet); LauncherApp_FreeAppletData((IApplet *)*ppObj); } nRet = SUCCESS; } break;default: nRet = ECLASSNOTSUPPORT; break; } return nRet;

}#ifndef AEE_STATICextern int xModule_CreateInstance(IModule *module, IShell *shell, AEECLSID idClass, void **pp);int xModule_CreateInstance(IModule *module, IShell *shell, AEECLSID idClass, void **pp){ return AEEClsCreateInstance(idClass, shell, module, pp);}#endif // } !AEE_STATIC

/*===========================================================================FUNCTION: LauncherApp_Init

DESCRIPTIONThis function creates the mapping table to match an incoming URIwith an associated function.

pme->m_URLMap[id].pMapFn = Method to call. LauncherApp_NoParsingis called if the Native application is going to decode the

Page 42: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 40

incomming URI. Alternatively the pasing of the URI can be donehere, so the mapping function can be the parsing method. Thefunction LauncherApp_ContactsParse is provided to demonstratethis.

pme->m_URLMap[id].urlName = URI to map eg:contacts, textmsg

pme->m_URLMap[id].appID = Native application ID

Also this method creates an instance of AEECLSID_NATIVELAUNCHER. PROTOTYPE:static int LauncherApp_Init(CLauncherApp * pme)

PARAMETERS:pIApplet: [in]: IApplet pointer

DEPENDENCIESnone

RETURN VALUESUCCESS: If the creation of AEECLSID_NATIVELAUNCHER was successful.EFAILED: If the creation of AEECLSID_NATIVELAUNCHER was a failure.

SIDE EFFECTSnone===========================================================================*/static int LauncherApp_InitAppletData(IApplet * pIApplet){ CLauncherApp * pme = (CLauncherApp *)pIApplet;

// This creates a table that maps uri command names to // functions within uri launcher app to handle that uri // command. In addition it also maps the native app to // be invoked.

uint32 id = 0;

pme->m_URLMap[id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlTextMsg; pme->m_URLMap[id].appID = NATIVE_APP_TXTMESSAGING;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlPictureMsg; pme->m_URLMap[id].appID = NATIVE_APP_PIXMESSAGING;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlVoiceMsg; pme->m_URLMap[id].appID = NATIVE_APP_VOICEMESSAGING;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlIM; pme->m_URLMap[id].appID = NATIVE_APP_IM;

pme->m_URLMap[++id].pMapFn = LauncherApp_ContactsParse; pme->m_URLMap[id].urlName = urlContacts; pme->m_URLMap[id].appID = NATIVE_APP_PHONEBOOK;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlCallHistory; pme->m_URLMap[id].appID = NATIVE_APP_CALLHISTORY;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlEmail; pme->m_URLMap[id].appID = NATIVE_APP_EMAIL;

Page 43: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 41

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlCalculator; pme->m_URLMap[id].appID = NATIVE_APP_CALCULATOR;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlCalendar; pme->m_URLMap[id].appID = NATIVE_APP_CALENDAR;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlAlarmClock; pme->m_URLMap[id].appID = NATIVE_APP_ALARMCLOCK;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlNotepad; pme->m_URLMap[id].appID = NATIVE_APP_NOTEPAD;

pme->m_URLMap[++id].pMapFn = LauncherApp_NoParsing; pme->m_URLMap[id].urlName = urlMasterVolume; pme->m_URLMap[id].appID = NATIVE_APP_VOLUME;

if (ISHELL_CreateInstance(pme->a.m_pIShell, AEECLSID_NATIVELAUNCHER, (void**)&pme->m_pInl) != AEE_SUCCESS) { return EFAILED; DBGPRINTF("*Launcher* Failed to create instance of AEECLSID_NATIVELAUNCHER"); }

// These parameters will be used if any response is to be sent back to the Brew MP Application pme->m_bResp = FALSE; pme->m_pRespPayload = NULL; pme->m_cls = 0;

return AEE_SUCCESS;}

/*===========================================================================Function: LauncherApp_FreeAppletData()

Description:This function releases the INativeLauncher interface.

Prototype:static void LauncherApp_FreeAppletData(IApplet * pIApplet)

Parameters:IApplet* po: Pointer to the applet structure. This is of the type definedto store applet data. (CLauncherApp*, in this case).

Return Value:None

Comments: None

Side Effects: None==============================================================================*/static void LauncherApp_FreeAppletData(IApplet * pIApplet){ CLauncherApp * pme = (CLauncherApp *)pIApplet; if (pme->m_pInl) { INATIVELAUNCHER_Release(pme->m_pInl); pme->m_pInl = NULL; }

//Free the error response string FREEIF(m_pRespPayload);

Page 44: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 42

}

/*===========================================================================

FUNCTION LauncherApp_HandleEvent

DESCRIPTIONThis is the EventHandler for this app. All events to this app are handled in thisfunction. All APPs must supply an Event Handler.

PROTOTYPE:static boolean LauncherApp_HandleEvent(IApplet * pIApplet, AEEEvent eCode, uint16 wParam,uint32 dwParam)

PARAMETERS:pi: Pointer to the AEEApplet structure. This structure contains information specificto this applet. It was initialized during the AppClsCreateInstance() function.

ecode: Specifies the Event sent to this applet

wParam, dwParam: Event specific data.

DEPENDENCIESnone

RETURN VALUETRUE: If the app has processed the eventFALSE: If the app did not process the event

SIDE EFFECTSnone===========================================================================*/static boolean LauncherApp_HandleEvent(IApplet * pIApplet, AEEEvent eCode, uint16 wParam, uint32 dwParam){ CLauncherApp * pme = (CLauncherApp *)pIApplet; boolean bRet = FALSE; int nErr = 0; switch( eCode ){

// This is the starting point for all incoming URI commandscase EVT_APP_POST_URL: nErr = LauncherApp_ParseURL(pme, dwParam); // Check if the calling application needs a response with the status.. if (pme->m_bResp) { // Send the status response back to the sender with CLSID as-in pme->m_cls ISHELL_PostEventEx(pme->a.m_pIShell,0, pme->m_cls, EVT_APP_POST_URL, 0, (uint32)pme->m_pRespPayload); } bRet = TRUE; break; }

return bRet;}

// This method is invoked from EVT_APP_POST_URL to parse the URI commands to call the // corresponding function mapped in InitAppData()/*===========================================================================

FUNCTION LauncherApp_ParseURL

DESCRIPTIONThis method is invoked from EVT_APP_POST_URL to parse the URI commands to call the corresponding function mapped in initappdata..

Page 45: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 43

PROTOTYPE:static int LauncherApp_ParseURL(CLauncherApp *pme, uint32 dwParam)

PARAMETERS:pme [in]: Pointer to CLauncherApp dwParam [in]: dwParam passed from handleevent method. This will contain the URI passedfrom the application eg: "contacts:add"

DEPENDENCIESnone

RETURN VALUEPlease refer to section 2.6 in the OEM Note for possible return values

SIDE EFFECTSnone===========================================================================*/static int LauncherApp_ParseURL(CLauncherApp *pme, uint32 dwParam){ const LauncherURLMap * pplm = NULL; int nErr = SUCCESS; DBGPRINTF("**LAUNCHER APP** URL:%s", (char *)dwParam); // Check if the URI is defined for (pplm = pme->m_URLMap; NULL != pplm->urlName; pplm++) { if (STRISTR((char *)dwParam, pplm->urlName)) { //Now that the URI passed from the native application is valid, call the mapping//function that was defined. It is recommended that a parsing method like the //LauncherApp_ContactsParse( ) be defined for each URI to validate the 'hier' part of the URI//in the launcher application itself. If there is some syntax error in the hier part//an EUNSUPPORTED will be returned by the parsing method. Additionally based on your//implementation, you may parse out the paraemters and its values (such as being done in the//LauncherApp_HandleContactSelection). If errors results in parsing out the parameters then//other Brew MP error codes such as ENEEDMORE, EBADPARM and EINCOMPLETEITEM may be sent. nErr = pplm->pMapFn(pme, pplm, dwParam); break; } } // The parsing method may return an error such as EUNSUPPORTED amongst others listed in the // summary of the error conditions table in the document. If the Brew MP application has // requested for a error response, then we populate the error status. If the OEM decides // to do the URI 'hier' validation in the NATIVE application, then it is the responsibility // of that application to return the error response to the Brew MP application that // requests for it. if (SUCCESS != nErr) { if (STRISTR((char *)dwParam, "sender")) && STRISTR((char *)dwParam, "uid")) { IWebUtil *piwu = NULL; char *pszDecodedStr; int nInLen, nOutLen; WebFormField wff[3]; char *pszArgs = (char *)dwParam; nErr = ISHELL_CreateInstance(pme->a.m_pIShell, AEECLSID_WEBUTIL, (void **)&piwu); if (SUCCESS != nErr) { nErr = EFAILED; break; } MEMSET(wff, 0, sizeof(wff));

Page 46: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 44

if (IWEBUTIL_ParseFormFields(piwu, &pszArgs, wff, 3, 0)) { for (int i=0; i<3; i++) { if (!(STRICMP(wff[i].pcName,"sender"))) { // Extract the Class ID of the Sender nInLen = STRLEN(wff[i].pcValue); // Get the length of the decoded URL String IWEBUTIL_UrlDecode(piwu, wff[i].pcValue, &nInLen, NULL, &nOutLen); pszDecodedStr = (char *) MALLOC(nOutLen + 1); if (pszDecodedStr) { IWEBUTIL_UrlDecode(piwu, wff[i].pcValue, &nInLen, pszDecodedStr, &nOutLen); } //Convert the classid into a string pme->m_cls = (AEECLSID) ATOI(pszDecodedStr); FREE(pszDecodedStr); } if (!(STRICMP(wff[i].pcName,"uid"))) { // Extract the UID to construct the response payload nInLen = STRLEN(wff[i].pcValue); IWEBUTIL_UrlDecode(piwu, wff[i].pcValue, &nInLen, NULL, &nOutLen); pszDecodedStr = (char *) MALLOC(nOutLen + 1); if (pszDecodedStr) { IWEBUTIL_UrlDecode(piwu, wff[i].pcValue, &nInLen, pszDecodedStr, &nOutLen); } pme->m_pRespPayload = STRDUP(pszDecodedStr); FREE(pszDecodedStr); //REALLOC memory for the ':response?' & status= (void)REALLOC(pme->m_pRespPayload, STRLEN(pme->m_pResPayload) + 18); STRCAT(me->m_pRespPayload, ":response?status="); //Convert nErr to a buffer nOutLen = (int) SPRINTF(NULL,"%d",nErr); pszDecodedStr = (char *) MALLOC(nOutLen + 1); SNPRINTF(pszDecodedStr, sizeof(pszDecodedStr), "%d", nErr); //REALLOC memory to create the response //string uid:response?status=<nErr>" (void)REALLOC(pme->m_pRespPayload, STRLEN(pme->m_pResPayload) + nOutLen + 1 ); STRCAT(me->m_pRespPayload, pszDecodedStr); FREE(pszDecodedStr); //REALLOC memory for the "&launch=0" as the parsing fails here and //there is no point in launching the native app (void)REALLOC(pme->m_pRespPayload, STRLEN(pme->m_pRespPayload) + 10); STRCAT(me->m_pRespPayload, "&launch=0"); } } } IWEBUTIL_Release(piwu); pme->m_bResp = TRUE; } } return nErr;}

Page 47: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 45

/*===========================================================================

FUNCTION LauncherApp_LaunchNativeApp

DESCRIPTIONThis method calls the INativeLauncher interface method to launch the native application

PROTOTYPE:static int LauncherApp_LaunchNativeApp(CLauncherApp *pme, uint16 wParam, uint16 state, uint32 dwParam)

PARAMETERS:pme [in]: Pointer to CLauncherAppwParam [in] : wParam passed from handleevent methodstate [in] : State in which to launch the native application, if the application understandsstates. If the native application does not handle states, this can be NULL.dwParam [in]: dwParam passed from handleevent method. This will contain the URI passedfrom the application eg: contacts:add

DEPENDENCIESnone

RETURN VALUEError code from AEEError.h

SIDE EFFECTSnone===========================================================================*/static int LauncherApp_LaunchNativeApp(CLauncherApp *pme, uint16 wParam, uint16 state, uint32 dwParam){ // Launch the native applet if (pme->m_pInl) { return INATIVELAUNCHER_LaunchNativeApp(pme->m_pInl, wParam, state, (uint32 *)dwParam); } }

/*===========================================================================

FUNCTION LauncherApp_NoParsing

DESCRIPTIONThis method passes the parameters AS-IS to the native application. the native app is responsible to decode the state, options and corresponding payloads from the uri command

PROTOTYPE:static int LauncherApp_NoParsing(CLauncherApp *pme, const LauncherURLMap * urlMap, uint32dwParam)

PARAMETERS:pme [in]: Pointer to CLauncherAppLauncherURLMap [in] : The function map created in the InitAppletData() method dwParam [in]: This will contain the URI passedfrom the application eg: contacts:add

DEPENDENCIESnone

SIDE EFFECTSnone===========================================================================*//*Pass the parameter AS-IS to the native application. the native app is responsible to decode the state, options and corresponding payloads from the uri command*/

Page 48: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 46

static int LauncherApp_NoParsing(CLauncherApp *pme, const LauncherURLMap * urlMap, uint32 dwParam){ // Note that NULL is being passed as the state below. // In this case, the state from the URI command will be passed in dwParam, along with any // other options and payloads to the native app return LauncherApp_LaunchNativeApp(pme, urlMap->appID, NULL, dwParam); }

/*===========================================================================

FUNCTION LauncherApp_ContactsParse

DESCRIPTIONThis method demonstrates how OEM can write logic to parse the URI and launch thenative application in the required state instead of calling the NoParsing method.Also the ‘hier’ part of the URI is evaluated here and the EUNSUPPORTED error is returned if the URI syntax is wrong. It is recommneded to do this check here insteadof delegating the native application to do this check.The method below shows how the following URI's are handledcontacts:Listcontacts:Addcontacts:Add?<parameter>contacts:EditRecord?rid=<rid>contacts:Search?Criteria=<searchString>contacts:SelectContacts?sender=<ClassID>&uid=<string>

PROTOTYPE:static int LauncherApp_ContactsParse(CLauncherApp *pme, const LauncherURLMap * urlMap, uint32dwParam)

PARAMETERS:pme [in]: Pointer to CLauncherAppLauncherURLMap [in] : The function map created in the InitAppletData() method dwParam [in]: This will contain the URI passedfrom the application eg: contacts:add

DEPENDENCIESnone

SIDE EFFECTSnone===========================================================================*/static int LauncherApp_ContactsParse(CLauncherApp *pme, const LauncherURLMap * urlMap, uint32 dwParam){ IWebUtil *piwu = NULL; uint16 state = 0;

char *psz = (char *)dwParam; int nErr = SUCCESS;

if (STRISTR((char *)dwParam, URL_CONTACTS_TOP)) { state = STATE_CONTACTS_TOP; } else if (STRISTR((char *)dwParam, URL_CONTACTS_ADD)) { state = STATE_ADD_CONTACT; } else if (STRISTR((char *)dwParam, URL_CONTACTS_APPEND)) { state = STATE_APPEND_CONTACT; }

Page 49: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 47

else if (STRISTR((char *)dwParam, URL_CONTACTS_SEARCH)) { state = STATE_SEARCH_CONTACT; } else if (STRISTR((char *)dwParam, URL_GETSELCONTACTS)) { state = STATE_SELECT_CONTACTS; } else { return EUNSUPPORTED; }

if(STATE_SELECT_CONTACTS == state) nErr = LauncherApp_HandleContactSelection(pme, STATE_SELECT_CONTACTS,dwParam); else { pme->m_arguments = (STRCHR((char *)dwParam,'?')+1); nErr = LauncherApp_LaunchNativeApp(pme, NATIVE_APP_PHONEBOOK, state, (uint32) pme->m_arguments);

//For eg: If URI is contacts:Add?Name=<name>, we set the state to STATE_ADD_CONTACT //and send Name=<name> as argument to the native application

}

return nErr;}

/*===========================================================================

FUNCTION LauncherApp_HandleContactSelection

DESCRIPTIONThis method provides a contrived function to parse out the classID and the uid string from the uri passed and lauches the addressbook appin the select contact state

PROTOTYPE:static int LauncherApp_HandleContactSelection(CLauncherApp *pme, uint16 state, uint32 dwParam)

PARAMETERS:pme [in]: Pointer to CLauncherAppstate [in] : The state in which to launch native contacts app. dwParam [in]: This will contain the URI passedfrom the application in this case contacts:SelectContacts?sender=<ClassID>&uid=<string>

DEPENDENCIESnone

SIDE EFFECTSnone===========================================================================*/static int LauncherApp_HandleContactSelection(CLauncherApp *pme, uint16 state, uint32 dwParam) { IWebUtil *piwu = NULL; int nErr = SUCCESS; char *pszDecodedStr; int nInLen, nOutLen; WebFormField wff[2];

Page 50: Acrobat Document

URI Launcher for Manufacturers URI Launcher Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 48

// This example shows how to decode the <ClassID> can be parsed from // contacts:SelectContacts?sender=<ClassID>&uid=<string> char *pszArgs = (char *)dwParam;

pme->pszPayload = NULL;

nErr = ISHELL_CreateInstance(pme->a.m_pIShell, AEECLSID_WEBUTIL, (void **)&piwu); if(SUCCESS != nErr) { DBGPRINTF("LAUNCHERAPP: Failed to create AEECLSID_WEBUTIL with err = %d", nErr); return nErr; }

MEMSET(wff, 0, sizeof(wff)); if (IWEBUTIL_ParseFormFields(piwu, &pszArgs, wff, 2, 0)) {

if((STRICMP(wff[0].pcName,“sender”) || (STRICMP(wff[1].pcName,“uid”)) { IWEBUTIL_Release(piwu); // mandatory fields are missing… return EBADPARM; }

nInLen = STRLEN(wff[0].pcValue); // Get the length of the decoded URL String IWEBUTIL_UrlDecode(piwu, wff[0].pcValue, &nInLen, NULL, &nOutLen);

if (!nOutLen) { // If the output length is zero, the param value is missing so return error IWEBUTIL_Release(piwu); return EINCOMPLETEITEM; }

pszDecodedStr = (char *) MALLOC(nOutLen + 1); if (pszDecodedStr) { IWEBUTIL_UrlDecode(piwu, wff[0].pcValue, &nInLen, pszDecodedStr, &nOutLen); } //Make a copy of the decoded string pme->pszPayload = STRDUP(pszDecodedStr); FREE(pszDecodedStr);

nInLen = STRLEN(wff[1].pcValue); // Get the length of the decoded URL String IWEBUTIL_UrlDecode(piwu, wff[1].pcValue, &nInLen, NULL, &nOutLen);

if (!nOutLen) { // If the output length is zero, the param value is missing so return error IWEBUTIL_Release(piwu); return EINCOMPLETEITEM; }

pszDecodedStr = (char *) MALLOC(nOutLen + 1); //REALLOC memory for the ':' & Uid (void)REALLOC(pme->pszPayload,nOutLen + 2 ); if (pszDecodedStr) { IWEBUTIL_UrlDecode(piwu, wff[1].pcValue, &nInLen, pszDecodedStr, &nOutLen); } STRCAT(pme->pszPayload, ":"); STRCAT(pme->pszPayload, pszDecodedStr); FREE(pszDecodedStr); //Now the payload contains <ClassiD>:<Uid>

} else { // If we arrive at this it means that the URL is not in a valid format /

Page 51: Acrobat Document

URI Launcher for Manufacturers INativeLauncher implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 49

// mandatory fields are missing IWEBUTIL_Release(piwu); return EBADPARM; }

IWEBUTIL_Release(piwu);

//Now launch the application in the SELECT_CONTACTS state return LauncherApp_LaunchNativeApp(pme, NATIVE_APP_PHONEBOOK, state, (uint32)pme->pszPayload);

}

INativeLauncher implementationThis section contains the following reference implementation for the INativeLauncher API.

• File: AEENativeLauncher.h on page 49• File: OEMNativeLauncher.c on page 50

File: AEENativeLauncher.h

#ifndef AEENATIVELAUNCHER_H#define AEENATIVELAUNCHER_H/*======================================================FILE: AEENativeLauncher.hSERVICES: Native Launcher include file.GENERAL DESCRIPTION:This file contians the Native Launcher definitions.Copyright © 2008 QUALCOMM Incorporated.All Rights Reserved.QUALCOMM Proprietary/GTDR=====================================================*/#include "AEE.h"#include "AEEClassIDs.h"#include "NATIVELAUNCHER.bid"

// Pre-defined Application IDs// Modify list of Native apps as necessary:#define NATIVE_APP_FIRST 1#define NATIVE_APP_PHONEBOOK (NATIVE_APP_FIRST)#define NATIVE_APP_CALLHISTORY (NATIVE_APP_FIRST + 1)#define NATIVE_APP_MESSAGING (NATIVE_APP_FIRST + 2)#define NATIVE_APP_VOICEMESSAGING (NATIVE_APP_FIRST + 3)#define NATIVE_APP_IM (NATIVE_APP_FIRST + 4)#define NATIVE_APP_EMAIL (NATIVE_APP_FIRST + 5)#define NATIVE_APP_CALCULATOR (NATIVE_APP_FIRST + 6)#define NATIVE_APP_CALENDAR (NATIVE_APP_FIRST + 7)#define NATIVE_APP_ALARMCLOCK (NATIVE_APP_FIRST + 8)#define NATIVE_APP_NOTEPAD (NATIVE_APP_FIRST + 9)#define NATIVE_APP_VOLUME (NATIVE_APP_FIRST + 10)#define NATIVE_APP_OTHER (NATIVE_APP_FIRST + 11)#define NATIVE_APP_TXTMESSAGING (NATIVE_APP_FIRST + 12)#define NATIVE_APP_PIXMESSAGING (NATIVE_APP_FIRST + 13)#define NATIVE_APP_LAST (NATIVE_APP_FIRST + 14)

// States to launch phonebook application// Modify these states as necessary:#define STATE_ADD_CONTACT (1)#define STATE_APPEND_CONTACT (2)#define STATE_SEARCH_CONTACT (3)#define STATE_CONTACTS_TOP (4)#define STATE_SELECT_CONTACTS (5)

Page 52: Acrobat Document

URI Launcher for Manufacturers INativeLauncher implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 50

/*===========================================================================CLASS DEFINITIONS===========================================================================*/// Define INativeLauncher interfacetypedef struct INativeLauncher INativeLauncher;AEEINTERFACE(INativeLauncher){ INHERIT_IQueryInterface(INativeLauncher); int (*LaunchNativeApp)(INativeLauncher *p, uint32 appID, uint16 state, uint32 *pdwArgs); };

static __inline uint32 INATIVELAUNCHER_AddRef(INativeLauncher *p){ return AEEGETPVTBL((p),INativeLauncher)->AddRef(p);}static __inline uint32 INATIVELAUNCHER_Release(INativeLauncher *p){ return AEEGETPVTBL((p),INativeLauncher)->Release(p);}static __inline int INATIVELAUNCHER_QueryInterface(INativeLauncher *p, AEECLSID id, void **ppo){ return AEEGETPVTBL((p),INativeLauncher)->QueryInterface(p,id,ppo);}static __inline int INATIVELAUNCHER_LaunchNativeApp(INativeLauncher *p, uint32 appID, uint16 state, uint32 *pdwArgs){ return AEEGETPVTBL(p,INativeLauncher)->LaunchNativeApp(p, appID, state, pdwArgs);}

/*=====================================================================DATA STRUCTURES DOCUMENTATION==============================================================================================================================================*/#endif // AEENATIVELAUNCHER_H

File: OEMNativeLauncher.c

/*=================================================================FILE: OEMNativeLauncher.cSERVICES: Sample nativelauncher class using AEEDESCRIPTIONThis file contains a class that implements the INativeLauncher interface.INativeLauncher interface implements services that allows for launchingof native applications from a Brew MP Application.PUBLIC CLASSES:N/ACopyright © 2008 QUALCOMM Incorporated.All Rights Reserved.QUALCOMM Proprietary/GTDR==========================================================================*//*==========================================================================INCLUDES AND VARIABLE DEFINITIONS========================================================================= */#include "OEMFeatures.h"#include "AEE_OEMDispatch.h"#include "AEEModGen.h"#include "AEEAppGen.h"#include "AEEShell.h"#include "AEEDisp.h"#include "AEEStdLib.h"#include "AEENativeLauncher.h"

Page 53: Acrobat Document

URI Launcher for Manufacturers INativeLauncher implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 51

// Include any additional headers files from your shim / native layer as needed here:

/*==========================================================================PUBLIC DATA DECLARATIONS==========================================================================*/#define FARF_NATIVELAUNCHER 1#define FARF(x, p) if (1 == FARF_##x) DBGPRINTF p

/*-------------------------------------------------------------------Type Declarations-------------------------------------------------------------------*/// NativeLauncher class strucutre.typedef struct _OEMNativeLauncher{ const AEEVTBL(INativeLauncher) *pvt; AEECLSID clsID; // ClassID of nativelauncher class uint32 m_nRefs; // Class reference counter IShell * m_pIShell; // pointer to IShell

} OEMNativeLauncher;

typedef struct _OEMNativeAppMapping{ uint32 dwAppID; // INativeLauncher AppID uint32 dwNativeID; // AppID as specified by the Native Layer} OEMNativeAppMapping;

/*-------------------------------------------------------------------Function Prototypes-------------------------------------------------------------------*/// NativeLauncher function prototypesstatic uint32 OEMNativeLauncher_AddRef(INativeLauncher * pMe);static uint32 OEMNativeLauncher_Release(INativeLauncher * pMe);static int OEMNativeLauncher_QueryInterface(INativeLauncher *pMe, AEECLSID id, void **ppNew);static int OEMNativeLauncher_LaunchNativeApp(INativeLauncher *pMe, uint32 appID, uint16 state, uint32 *pdwArgs);

/*-------------------------------------------------------------------Global Constant Definitions-------------------------------------------------------------------*//*-------------------------------------------------------------------Global Data Definitions-------------------------------------------------------------------*//*-------------------------------------------------------------------Static variable Definitions-------------------------------------------------------------------*/static const VTBL(INativeLauncher) gCNativeLauncherFuncs = {OEMNativeLauncher_AddRef,OEMNativeLauncher_Release,OEMNativeLauncher_QueryInterface,OEMNativeLauncher_LaunchNativeApp,};/*==========================================================================FUNCTION DEFINITIONS========================================================================= *//*==========================================================================Function: OEMNativeLauncher_AddRef()Description:This function increases the reference count for theOEMNativeLauncher objectPrototype:

Page 54: Acrobat Document

URI Launcher for Manufacturers INativeLauncher implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 52

uint32 OEMNativeLauncher_AddRef(Notifier* po)Parameters:po [in]: Pointer to NativeLauncher interface whose reference countis to be incrementedReturn Value:The updated reference countComments: NoneSide Effects: None==========================================================================*/static uint32 OEMNativeLauncher_AddRef(INativeLauncher* po){ return ++(((OEMNativeLauncher *)po)->m_nRefs);}

/*==========================================================================Function: OEMNativeLauncher_Release()Description:This function decreases the reference count for the NativeLauncher object.If the reference count reaches zero, it does the required cleanupPrototype:uint32 OEMNativeLauncher_Release(INativeLauncher* po)Parameters:po [in]: Pointer to the NativeLauncher interface whose reference countneeds to be decremented.Return Value:The updated reference countComments: NoneSide Effects: None==========================================================================*/static uint32 OEMNativeLauncher_Release(INativeLauncher* po){ OEMNativeLauncher * pMe = (OEMNativeLauncher *)po; if (--pMe->m_nRefs != 0) return pMe->m_nRefs; ISHELL_Release(pMe->m_pIShell); // Release the Shell // delete this OEMNativeLauncher object allocated in NotifierClass_New FREEOBJ(pMe); return 0;}

static int OEMNativeLauncher_QueryInterface(INativeLauncher *pMe, AEECLSID id, void **ppNew){ if (!ppNew) { return EBADPARM; } if ((id == AEECLSID_QUERYINTERFACE) || (id == AEECLSID_NATIVELAUNCHER)) { *ppNew = pMe; IQI_AddRef(*ppNew); return SUCCESS; } else { return ECLASSNOTSUPPORT; }}

/*==========================================================================Function: OEMNativeLauncher_LaunchNativeApp()Description:

Page 55: Acrobat Document

URI Launcher for Manufacturers INativeLauncher implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 53

This function calls the native application with the arguments recievedPrototype:static int OEMNativeLauncher_LaunchNativeApp(INativeLauncher *pMe, uint32 appID, uint16 state, uint32 *pdwArgs)Parameters:pMe [in]: Pointer to the NativeLauncher interface.appID [in] : The ID corresponding to the native application to launchstate [in] : State in which to launch the native application. Can be NULL if Native app does not understand states.pdwArgs [in] : Arguments to be passed to the Native application.Return Value:Brew MP ERROR CODEComments: NoneSide Effects: None==========================================================================*/static int OEMNativeLauncher_LaunchNativeApp(INativeLauncher *pMe, uint32 appID, uint16 state, uint32 *pdwArgs){ // Modify the mapping below based on your native application IDs: static const OEMNativeAppMapping mapping[] = { {NATIVE_APP_PHONEBOOK, UI_PHONEBOOK_S}, //UI_PHONEBOOK_S is the native phonebook app. {NATIVE_APP_CALLHISTORY, UI_CALL_S}, {NATIVE_APP_OTHER, UI_BREW_S}, {NATIVE_APP_EMAIL, UI_EMAIL_S}, {NATIVE_APP_CALCULATOR, UI_CALC_S}, {NATIVE_APP_CALENDAR, UI_CALENDAR_S}, {NATIVE_APP_ALARMCLOCK, UI_ALARMCLOCK_S}, {NATIVE_APP_NOTEPAD, UI_NOTEPAD_S}, {NATIVE_APP_VOLUME, UI_VOLUME_S}, {NATIVE_APP_VOICEMESSAGING, UI_VOICEMESSAGING_S}, {NATIVE_APP_IM, UI_IM_S}, {NATIVE_APP_TXTMESSAGING, UI_TXTMSG_S}, {NATIVE_APP_PIXMESSAGING, UI_PIXMSG_S} };

int indexApp = 0, indexKey = 0; uint32 args = (uint32)pdwArgs; FARF(NATIVELAUNCHER, ("*LAUNCHER*: LaunchNativeApp: %d, 0x%x", appID, pdwArgs)); if ((appID < NATIVE_APP_FIRST) || (appID > NATIVE_APP_LAST)) return EFAILED;

while (indexApp < (sizeof(mapping) / sizeof(OEMNativeAppMapping))) { if (mapping[indexApp].dwAppID == appID) break; indexApp++; } if (indexApp >= (sizeof(mapping) / sizeof(OEMNativeAppMapping))) { return EFAILED; }

// ui_add_event is a hypothetical OEM method that might be used by an OEM to suspend Brew MP ui_add_event(UI_AEE_SUSPEND_REQ_E); // Suspend Brew MP

// ui_add_event_new is a hypothetical OEM method that starts native apps. in this example // it takes the following arguments: // nativeid - // state - if the native apps cannot directly be started in a state, // then state will be set to NULL // in urilauncher and will be passed in the args argument. // args - "Add?Name=<name>" where "add" is the state // This method can also simply launch the native app, so that it can consume the // URI command without foregrounding itself. For example, the idle screen might // consume the ‘vmstats:Received’ URI command and return back to the calling // application without foregrounding itself. ui_add_event_new(UI_BREW_NATIVE_START_E, (uint16)mapping[indexApp].dwNativeID, state, args);

Page 56: Acrobat Document

URI Launcher for Manufacturers Document Viewer Application implementation

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 54

return SUCCESS;}

/*==========================================================================Function: OEMNativeLauncher_NewDescription:This function is invoked when the nativelauncher class is being loaded.It creates a new instance of the OEMNativeLauncher structure.Prototype:int OEMNativeLauncher_New(IShell * pIShell,AEECLSID clsID,void **ppobj)Parameters:pIShell [in]: Contains a valid pointer to the AEE IShell interfaceclsID [in]: Specifies the ClassID of this classppobj [out]: On return, *ppobj points to a valid OEMNativeLauncherstructure. This allocation is done by this functionDependancies: NoneReturn Value:SUCCESS: If successfulEBADPARM, ENOMEMORY: If failedComments: NoneSide Effects: None==========================================================================*/int OEMNativeLauncher_New(IShell *pIShell, AEECLSID clsID, void **ppobj){ OEMNativeLauncher *pMe = NULL; int nSize; *ppobj = NULL; //Validate parameters if (!pIShell) return EBADPARM; nSize = sizeof(OEMNativeLauncher); // Allocate memory for the nativelauncher object and the INativeLauncherVtbl if (NULL == (pMe = (OEMNativeLauncher*)MALLOC(nSize))) return ENOMEMORY; //Initialize the data members pMe->pvt = &gCNativeLauncherFuncs; pMe->m_nRefs = 1; pMe->m_pIShell = pIShell; pMe->clsID = clsID; ISHELL_AddRef(pIShell); *ppobj = (void *)pMe; return SUCCESS;}

Document Viewer Application implementationThis section contains the following reference implementation for the Document Viewer Application.

• File: VZWDocViewerError.h on page 54

File: VZWDocViewerError.h

//FILE: VZWDocViewerError.h//Copyright (c) 2008 QUALCOMM Incorporated// All Rights Reserved.// QUALCOMM Proprietary and Confidential

//INCLUDES AND VARIABLE DEFINITIONS

Page 57: Acrobat Document

URI Launcher for Manufacturers Solution verification

Qualcomm Confidential and Proprietary | © 2010 QUALCOMM Incorporated 55

#include "AEEError.h"

/*Native Document Viewer application will include this header file and support the granularity of error detection. Minimum response of EFAILED should be sent in the case of failures where further narrowing of the error condition cannot be done.

App developers who use these docviewer URI commands should also include the above header file and handle these specific responses (with a <status_code>) to determine the failures.*/

#define VZWDV_ERROR_BASE (ERROR_USER + 1) //ERROR_USER (0x4000) #define VZWDV_FILENOEXISTS (VZWDV_ERROR_BASE+1) // File does not exist#define VZWDV_FILEUNSUPPORTED (VZWDV_ERROR_BASE+2) // File type not supported#define VZWDV_FILEVERSIONNOTSUPPORT (VZWDV_ERROR_BASE+3) // File Version not supported#define VZWDV_BADFILENAME (VZWDV_ERROR_BASE+4) // Bad file name#define VZWDV_FILE_CORRUPT (VZWDV_ERROR_BASE+5) // Corrupted file#define VZWDV_FILE_TOOSMALL (VZWDV_ERROR_BASE+6) // file size too small#define VZWDV_FILE_TOOBIG (VZWDV_ERROR_BASE+7) // file size too big#define VZWDV_NOTOWNER (VZWDV_ERROR_BASE+8) // Not authorized to perform the operation#define VZWDV_UNABLETOLOAD (VZWDV_ERROR_BASE+9) // Unable to load the document#define VZWDV_NOMEDIA (VZWDV_ERROR_BASE+10) // RMC Storage media not present#define VZWDV_UNKNOWN (VZWDV_ERROR_BASE+11) // app specific error, but error unknown

Solution verificationTo verify this solution, refer to OATURILauncher, which is part of Brew MP PVS+VST 1.0.