Embedded Systems October 2000 Vol13_11

Issue link:

Contents of this Issue


Page 57 of 181

The WAP architecture is built on a six-layer protocol based on the Open Systems Interconnect (051) model. The Lang library is a catch-all LlSnNG 4 User input check function badVaLue(number) { if (number> 10) { DiaLogs.aLert("Number > 10"); } , . the WMLBrowser library functions setVarO and goO to set the value of the WML variable UM and to rel1un to Card2. A WMLScript source code file is parsed by a lexical and syntactic analyz- er .uld translated into binary byte codes. The result ofa WMLScJipt compilation is a compilation unit, which contains user-created [unctions along with caUs to pre-defined library functions. The byte code contained in a compilation unit are interpreted by a vVMLScript interpreter. The functions within a com- pilation unit residing on a server are accessed by referencing a URL followed by a hash mark (#) , the ['unction name, ancl a parameter list. An example is caLL AddIt(1,2). The fun ction is AddItO with parameters 1 and 2. The byte- codes for the function are retJieved and processed by the WMLScript inte r- preter on the client. WMLScript library functions WMLScript supports a large array of useful li brary functions. The library functions are grouped into six cla siii- cations: Lang, FLoat, String, URL, WMLBrowser, and DiaLogs. WML cript library functions are called by prefix- ing the specific library. For example, to use getVarO, th e call WMLBrowser. getVar( "MyVa rOO), sim ila r to accessing a member function in C++. source of functions that are related to core WMLScJipt. The Lang functions range from determining the absolu te value of a numerical parameter to determining the character et support- ed by a WMLScript interpreter. The Float library supports floating-point functions typically used in an applica- tion, such as fLoorO and ceiLO. The String library contains string manipu- lation functions such as compare() and LengthO. The String library also con- tains some handy instructions such as findO, which locates a substrin g, squeezeO, which removes extra white space between strings, and trimO, which eliminates excess leading and trai ling white space in a string. The URL library contains fun ctions that manipulate URLs. The URL syn- tax supported is as foll ows: :II:l; ?# The URL library functions range from checking the validi ty of a URL to resolving absolute URLs. The majority of the URL functions are prefaced by get, which returns URL content and sU-ing information. Functions such as getParametersO and getPortO re turn the parameter list used in a URL and the port number specified in a URL, respectively. The WMLBrowser libra .. ·y contains the functions that link to WML vari- abl es. Important fun tions such as getVarO and setVarO retrieve and set variables in a WML program. Othe.- functions in the WMLBrowser library have the same name as base WML functions, such as goO and prevO. This duplicate naming can be a source of confusion if an author isn 't careful. The DiaLogs library contains user in terface functions, such as prompts and alerts. These beneficial fun ctions add quali ty to the user in terface and 56 OCTOBER 2000 Embedded Systems Programming save time, since the dialogs can be cached on the client device. Ifa simple prompt, confirmation, or alert is need- ed, the use r agent doesn ' t need to gen- erate reque ts to the WAP proxy, but simply accesses the code o n the client. These are useful fun ctions when responding to invalid user input. If a u er inputs an out-of-range number, a simple call to aLertO displays the error, as shown in the code segment in Listing 4. WAP protocol stack Underneath the Wireless Application Environment lies the rest of the WAP Protocol Stack. The WAP arch itecture is built on a six-layer protocol based on the Open Systems Interconnect (OSI) model, as shown in Figure 2. If you get involved with WAP develop- ment, you' ll be in one of two WAP implementation camps. You' ll either write WML and WMLScript applica- tions, or implement the stack that e nables the appli cations. Writing WML and WMLScript is re lative ly easy, but po rting the remainder of the stack to a target machine is a difficult and daunting task. The first underlying layer is the Session Laye r. The Session Layer con- tains the Wireless Session Protocol, or WSP. The WSP offers both connec- tion-oriented and connection less ser- vices. Connectio n-orie nted se rvices ma i n tain a vi nual connectio n throughout a sessio n. Sessions may be suspended and resumed at a later time. The connectionless services pro- vide datagrams that do not maintain a connection, similar to UDP. Underneath the Session Layer is the Transaction Layer, which contains the Wireless Transaction Protocol, or WTP. The WTP is designed with thin clients in mind. The Transaction Layer supports three transaction classes: unreliable one-I¥,dy requests, reliable one-way requests, and reliable two-way request and reply transactions. The next two layers down the stack are the Security and Transport Laye rs . The security p rotocol is based

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11