480 likes | 779 Views
Microsoft Smartphone 2002 Development. Agenda. Smartphone Hardware Smartphone OS Smartphone User Interface Development Tools Application Security & Deployment Working with Telephony .NET Compact Framework. Smartphone 2002 Hardware. 120MHz ARM processor
E N D
Agenda • Smartphone Hardware • Smartphone OS • Smartphone User Interface • Development Tools • Application Security & Deployment • Working with Telephony • .NET Compact Framework
Smartphone 2002 Hardware • 120MHz ARM processor • 16MB RAM for application execution and temporary storage • 32MB flash ROM for OS and permanent data storage • 176x220 16-bit colour display
Storage and Memory • ROM (~24MB) • Permanent content from Microsoft, OEM, and Operator provided applications. • Can be updated over-the-air. • Flash (~8MB) • Permanent data storage for application data, registry, and files, and databases. • Survives power loss, reboots, etc. • RAM (~16MB) • Application execution and radio. • Cleared on power off and reboot.
Dialler Control Panel Home Screen Inbox Apps / UI Connection Manager Toolkit Sync Engine Logic TAPI Threading Networking SIM Winsock WAP CryptoAPI SMS CE 3.0 Core APIs CDMA GSM Radio Stack SIM Smartphone 2002 OS
CheckBox DatePicker Edit Header Listbox Listview Progress Scrollbar Static Status Trackbar Treeview Buttons Radio Buttons Combo box Month Calendar Property Sheets/Pages Toolbar Expandable Edit Multi-Item Picker WinCE Controls Supported Not Recommended Not Supported New Controls
Smartphone User Interface Softkeys Expandable Edit Spinners Input Modes • Form factor require control changes • Menus • Multiline Text Edit • Listboxes • Stylus / SIP Input
Softkeys • Left softkey is most common action • Right softkey is a menu • Items are listed in desktop-style order • Items never have ellipses (…) • Dialogs have “Done” on the left softkey and “Cancel” on the right (if necessary)
Edit Controls • Edit controls support multiple input methods • Typically the methods available will be numeric, multi-tap, and T9 • Multi-line edit controls support zooming in for a larger view
Spinner Control • Replaces combo boxes, radio buttons, and list boxes • Multi-item selection available
Typical Application Flow • List view -> card view -> edit view • Contacts is a classic example
Development Tools • eMbedded Visual C++ 3.0 • Smartphone 2002 SDK • Emulator • No MFC / ATL • No eVB • Remote Tools • Registry Viewer • Process Viewer • File Viewer
Finding the Persistent Storage Path • To persist data, it must be stored in the registry or under in persistent storage directory • Use SHGetSpecialFolderPath() for root path • CSIDL_APPDATA\<appname> for files internal to your app • CSIDL_PERSONAL for files the user needs to work with (“My Documents”) • Data stored in RAM file system will be lost on power off
Finding the Persistent Storage Path TCHAR szVolumeFile[MAX_PATH]; if(!SHGetSpecialFolderPath(NULL, szVolumeFile, CSIDL_APPDATA, TRUE)) { ASSERT(FALSE); hr = HRESULT_FROM_WIN32(GetLastError()); return 0; } // szVolumeFile - \IPSM\Application Data
Creating Softkeys and Handling Back • Softkeys are just PocketPC menu bars that only have two items • Send a message to the menu bar to request messages for the back key
Creating Softkeys and Handling Back #define TPC //Create a MenuBar SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hParent; mbi.nToolBarId = IDM_MAIN_MENU; mbi.hInstRes = g_hInst; mbi.nBmpId = 0; mbi.cBmpImages = 0; // Create the menu bar if (!SHCreateMenuBar(&mbi)) { MessageBox(hParent, TEXT("SHCreateMenuBar Failed"), TEXT("Error"), MB_OK); return false; }
Creating Softkeys and Handling Back // Request notifications for the back key SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY));
Creating Softkeys and Handling Back // Handle the back key in the main window proc LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) { switch (uMessage) { … case WM_HOTKEY: { if((VK_TBACK == HIWORD(lParam)) { // Send back key to control with focus SHSendBackToFocusWindow(message, wParam, lParam); } } } }
Voice Calls Example #include <phone.h> PHONEMAKECALLINFO mci; int result; memset(&mci, 0, sizeof(mci)); mci.cbSize = sizeof(mci); mci.dwFlags = PMCF_PROMPTBEFORECALLING; mci.pszDestAddress = TEXT(“+18005551212"); result = PhoneMakeCall(mci); if (result != 0) { // Insert error handling code here }
Changing Input Modes //Set input mode to multitap SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, EIM_SPELL); //Set input mode to numeric SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, EIM_NUMBERS); //Set input mode to T9 SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, EIM_AMBIG); //Set input mode to multitap SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, EIM_SPELL); //Set input mode to numeric SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, EIM_NUMBERS); //Set input mode to T9 SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, EIM_AMBIG);
Dialler App Introduction to Telephony
Any Cab Any Cab Any Cab Any Exe Any Exe Any Exe Trusted Cab Trusted Exe Signed Cab Signed Cab Signed Exe Signed Exe Smartphone Security • Devices can be configured by the operator Unlocked device Locked device 1 Locked device 2
Application Management Execution • Two modes of execution • Unprivileged – has access to most APIs, registry keys, and files • Privileged – has access to everything • Modes allow operators to protect sensitive areas of the device and network
Application Management Execution • When do you need privileged? • Inbox plugins • Intercept SMS messages • Device drivers • How do you get privileged? • On a test device: sign with a test cert • On a shipping device: get signed with an operator cert
Debugging Applications • To debug against device need to sign files and provision device for cert.
Packaging Process • Create a CAB file using CABWizSP under the SDK \Tools directory • Create an INF file detailing application and company details, files to copy, shortcut creation CABWizSP Application Package (.CAB) Your Files Information File (.inf)
Packaging Process • To enable security signed applications • Sign the Exe and Cab using Signcode.exe CABWizSP Application Package (.CAB) Your Files Information File (.inf)
Application Management Distribution • Choose a channel to distribute your application • Use Mobile2Market to increase distribution channels • http://www.microsoft.com/mobile/developer/developerprograms/mobile2market/default.asp • Choose a transport to distribute your application • Pocket Internet Explorer • Email attachment • Storage card • ActiveSync
Smartphone Futures • Microsoft are committed to the platform • V. Next release • Based on Win CE 4.2 • Compact Framework 1.0 in ROM • ATL Support • JIT Debugging • RTTI / Exception Handling
.NET Compact Framework 1.0 For Smartphone • Will be a feature of next version of Smartphone • New UI Support • ROM - only – no CAB Install of Framework • Managed apps follow native security model • Added support for 5 new languages • Dutch, Danish, Swedish, Portuguese Brasilia, UK English • Multilingual User Interface (MUI) Support • Entire v1 feature set supported • SQL Server CE not supported
Button CheckBox ComboBox ContextMenu DataGrid DomainUpDown FileOpenDialog HScrollBar ImageList Label ListBox ListView TreeView FileSaveDialog Supported controls NETCF Supported ControlsPocket PC and Windows CE.NET MainMenu NumericUpDown Panel PictureBox ProgressBar RadioButton StatusBar TabControl TextBox Timer ToolBar VScrollBar MessageBox Form
Button CheckBox ComboBox ContextMenu DataGrid DomainUpDown FileOpenDialog HScrollBar ImageList Label ListBox ListView TreeView FileSaveDialog Supported controls NETCF Supported ControlsSmartphone MainMenu NumericUpDown Panel PictureBox ProgressBar RadioButton StatusBar TabControl TextBox Timer ToolBar VScrollBar MessageBox Form
Smartphone Controls • TextBox • .Multiline = True: MLE Control • .Multiline = False: Edit Control
Smartphone Controls • ComboBox • Action to view all items full screen
Smartphone Controls • TreeView • Recommended Full Screen • No CheckBoxes on Smartphone • ListView • Recommended Full Screen
Soft Keys (Menus) • Left SoftKey can not have menu items • If there is no MainMenu on the form • SoftKey press raises KeyDown and KeyUp events • KeyEventArgs.KeyCode is Keys.F1 and F2
Home Key • Home Key returns to home screen • No KeyPress event thrown • So Home Key can’t be overridden
Back Key • Back Key navigates back to previous screen • Next window in z - order brought to front • Exceptions • Always cancels out of modal dialogs • Backspace when focus on Textbox • When menu showing cancels out of menu • Overriding Default Behavior • Set KeyPressEventArgs.Handled = true • Intended for custom controls or games
Control Focus And Tabbing • Focus is critical to Smartphone UI model • Up and Down navigation keys switch between controls • Focusable Controls • CheckBox, ComboBox, ListView, TreeView, Form, TextBox • Tab order goes in order of focusable controls in controls collection • Custom Controls • Focusable unless Enabled property set to false • Developer must ‘tab out’ of their control by overriding the up/down keys and giving focus to next control • Designer Issue • Designer adds controls to code in reverse order
Security And Managed Code • .NET Compact Framework adapts native application-level security model • Managed apps follow native security policy • Security check also done on P/Invoke call • Application must be signed with carrier approved cert to run on locked devices • Code Access Security will come in .NET Compact Framework 2.0 • More granular security, unique to .NET
Application Architecture • Applies to Native and NETCF code Pocket PC UI Smartphone UI User Interface Application Engine Application Engine Utility Libraries Utility Libraries
Smartphone Developer Kit • Exclusive to MSPP members (~550€) • eVT 3.0 • Smartphone 2002 SDK • Documentation • Whitepapers • Samples • Compal AR11 • SIM Unlocked • Security Unlocked
Summary • eVC++ 3.0 to target Smartphone 2002 • Design your user interface • Left menubar is default action • Spinners • Expandable Edits • Keep as simple as possible • Your application may need signing • Compact Framework is coming