41
Introduction to Windows Embedded Handheld programming Catalin Gheorghiu Solution Architect I Computer Solutions

AISEC 12 april 2012 Introduction to Windows Embedded Handheld programming

Embed Size (px)

Citation preview

Page 1: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Introduction toWindows Embedded Handheld

programming

Catalin GheorghiuSolution Architect

I Computer Solutions

Page 2: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

New Product Families

Pocket PCSmartphonePocket PC Phone Edition

Windows Mobile 6 .1 Classic Windows Mobile 6 .1 Standard Windows Mobile 6 .1 Professional

Microsoft Windows Mobile 5.0 Microsoft Windows Mobile 6.1

http://www.microsoft.com/windowsmobile/en-us/meet/version-compare.mspx

Page 3: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

New Naming Conventions

Windows Mobile Standard(aka – Smartphone)

Non-touch platform designed for one handed use (I do not agree with this)

• Both are great options for Mobile Messaging

Windows Mobile Professional(aka – Pocket PC)

Touch screen - enabled for flexible input

Page 4: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Modularity and FlexibilityNew Product Family

Standard Pro Classic

Platform

Basic platform and applications, including:Microsoft Office Outlook MobileInternet Explorer MobileMedia Player MobileActiveSync

Touch screen UI

Windows Mobile Update

Windows Mobile Marketplace

IP Telephony

Applications

Office Mobile

Window Live Mobile

Voice Command 1.6

Remote Desktop Mobile

Page 5: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Windows Mobile Device Choice

Page 6: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Windows Mobile 6 Devices• Based on Windows Embedded CE and

supports the .NET Compact Framework• Windows Mobile 6 devices include more

software in ROM– .NET Compact Framework 2.0 SP1– SQL Server 2005 Compact Edition 3.1– AJAX application capabilities

Page 7: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Windows Communication Foundation support (over email)

• Support for LINQ (XML, Objects and Dataset)• New Tool - CLR Profiler• Compression Support• Client side certificates• Sound APIs • Windows Forms enhancements• Managed debugger fixes

.NET Compact Framework 3.5 Addressing key developer issues

Page 8: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

.NET Compact Framework~30% of the surface area in ~10% of the size

CopyGround-up rewrite Snapshot & Modify

System.Windows.Forms

System.Net

System.IO

System.Resources

System.Threading

System.Xml

System.Data

System.Messaging

System.Text.RegularExpressions

Microsoft.VisualBasic

System.ServiceModel

System.Collections

System.Collections.

Generic

System.Cryptography

System.IO.Ports

System.String

System.Text

System.Globalization

Microsoft.Win32.Registry

System.Web.Services

System.Drawing

Microsoft.DirectX.Direct3DMobile

Execution Engine,JIT, GC, Loader, Assembly Cache

Microsoft.ServiceModel.

Channels.MailTransport

~90% scope of

.NET Framework

Page 9: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Unit testing support for managed device applications• Same experience as unit testing for desktop

applications• Integrates seamlessly with Team System and Team

Foundation Server• Lets you easily test your application across various

device configurations• Support for Test Execution from Command Line

Unit Testing for Devices

Page 10: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Device security configuration– Understand and manage device security settings– Export security setting– Create custom security setting

• Manage certificates on the device– View certificates on the device– Add or remove certificates to/from the device

Security Aware IDE

Page 11: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Build on top of existing core connectivity framework

• Internally used by our own tools (e.g., unit testing)

• Makes it easy to build your own remote tools• Add reference to:

– Microsoft.Smartdevice.Connectivity.dll

Managed Core Connectivity Framework

Page 12: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Enhancements– Automation support – Access to interfaces via Visual Basic Script– Made it easy to add custom images in the

Device Emulator Manager– XML config file to configure emulator

instances

Device Emulator 3.0

Page 13: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Lend Me Your Ear…

Private / Public APIs

Lifecycle &

Ecosystem

Persistent

Storage

Virtual Memory

InstallDisplayPowerCode

Signing

Perf!Security Policies

Page 14: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Platform updates driven by mobile ecosystem• Updates are aligned with OEM • Support is a partnership between Microsoft, OEM, and

Mobile Operator

Lifecycle and Ecosystem

Mobile Operator

OEM/ODM

Microsoft

Page 15: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Mobile UI Challenges

• Screen– Size, orientation, resolution, layout

• Input– SIP, keyboard, dedicated buttons, stylus

• User Interaction– Standing up on a moving bus

• Understand System.Windows.Forms– Compactness– Form and Control classes

Page 16: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Windows Mobile 2003 SE changed everythingo VGA, Square Screen, Landscape…

• CE Subsystem 4.21 and higher are aware; 4.20 and lower use emulation layer.– HI_RES_AWARE resource can override– Emulation is practical—not beautiful

Display Assumptions - history

Page 17: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Apps that “assume” anything about the screen size of a device will have problems– Are you ready for high-res, square screen,

and landscape?• Video frame buffers may be non-linear

(direct access)• Emulation may mask some issues

Display Assumptions

Page 18: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Don’t assume anything• Test on different devices/emulators• Upgrading to .NET Compact Framework 2.0 in Visual Studio

2005 makes you aware by default:

this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

• Take advantage or docking and anchoring and state info (DisplayRotation) for simple needs

Display Assumptions - tips

Page 19: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Screen Layout• Do not try to create non-full screen forms• Top strip• Main Area• Bottom strip

Page 20: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming
Page 21: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Screen to Form• Top strip

– Don’t hide the title bar– Use the same title in owned forms

• Bottom strip– Don’t use a toolbar control– Don’t use more than two menus– Don’t hide the bottom strip

• Main Area– Place tappable controls near the bottom– TextBoxes or anything requiring the SIP, near the top

Page 22: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Form Basics• Startup• Hiding vs. Closing• Form Navigation• Application Termination

– By User– By platform (!)

• Application.Run• MinimizeBox• Show vs. ShowDialog• Remote Process Viewer• Running Programs List• MobileDevice.Hibernate

Page 23: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Screen-Aware• Size• Orientation• Resolution• UI design per form factor

– What platform am I on?• Patterns & Practices

– Mobile Client Software Factory/Mobile Application Blocks http://www.codeplex.com/smartclient / http://mobile.codeplex.com/

Orientation-Aware control

Page 24: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming
Page 25: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Demo – Form Basics

• Lifecycle of a form (& app) plus navigation

Page 26: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Handling Input• Keyboard• SIP

– Respond to Show/Hide

• Dedicated Buttons• Stylus or Finger

– Tap– Tap and Hold

• Typically for context menus• Don’t use this!

• InputPanel• HardwareButton• Tap events• Click, MouseDown,

MouseMove, MouseUp

Page 27: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Single-Handed Operation

• Design your app so it can be keyboard driven– Soft keys, D-Pad– Automatically, you are in a good place for

Smartphone

• Besides previous advice...– ...make it finger driven

Page 28: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Learn from Smartphone Model• Entirely Keyboard driven

– D-Pad (Left, Right, Up, Down, Enter)– Good use of Soft Keys are crucial

• Controls are stacked– Label, LinkLabel, CheckBox, ComboBox, TextBox,

DateTimePicker– TabIndex, TabStop

• ...or full screen– ListView, TreeView, DataGrid

Page 29: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Definitions (thanks Wikipedia )

GPS is a satellite navigation systems that provide autonomous geo-spatial positioning with global coverage (one of …) thus allows electronic receivers to determine their location (longitude, latitude, and altitude) to within a few meters using time signals transmitted along a line of sight by radio from satellites. Take Care: Time is accurate but not corrected!

Page 30: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

NMEA 0183 (NMEA for short) is a combined electrical and data specification for communication between marine electronic devices such as echo sounder, sonars, anemometer, gyrocompass, autopilot, GPS receivers and many other. It has been defined by, and is controlled by, the U.S.-based National Marine Electronics Association.The standard uses a simple ASCII, serial communications protocol that defines how data is transmitted in a "sentence" from one "talker" to one "listener" at a time.

Page 31: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Windows Mobile & GPSGPS Intermediate Driver provides an intermediate layer that abstracts the actual GPS device from application developers. This intermediate layer also abstracts applications from GPS device manufacturers. Ideally, this enables application developers to write code that works with any GPS hardware, and GPS device manufacturers to produce hardware that works with any application.

Page 32: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

FakeGPS (what is, install etc)• Fakes data received by the GPS APIs

– C:\Program Files\Windows Mobile 6 SDK\Tools\GPS• Reads NMEA data

– from \Program Files\FakeGPS\GPSFiles

Or you can do it the hard way:http://www.bbits.co.uk/blog/archive/2006/07/14/12027.aspx

Page 33: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Windows Mobile & GPSProgramming

Did you know that you have all in SDK?Out of the box and ready to use: C:\Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CS\GPS

GPS Sample Classes (http://msdn.microsoft.com/en-us/library/ms881362.aspx)• Gps: The interface to the managed GPS API. use this

class to open, close, and query the device state, and to query the position data from your GPS hardware.

• GpsPosition: Contains the GPS position data received from the GPS hardware.

• GpsDevice: Contains the GPS device state data received from the GPS hardware.

• Utils: Native memory allocation utilities.

Page 34: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Windows Communication Foundation

Store and Forward MessagingServer

Exchange 2007

ExchangeWeb

Services

Exchange Web

Services Datacenterwithin thecompany

Exchange Web

Services

ActiveSnc

CorporateWi-Fi

network

ActiveSync

Mobileoperatornetwork

Page 35: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

The WCF subset supported by NetCFFeature Desktop WCF Compact WCF

Bindings:

· BasicHttpBinding Yes Yes

· CustomBinding Yes Yes

· WindowsMobileMailBinding N/A Yes

· ExchangeWebServiceMailBinding Yes, via NetCF install Yes

Formatters: · SoapFormatter Yes Yes· BinaryFormatter Yes NoEncoders:

· TextMessageEncoder Yes Yes

· BinaryMessageEncodingBindingElement Yes No

· MTOMEncoder Yes No· GzipEncoder Sample available Sample available

Page 36: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

The WCF subset supported by NetCF contFeature Desktop WCF Compact WCF

Transports: · HttpTransportBindingElement Yes Yes· HttpsTransportBindingElement Yes Yes· MailTransportBindingElement Yes, via NetCF install Yes· MsmqTransportBindingElement Yes No· TcpTransportBindingElement Yes No· (other transports) Yes No

XmlDictionaryReader/Writer Yes Yes; stub around XmlTextReader/Writer

DataContractSerializer Yes No; but can be wire-compatible with DCS via XmlSerializer

Service proxy generation Yes; via SvcUtil.exe Yes; via NetCFSvcUtil.exe, not integrated into VS2008

· Non-HTTP transports in generated proxies Yes Not built-in· Custom headers in generated proxies Yes Not built-in

Page 37: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

The WCF subset supported by NetCF contFeature Desktop WCF Compact WCF

WS-Addressing Yes YesWS-Security message level security · X.509 Yes Yes· Username/password Yes No· SecurityAlgorithmSuite.Basic256Rsa15 Yes Yes· SecurityAlgorithmSuite.Basic256 Yes NoWS-ReliableMessaging Yes NoPatterns · Service model Yes No· Message layer programming Yes Yes

· Buffered messages Yes Yes

· Streaming messages Yes No

· Endpoint descriptions in .config files Yes No

Channel extensibility Yes YesSecurity channel extensibility Yes No

Source: http://blogs.msdn.com/andrewarnottms/archive/2007/08/21/The-WCF-subset-supported-by-NetCF.aspx

Page 38: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

• Mobile Application Blocks http://mobile.codeplex.com/

• Power Toys for .NET Compact Framework 3.5http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13442

• NetCFSvcUtil http://download.microsoft.com/download/6/2/0/6205ED05-E435-44FC-AA82-B763CA5F8B1A/NetCFSvcUtil.exe

• http://ronua.ro/CS/blogs/catalin/default.aspx

Tools&Resources

Page 39: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Demo(s)

Page 40: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Q&A

Page 41: AISEC 12 april 2012   Introduction to Windows Embedded Handheld programming

Thank you for your attention.

Contact:• My Blog http://ronua.ro/CS/blogs/catalin/default.aspx

• My Email [email protected]