Il Micro Framework è una versione ultra-ridotta del Framework.NET per piccole CPU a 32 bit dove è lo stesso CLR a fungere da pseudo sistema operativo.
La chiave di svolta del Micro Framework è di poter utilizzare C# per scrivere applicazioni che girano su un hardware totalmente indipendente, di bassa potenza e dalle funzionalità molto elevate.
Basti solo pensare alla possibilità di pubblicare un servizio WCF, oppure chiamare un servizio WCF esterno, o ancora scrivere la UI con una mini versione di WPF (priva di xaml) o ancora accedere liberamente alle periferiche hardware senza bisogno di driver.
Il mondo delle periferiche è tutto sotto controllo: USB (client e host), RS232, Schede SD, monitor, CanBus, ZigBee, etc. etc.
Durante la sessione scopriremo quanto l'hardware non faccia più paura in questo mondo, e sia abbordabile da chiunque provenga della programmazione software.
Scoprire il Micro Framework con C# (Raffaele Rialdi)
1. Raffaele Rialdi Twitter: @raffaeler Email:malta@vevy.com Articoli e codice: http://www.iamraf.net Blog:http://blogs.ugidotnet.org/raffaele Profilo MVP:https://mvp.support.microsoft.com/profile/raffaele Scoprire il Micro Frameworkcon C#
2. Il mondo dei device Ieri PC Full Windows Apparati industriali Windows Embedded / CE PDA, Cellulari Windows CE Piccole schede Micro Framework Domani PC Full Windows Apparati industriali Windows Embedded / CE PDA, Cellulari Full Windows vNext (SoC) Piccole schede Micro Framework
3. Caratteristiche dell'hardware Circa 256K di RAM, 512K di ROM WinCE è intorno ai 10MB RAM / 10MB ROM CPU 32 bit tipicamente tra 27 e 100MHz ARM 7 in poi, Analog Devices Blackfin, Renesas SH2/SH2A Memory Management Unit non necessaria … Porting Kit!
4. Caratteristiche del MF Nasce nel 2001 dal progetto "Smart Personal Object Technology" (SPOT) usata per gli orologi MSN Codebase indipendente da CF o fx.net Open source http://netmf.codeplex.com Subset del full fx.net Il runtime del CLR interpreta il codice IL Pieno controllo delle periferiche hardware Supportato da VS2010 (anche express) Wizard, emulatore, esempi, help Tool diagnostici e conversione font truetype
5. Architettura HTTP(S) Managed Application Application Services SDK SSL DPWS XML Parser Advanced Graphics Managed Libraries Threading Collections Sockets Reflection USB client I/O: USB, UART, SPI, I2C Basic Graphics Porting Kit (PK) Security File System Touch Panel Managed Run-Time CLR, Interpreter, Executive, and Interop PAL – Platform Abstraction Layer approximately 40 functions (preferred)HAL - Hardware Abstraction Layer approximately 60 functions (optional)Host OS Hardware
7. Librerie – Supporto Base Suddivise tra i namespace System.* e SPOT.* ArrayList (unica collection), Hashtable, Queue, Stack XmlWriter, XmlReader, XmlTextReader Thread, Timer, AutoResetEvent, … Reflection IO: File, streams, SerialPort Crypto API GC, delegate, AppDomain, String, Uri, WeakReference, …
8. Librerie - Hardware Microsoft.SPOT.Hardware Battery, PowerState, PowerEvent, SleepEvent Cpu I2CDevice Port, InputPort, OutputPort, InterruptPort, TristatePort SPI Watchdog, WatchdogEvent Microsoft.SPOT.Hardware.UsbClient SDK Specifici dei produttori OEM. Per es. GHI Electronics: CAN, PWM, RealtimeClock, OneWire USB client (mouse, kbd, …), USB host (mouse, kbd, …) …
9. Librerie – User Interface Implementa WPF! (versione super-ridotta) Niente XAML o binding, solo API essenziali Microsoft.SPOT.Presentation Controlli Border, Canvas, Image, ListBox, Panel, ScrollViewer, StackPanel, Text, … No Button:http://www.nielsderdaele.be/post/2010/10/12/WPF-Based-Touch-Button-for-NET-Micro-Framework-41.aspx Disegno Brush, Color, Pen, ImageBrush, DrawingContext, … Ellipse , Line, Polygon, Rectangle, Shape Touch Ink, Touch, TouchEvent, TouchPanel, InkCanvas Event routing e input providers
10. Librerie - Network Network: Socket HttpWebRequest, HttpWebResponse and HttpListener Esistono esempi di Webserver pronti all'uso HTTP/1.1 compreso chunking e keep-alive SSL con certificati X.509! Transport: 802.11 [WiFi] supportato (necessita di supporto sdk OEM) 802.15.4 [ZigBee] implementato ma ancora non documentato
11. Librerie - DPWS Implementa WCF (Device Profile for Web Services)! Può essere client o server Implementa WS-Discovery Generazione proxy con MFSvcUtil Implementazione ridotta: http://msdn.microsoft.com/en-us/library/ee435399.aspx Solo Http binding WSDL 1.1, SOAP 1.2, WS-Addressing, WS-MetadataExchange, WS-Transfer, WS-Discovery, WS-Eventing
12. C# nel Micro Framework Non implementati: Generics Linq Workaround:http://blogs.oberon.ch/tamberg/2009-02-06/implementing-linq-on-the-dotnet-mf.html Expression trees anonymous types partial classes nullable types tipi puntatori (e.g. IntPtr) supporto limitato per unsafe code blocks Solo unsafe/fixed in un numero di casi limitati e su array custom attributes
13. Real-world samples http://www.tinyclr.com/ by GHI http://www.netduino.com/projects/ by Netduino Micro Framework sources (+ contributions) by NetMF team http://netmf.codeplex.com/documentation
14. Votate le feature perla prossima release! http://netmf.codeplex.com/ Login via LiveId Issue Tracker Votate! REST: http://netmf.codeplex.com/workitem/751 Generics: http://netmf.codeplex.com/workitem/750 Video Streaming: http://netmf.codeplex.com/workitem/749 Il team del Micro Framework legge tutte le richieste È possibile collaborare al source tree ufficiale (direttamente sul TFS di codeplex)
15. Domande ? Uno grazie speciale a Lorenzo Tessiore e Zach Libby del team di Micro Framework per la disponibilità e i suggerimenti