570 likes | 664 Views
Extended Systems. OneBridge Mobile Agent December 2002. Extended Systems. The History of PSP. PSP History. PSP is a markup language (Pocket Server Pages) HTML/XML based Approx. 66 PSP-specific tags + HTML PSP tags support mobile applications OMA (OneBridge Mobile Agent)
E N D
Extended Systems OneBridge Mobile Agent December 2002
Extended Systems The History of PSP
PSP History PSP is a markup language (Pocket Server Pages) • HTML/XML based • Approx. 66 PSP-specific tags + HTML • PSP tags support mobile applications OMA (OneBridge Mobile Agent) • Web Interface for both online and offline use • Processes PSP pages • Rich UI
PSP History Using PSP requires a basic understanding of HTML and web development. Who is PSP for? • Web developers • Novice developers eager to create applications of moderate complexity • Experienced developers eager to rapidly generate complex online/offline data-driven applications
PSP History Why chose PSP? • Rapid application development and prototyping • Built-in support for mobile applications • Signature capture • Online/offline database access • Print HTML on portable printers via IR • Familiar web interface • Applications are easy to modify • PSP is an interpreted language • No compiler or special tools required to write PSP
Chris Leffel: Fix this slide. Maybe needs a graphic? How OMA works • The user clicks on a link or executes a form, or (at startup), a default page is selected. • The page is loaded from the database, from the file system, or from an HTTP server. • The file is scanned from beginning to end. PSP tags are parsed and interpreted. All non-PSP tags are output to the output file. (The output file is located at \Temp\Report.htm). • The resulting HTML file (from the non-PSP tags, and from the interpreted PSP tags) is passed to an HTML rendering control that displays the result on the screen. • OMA waits for the next user action to provoke the execution of the next page.
Extended Systems Working with the Mobile Device
Required Files for development • Embedded Visual Tools • PocketPC 2002 SDK • OMA desktop install
OMA File Server • Allows you to easily move files from your development computer to the emulator or device. • Sets the default OMA application to run.
Extended Systems HTML Overview
HTML Overview All Mobile Agent pages are based on HTML documents All Mobile Agent pages are based on HTML documents HelloWorld.txt <!-– Hello World page --> <html> <body> <h1> Hello World!</h1> </body> </html>
HTML Overview Forms are processed similar to the way they are in web programming Forms are processed similar to the way they are in web programming formCapture.txt <html> <body> <form method=post ACTION=“formShow.txt"> What is your name? <input type=“text” name=“username” value=“John Doe”><input type=submit value="submit"> </form> </body> </html>
HTML Overview Forms are processed similar to the way they are in web programming Forms are processed similar to the way they are in web programming formShow.txt <html> <body> Hello! <data value=username> </body> </html>
Extended Systems Mobile Databases
Chris Leffel: Fix this slide Mobile Databases • Need an intro slide
Mobile Databases PSP uses SQL to access databases • The <recordset...> tag is used to open recordsets <recordset name=“rs1” sql=“select * from customers”> Name: <data value=“rs1.CompanyName”><br> </recordset> • See MS SQL Server CE help for SQL help
Mobile Databases Creating a database using SQL and PSP <database connectionstring= "Provider=Microsoft.SQLSERVER.OLEDB.CE.1.0; Data Source=\windows\oma.sdf"> <recordset name=“rs1” sql='create database "\Program Files\OneBridge\trainingdemo\demo.sdf" ' action=“open”/> <recordset name=“rs1” action=“close”/>
Mobile Databases Creating a table using SQL and PSP <recordset name=“rs1” sql=“create table Customers (CustomerID nvarchar(64), CompanyName nvarchar(64), ContactName nvarchar(64), ContactTitle nvarchar(64), Address nvarchar(64), City nvarchar(64), Region nvarchar(16), PostalCode nvarchar(10), Country nvarchar(16), Phone nvarchar(24), Fax nvarchar(24))” action=“open”> <recordset name=“rs1” action=“close”/>
Mobile Databases Two database providers supported for Windows CE • SSCE: SQL Server CE Provider • Very fast and efficient for large databases • Few SQL limitations • CEDB: Pocket Access Provider • Databases are easier to create - ActiveSync • Slow, SQL is limited • Database size limited to 64K records
Extended Systems View Libraries
View Libraries • A set of PSP defined tags used to render database data • Provides a framework delivering easily modified applications. • Automatically generates code to handle sorting and pagination • Makes presentation of database information easy to define and manage
View Libraries List View with page selection popup Details View
View Libraries – list view What does a list view do? • List pagination • Column sorting • Detail Linking
View Libraries – list view • Defined in generateviews.txt – “customer view” • Used on showall_customers.txt
View Libraries – detail view What does a detail view do? • Preformatted reusable HTML • Easily linked to list views
View Libraries – detail view • Defined in generateviews.txt – “customer details” • Used on customer_details.txt
View Libraries – search view What does a search view do? • Creates HTML form elements dynamically • Developer does not need to be concerned with HTML formatting
View Libraries – search view • Defined in generateviews.txt – “customer search” • Used on customer_search.txt
View Libraries – edit view Why create an edit view? • Consistent UI • No need to build dynamic form elements using PSP
View Libraries – edit view • Defined in generateviews.txt – “customer details” • Used on edit_customer.txt
View Libraries – edit view Saving from an edit view • Copy form variables to record set values • Save the recordset & redirect <var "rsView.CompanyName=g_nameEdit"> <recordset name=rsView action=update> <redirect href="sys://customer_details.txt">
View Libraries – search view What does a search view do? • Creates HTML form elements dynamically • Developer does not need to be concerned with HTML formatting
View Libraries – search view • Defined in generateviews.txt – “customer search” • Used on customer_search.txt
Extended Systems Variables & Conditional Logic
Variables and Data Types 3 data types: • Number - All numeric and boolean data • String - Character data (Unicode by default) • Date - Date and Time values Variables are global by default Page level local variables may be specified. When possible, use local variables!
Variables and Data Types Declaring variables • A local string: <var expr=“local string s=‘this is a string’”/> <var “local s=‘this is a string’”> Using variables • An expression: <var expr=“total=total+price*discount”/> <var “total=total+price*discount”> Shortcut forms are easier to read, but not XML compliant!
Conditional Logic <if>…</if> Conditionally process code Example: <if "x+y<0"> Less than zero <else> Greater than or equal to zero </if>
Conditional Logic <while>… </while> Used for conditional looping Example: <var "x=0"> <while "x<10"> <var "x=x+1"> <data value=x><br> </while>
Extended Systems UI Elements
Pop Up Windows • Give feedback to the user without changing the screen they are looking at. • See authenticate.txt for sample code.
UI Controls <BUTTON> Allows buttons to be set programmatically. Example: <NAME="BACK" HREF="index.txt“ SCOPE=“global”>
UI Controls <MENUITEM> Allows the navigation menu to be set programmatically <MenuItem Name = item identifier, Value = text, Href = link, Action = add | remove, default = add Image = path/name of bitmap /> Example: <MenuItem name=”cust” value=”Customers” href=“cust.txt”/>
UI Controls Date Pick To specify a date-pick control, use "cal:"+optional (default) date as the content of the textarea block. Example: <AddViewItem label=“thedate" name=“theDate"> <textarea name="varDate" cols=12 rows=1>cal:1/1/2002</textarea> </AddViewItem>
UI Controls Time Pick To specify a time-pick control, use "tim:"+optional (default) time as the content of the textarea block. Example: <AddViewItem label="Time" name="g_time"> <textarea name="varTime" cols=12 rows=1>tim:14:00</textarea> </AddViewItem>
UI Controls Signature Capture Example: <AddViewItem label="Time" name="g_time"> <textarea name="Signature" cols=16 rows=5>sig:</textarea> </AddViewItem>
Chris Leffel: Fix this slide UI Controls dbSelect Example:
Extended Systems Debugging
Debugging • OMA can generate a log file • The log file shows details of PSP code execution • Logging may be activated manually or via code • Debugging online applications can be difficult • Server problem or client problem? • Very important to have a tool (tcpTrace) • Tool shows HTTP request and response data
Chris Leffel: Fix this slide Debugging sysMessage Example: