I presented a session at TechEd yesterday called “Windows Embedded: From Sensors to Servers” – the session was based around the Beckhoff CE 6.0 hard real-time wobbly stick demo. The demo is much more than just proving the real-time capability of CE 6.0, there are a number of components to the demo.
- CE 6.0 hard real-time, this is the core of the demo, showing that CE 6.0 is a real-time operating system. The real-time controller is also responsible for logging data from the system, this is fairly typical in many industrial/manufacturing scenarios. The data is not logged locally on the real-time controller, instead the controller uses DPWS to find a suitable server and then throw data at the server for logging.
- Windows Embedded Server 2008 – The server is running Windows Embedded Server 2008, additional services include SQL Server (for logging the real-time data), DPWS to expose the logging service, and IIS which is a Silverlight host that enables client PCs on the same network to get a “remote view” of the real-time demo.
- Windows Embedded Standard – This is being used as the local HMI panel to monitor/control the real-time demo. The panel application gives an operator the ability to change the way the wobbly stick is working. The application that’s running on Windows Embedded Standard looks like its a C# WinForms application which runs on top of the Windows Explorer Shell. This could of course be a WPF application that boots/runs instead of the Explorer Shell. This would be a simple, but useful extension to the existing demo.
- Windows Desktop PC – There’s a desktop PC running as part of the demo, this is using Internet Explorer to run a Silverlight 2.0 application “In Browser”. The Silverlight application gives the user a view of the data stored in the Windows Embedded Server.
One of the questions that came up in the session yesterday was whether it’s possible to host the Silverlight Web Application on Windows CE – Let’s take a look at whether this is possible.
Q: Where does a Silverlight 2.0 application run?
A: In the client browser – NOT on the Web Server.
Q: What is the Silverlight 2.0 application?
A: A .XAP file produced by Microsoft Expression Blend 2.0 (Designer) and Visual Studio 2008 (Developer).
Windows Embedded CE 6.0 supports an HTTPD Web Server that can host HTML files and support files (JPG, BMP, TIFF, PNG, ActiveX controls [that must be registered on the Windows CE server]).
Supporting a Silverlight application only requires that you have the appropriate HTML file, and the .XAP file in the appropriate place on your Windows CE operating system image.
The operating system only needs the Web Server component (SYSGEN_HTTPD) as a dependency for running/hosting the Silverlight 2.0 application.
Adding the HTTPD Web Server to your operating system image will create a folder called \Windows\www\wwwpub – this is the folder that you will need to place your HTML and .XAP file(s).
To prove this works I took a shortcut…
- Build an emulator image that supports the HTTPD Web Server (SYSGEN_HTTPD)
- Include networking utilities in the o/s (SYSGEN_NETUTILS) [so you can get the IP address of the Windows CE image]
- Create a (super simple) Silverlight 2.0 application in Expression Blend
- Built the (super simple) Silverlight 2.0 application (this produces the .XAP file)
- Run/Test the Silverlight 2.0 application on your desktop PC, this will run the ASP.NET Development Server and launch a test web page to show the Silverlight project running
- The test HTML doesn’t get stored anywhere, so with the Web Browser open, tap the ALT key on your keyboard to bring up the IE menu.
- Select View | Source
- Copy the source to Notepad, and save to your hard drive as “SLDemo.html” (or whatever you want to call it).
- Now the interesting part… Use the Remote File Viewer from Platform Builder to connect to your running Windows CE operating system image
- Browse the Remote File Viewer to \Windows\www\wwwpub – Now copy the SLDemo.html and XAP file to the \Windows\www\wwwpub folder.
- On your desktop PC browse to the IP address of your Windows CE target, for example… http://10.10.1.2/SLDemo.html
Voila! – You are now viewing the Silverlight Application, hosted by the Windows Embedded CE 6.0 Web Server.