540 likes | 751 Views
Mobile .Net & Mappoint Service. .NET Mobile Overview. Imran Muhammad CS 898T Mobile and Wireless Networks Summer 2005 Wichita State University. Mobile Solution Scenarios. Mobile Office: Email, PIM, IM etc SFA (Sales Force Automation): Mobile CRM, Order Entry etc
E N D
Mobile .Net & Mappoint Service
.NET Mobile Overview Imran Muhammad CS 898TMobile and Wireless Networks Summer 2005 Wichita State University
Mobile Solution Scenarios • Mobile Office: Email, PIM, IM etc • SFA (Sales Force Automation): Mobile CRM, Order Entry etc • Delivery Automation : Route Drivers, Taxis etc • FFA (Field Force Automation): Service Technicians, Installers etc • Warehouse Automation : Inventory Control etc • Asset Tracking : Asset Mgmt, Bag Tracking etc • Mobile Government : Inspections, Law Enforcement, Activity Reporting etc • Consumer : Games, Find Services etc
The Application Universe Clients User Experiences & Solutions Tools XML Web Services Authentication CRM Voice CallsEnterprise Databases Email Data CallsLocation Services Billing etc…
VB C++ C# J# … Common Language Specification ASP.NET Windows Forms ADO.NET and XML Base Class Library Common Language Runtime Windows COM+ Services .NET Framework Architecture
What is the .NET Mobile Framework ?
ASP.NET Mobile Controls ASP.NET Mobile Controls Smart Device Programmability Remote Web Pages Remote Web Pages Local Code Mobile Web Browser Mobile Web Browser .NET Compact Framework Device Operating System Device Operating System .NET Device ProgrammingTwo approaches – one model, one tool
ASP.NET Mobile Controls Smart Device Programmability Remote Web Pages Local Code Mobile Web Browser .NET Compact Framework Device Operating System .NET Device ProgrammingSmart Device Programmability Smart client Smart Devices
.NET CF Design Goals • Compatibility • Strict compatibility with .NET Framework • Subset functionality • Subset for devices • Give the developer a known target • Enable skills andcode transfer • Size/functionality .NET Framework .NET Compact Framework
.NET Mobile Framework • Lightweight version of .NET Framework • Designed for resource-constrained devices • Compatible with VS.NET, C#, VB.NET • Runs applications securely on-device • High performance JIT compiler • Guarantees robustness and security • Highly interactive, offline, and networked experiences • Makes it easy to consume web services • Tunable size and performance
System.Web System.WinForms Services UI Design ComponentModel Description HtmlControls Discovery WebControls System.Drawing Protocols Caching Security Drawing2D Printing Text Configuration SessionState Imaging System.Data System.Xml ADO.NET SqlClient XmlDocument Serialization Reader/Writers Design Xslt/XPath System Collections IO Configuration Runtime InteropServices Security Net ServiceProcess Remoting Text Reflection Diagnostics Serialization Globalization Resources Threading Desktop .NET Framework
.NET Compact Framework System.Web System.WinForms Services UI Design ComponentModel Description HtmlControls Discovery WebControls System.Drawing Protocols Caching Security Drawing2D Printing Text Configuration SessionState Imaging System.Data System.Xml ADO.NET SqlClient XmlDocument Serialization Reader/Writers Design SqlServerCe Xslt/XPath System Collections IO Configuration Runtime InteropServices Security Net ServiceProcess Remoting Text Reflection Diagnostics Serialization Globalization Resources Threading
Framework Size • Framework size (RAM or ROM) • ~1.5 MB • Running RAM needs • 1 MB+ (depends on app) • Typical application sizes • 50 - 500 KB • Apps often smaller due to use of platform features in the framework
.NET CLR Common Features • Verifiable type safe execution • No uninitialized variables, unsafe casts, bad array indexing, bad pointer math • Garbage Collection • ref-counting, reduced leaks • JIT compilation • Error handling with exceptions • Common type system • Call, inherit, and source-level debug across different languages
Compact CLR Differences • Limited COM Interop • Good support for calling native DLLs • Support for calling a COM object through DLL wrappers • No support for writing a COM / ActiveX object in C# or Visual Basic • No Install-time JIT (nGen) • No Reflection Emit • No Remoting • Client web services is fully supported • No Generic Serialization • Datasets can be serialized to XML • Subsets of other areas of functionality
Features not supported in .Net Mobile Framework • ASP .Net: Primarily being a rich client platform, it doesn’t provide any ASP .Net support. • Assemblies and GAC: There is no support for multimodule assemblies. • COM Interoperability: Even though interoperability with COM objects is not supported, there are other ways of accessing a COM object. Platform Invoke method can be used to call native DLLs which in turn can access COM DLLs. • Asynchronous Delegates: Not supported.
Reflection: No support for System.Reflection.Emit namespace. • XML Web Services: Developers cannot host web services under .Net Mobile Framework. • Remoting: Cannot develop Remoting applications. • Printing: No support for printing functionalities. • GDI+: Advance GDI support is missing in Compact Framework. • XML: XML Schema validations and XPath are not supported.
Button CheckBox ComboBox ContextMenu DataGrid DomainUpDown FileOpenDialog Supported controls Supported Controls StatusBar TabControl TextBox Timer ToolBar TreeView VScrollBar HScrollBar ImageList Label ListBox ListView FileSaveDialog MainMenu NumericUpDown Panel PictureBox ProgressBar RadioButton • Unsupported controls GroupBox RichTextBox NotificationBubble Print Controls • Unsupported controls – not available in CE HelpProvider LinkLabel NotifyIcon ToolTip Splitter FontDialog CheckedListBox ColorDialog ErrorProvider
Fit Content to Window Portrait Landscape
Change the Content • Content may need to change when orientation changes Portrait Landscape
Change the Layout Portrait Landscape
Design for Square Portrait Landscape
Networking • Sockets • Synchronous and asynchronous • Multiple protocols • Streams • Built on top of sockets • Synchronous and asynchronous • HTTP request and response • Use stream model • Requires no user knowledge of HTTP Applications .NET Compact Framework Web Services HTTP Request/Response, Network Stream Sockets Common Language Runtime
Data Characteristics • Amount of data to be stored • <100 kb: XML • > SQL Server CE • Amount of data to be exchanged • < 1MB web services • Small chunks more frequently • > Remote data access or merge replication • Larger chunks less frequently
XML • XmlTextReader and XmlTextWriter • Forward-only parsers of XML data • Better performance, no in-memory caching • Low memory requirements • XmlDocument • Parse entire document • In memory traversal • Higher memory requirements; more functionality
ADO.NET Support • Handling data offline with DataSet • Communicating DataSet with XML • Common data model from server to PC to device • Extensible ADO.NET provider model • Included data providers • SQL Server (System.Data.SqlClient) • SQL Server CE (System.Data.SqlServerCe)
Web Services Support • Calling XML Web Services • Synchronous and asynchronous invocation • Basic and Digest authentication • Secure Sockets Layer support for encryption (SSL) • Custom SOAP headers • SOAP Extension Framework
Data Access in .NET Mobile • Active Data Object (ADO) .NET • Mobile applications can access Microsoft SQL Server 2000 on remote servers or access a SQL Server CE locally on the device • Disconnected mode support • SQL Server CE lets applications cache large volumes of data (tens of megabytes), read, and update in disconnected mode • SQL Server CE provides synchronization mechanisms for changes made upon reconnection SQL Server CE • Caching • Synch Internet Internet Information Server (IIS) SQL Server
SQLCE • SQL Server CE • Supports large datasets, rich queries, transactions • Small footprint, DBMS can live on memory card • Some limitations (no stored procedures, triggers) • Synchronization through: • Replication (RDA or Merge) • XML Web Service Synchronization
5 3 4 XML Service SQL 3 1 3 MapPoint WebService FedEx WebService 3 XML Google WebService Demonstration : .Net & services 2
MapPoint Web Service • Microsoft MapPoint Web Service is an XML Web service with a SOAP API that allows you to add location-based functionality to your application that calls on the high-quality maps, as well as the location-finding and routing capabilities of MapPoint Web Service. MapPoint Web Service is comprised of four constituent services: Common, Find, Render, and Route.
Introduction to the MapPoint Web Services • Web Services providing location-based services • Maps • Driving Directions • Proximity Searches • Current Version 3.5 • Can integrate your own, custom, data with the data provided • Store locations • Custom Icons
MapPoint Web Service 3.5 • Enriches your application by making mapping a simple “ingredient” • .NET Web Service API • Find, Render, Route services • Developed and hosted by Microsoft • 20M+ transactions per day • Extensive Geographic Data • Coverage in 38 countries worldwide • More than 15 million Points of Interest
Web Service API • Staging WSDL File athttp://staging.mappoint.net/standard-30/mappoint.wsdl • Production environment also available • Sign up for Eval Account • http://msdn.microsoft.com/mappoint • MSDN Subscribers get 12 months or 50,000 hits
Web Service API • Common Service • Find Service • Render Service • Route Service • Customer Data Service
Web Service API • Common Service • utility classes, methods and properties that are common to the find, route, and render services, or are basic utility functions used by the other services • Address class contains the constituent parts of an address: street, city, other city, region, country, and postal code.
Web Service API • Find Service • Locate addresses and points of interest • Get information about specific Lat/Long • Find locations near a specific point or along a route • Find addresses and geographic entities • Find POI spatially or along routes • Parse addresses
Find Service • The Find service allows you to locate addresses, geographic entities, latitude and longitude coordinates, and points of interest from MapPoint Web Service data, as well as parse addresses and return location information for a specified latitude and longitude coordinate. New! • FindServiceSoap class contains the methods and properties related to calling the Find service. • FindAddress method returns a list of found addresses based on an input address, • in order of how well the results match the search criteria. • FindAddressSpecification class contains the search specification used in the • FindServiceSoap.FindAddress method. Specifies the address to find, the search options to use, and • the data source from which to get results.
Web Service API (cont) • Render Service • Render maps showing routes and locations • Set map size, view and controls • Add pushpins (including custom icons) • Select points on a map, get location information about points on a map, pan and zoom a rendered map, and create clickable maps. • 30 map styles available • 4 designed specifically for devices
Render Service • RenderServiceSoap class contains the methods and properties related to calling the Render service. • MapSpecification class contains the specifications for rendering a map. Includes the data source to use, • map views, pushpins, route, selected entities, and map options. • GetMap method returns map images, map views, and hot area definitions based on map options. • GetBestMapView method returns the best map view for a selected location or set of locations. The best • map view is the largest scale map that contains all the desired locations. • MapOptions class contains the map rendering options used in the RenderServiceSoap.GetMap method. • Specifies the the data source, the image format, panning and zooming factors, and identification of the • requested map as an overview map. • Pushpin class contains the icon, label, location, and user-defined identification number of a pushpin. • A Pushpin object is used to mark a location on a map image, and the location can be a place, address, or • latitude and longitude coordinate.
Render Service • MapView class is an abstract class representing a requested map view. Each of the derived classes defines • A map view using a different measure: a set of location points, a bounding rectangle, height and width, or • scale. • MapImage class contains a map returned from the RenderServiceSoap.GetMap method. Includes the image • or a URL to get the image, map view representations, and the hot areas associated with pushpins. • MapSpecification mapSpec = new MapSpecification(); • mapSpec.DataSourceName = “MapPoint.AP”; • mapSpec.Options… desired size and style • mapSpec.Views = my MapViewRepresentation object • MapImage[ ] maps = RenderService.GetMap(mapSpec); • Image mapImage = • new Bitmap(MemoryStream(maps[0].MimeData.Bits)); Render Service
Web Service API • Route Service • Generate driving directions and routes including setting waypoints • Calculates routes and itinerary • Shortest or Quickest route options • Use CalculateSimpleRoute for LatLong point based routes
Route Service • RouteServiceSoap class contains the methods and properties related to calling the Route service. • Route class contains a route of two waypoints (start and end points). A Route can include a specification, a set of directions, and/or a calculated route representation. • CalculateSimpleRoute method returns a route based on specified latitude and longitude coordinates. • Getting MapPoint Route myRoute = RouteService.CalculateSimpleRoute( LatLong[], "MapPoint.AP", SegmentPreference.Quickest); Segment tripSegment = myRoute.Itinerary.Segments[0]; foreach (Direction step tripSegment.Directions) Console.WriteLine(step.Instruction);