SlideShare a Scribd company logo
Device Emulation with OSGi and Flash George Mesesan, MicroDoc GmbH
What is  Device Emulation ?
Device Emulation Your Device
Apple   iPhone   Emulator
Google   Android   Emulator
Nintendo   GameBoy   Emulator
SkiData   Turnstile   Emulator
Why  Device Emulation ?
deploy code test manually remote debugging
10  iPhone  Developers Total cost:  990$
10  Skidata  Developers * prices are purely fictive Total cost:  100.000$*
10  Skidata  Developers Distributed Team * prices are purely fictive Hardware Costs:  100.000$* Shipping Costs:   10.000$
Why  Device Emulation ? Save  Time Save  Money
How to do  Device Emulation ?
What is  a Device ?
iPhone  “Device” Display  Device GSM Modem  Device Audio  Device
Turnstile  “Device” Display  Device RFID  Device Lightsensor  Device Barcode  Device
Now, what about  OSGi and Flash ?
OSGi   inside Embedded  Software
Hardware Software OSGi  Bundles
Hardware Software OSGi  Bundles
Hardware Software OSGi  Bundles
Hardware Software OSGi  Bundles
 
HTTP TCP HTTPS ?
http://test.at/index.html ?action=something URL  Encoding HTTP
LoadVars  Object Object o = new  LoadVars (); o.id = 17; String myId = request. getParameter (“id");  HTTP
XML  Object XML < dataSet > < data > < id > 17 </ id > </ data > </ dataSet > s =  buildXMLObject () o =  parseXMLString () HTTP
XML  Sockets XML via Sockets TCP
Flash  Remoting Action Media Format HTTP/HTTPS
Our  Approach TCP XML  Sockets !
Emulator Framework
Framework  Features
Java  Flash  Communication XML  Sockets
Dynamic  Loading osgi>  start my.device.X
Programmable  Emulator Behavior Lightsensors RFID   Turnstile   Display
Programmable  Emulator Behavior Events  ,[object Object]
triggered by action Actions
Programmable  Emulator Behavior Events  ,[object Object]
triggered by action Actions XML
Emulator  Testing Framework actual  expected Lightsensor 1=on action event Lightsensor 2=on RFID read id=47111 Lightsensor 1=on Lightsensor 1=on RFID read id=47111 Display = “Hello” Display = “Hello” Turnstile = open Turnstile = open
Emulator  Testing Framework Lightsensor 1=on Lightsensor 1=on RFID read id=47111 Display = “Hello” Turnstile = open Testcase
Emulator  Testing Framework Do we really need a  GUI  ?
Emulator  Testing Framework NO !
Emulator  Testing Framework How do we  trigger tests  without a GUI ?
Emulator  Testing Framework
Overall  Testing  Picture
Overall  Testing  Picture Emulator Real Device
A Quality  Gate...  ...through,  continuous  and  automated  testing
Logging <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages <2009-17-06 13:12:14> INFO : Test : some log messages
Flash  Issues
Flash  Security   Sandbox
Flash  Local Connection
Flash  Debugging TypeError: ERROR #2007: child must be non-null at m.display   line 1050 ;
So, why use  Flash ?
Animation
Look &  Feel
SWT/ SWING Adobe Product line Labor  Market - Designer
But, what about  JavaFX ?
Open  Source ?
Skidata Freemotion Turnstile Turnstile VGA   Display Lightsensors Barcode Ticket Reader RFID Ticket Reader Live  Demo
Live  Demo !

More Related Content

Similar to Device Emulation with OSGi and Flash

Enterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersEnterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript Developers
AndreCharland
 
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS StudioCreate Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Guilhem Ensuque
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
Christian Heilmann
 
"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller
"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller
"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller
scottschiller
 
Web Application Hacking
Web Application HackingWeb Application Hacking
Web Application Hacking
SensePost
 
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
Hafez Kamal
 
Overcome your fear of implementing offline mode in your apps
Overcome your fear of implementing offline mode in your appsOvercome your fear of implementing offline mode in your apps
Overcome your fear of implementing offline mode in your apps
Marin Todorov
 
MoMo Oct Event
MoMo Oct EventMoMo Oct Event
MoMo Oct Event
momobangalore
 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
Christian Heilmann
 
Better watch your apps - MJ Keith
Better watch your apps - MJ KeithBetter watch your apps - MJ Keith
Better watch your apps - MJ Keith
m j
 
Building apps for multiple devices
Building apps for multiple devicesBuilding apps for multiple devices
Building apps for multiple devices
Terry Ryan
 
Teflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surface
Saumil Shah
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
davejohnson
 
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingJava Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Tal Melamed
 
Introduction to PhoneGap
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGap
Raymond Camden
 
Intro to Android Programming
Intro to Android ProgrammingIntro to Android Programming
Intro to Android Programming
Peter van der Linden
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
marpierc
 
Otto AI
Otto AIOtto AI
Mobile Development integration tests
Mobile Development integration testsMobile Development integration tests
Mobile Development integration tests
Kenneth Poon
 
Voicecon - Mashups with Tropo.com
Voicecon - Mashups with Tropo.comVoicecon - Mashups with Tropo.com
Voicecon - Mashups with Tropo.com
Voxeo Corp
 

Similar to Device Emulation with OSGi and Flash (20)

Enterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersEnterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript Developers
 
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS StudioCreate Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller
"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller
"Probably, Maybe, No: The State of HTML5 Audio" - Scott Schiller
 
Web Application Hacking
Web Application HackingWeb Application Hacking
Web Application Hacking
 
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
 
Overcome your fear of implementing offline mode in your apps
Overcome your fear of implementing offline mode in your appsOvercome your fear of implementing offline mode in your apps
Overcome your fear of implementing offline mode in your apps
 
MoMo Oct Event
MoMo Oct EventMoMo Oct Event
MoMo Oct Event
 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
 
Better watch your apps - MJ Keith
Better watch your apps - MJ KeithBetter watch your apps - MJ Keith
Better watch your apps - MJ Keith
 
Building apps for multiple devices
Building apps for multiple devicesBuilding apps for multiple devices
Building apps for multiple devices
 
Teflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surface
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingJava Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
 
Introduction to PhoneGap
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGap
 
Intro to Android Programming
Intro to Android ProgrammingIntro to Android Programming
Intro to Android Programming
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
Otto AI
Otto AIOtto AI
Otto AI
 
Mobile Development integration tests
Mobile Development integration testsMobile Development integration tests
Mobile Development integration tests
 
Voicecon - Mashups with Tropo.com
Voicecon - Mashups with Tropo.comVoicecon - Mashups with Tropo.com
Voicecon - Mashups with Tropo.com
 

Device Emulation with OSGi and Flash

Editor's Notes

  1. Welcome Words: Hello my name is _ and I work for MicroDoc in Munich Most of the time I work on embedded projects using OSGi as a runtime platform Today, I talk about Device Emulation with OSGi and Flash
  2. So, first of all. What is Device Emulation ? Emulated Devices are v irtual mobile devices that run on your computer
  3. There a lot of different emulators available like -&gt; NEXT SLIDE
  4. There a lot of different emulators available like -&gt; THE IPHONE EMULATOR
  5. Or, an EMULATOR for Google Android
  6. But not just for phones, but also for devices like a GAME BOY…
  7. Or an emulator for an ACCESS GATE
  8. Why is there a need for emulating devices ?
  9. THIS SLIDE: Consider the classical case developing software for embedded devices You have a laptop or a computer, where you develop the code Next, you have to deploy the code to the target environment Once, the code is deployed and your application is up and running you have to test it manually (in most cases) If you discover any bugs, and of course there will be some, you’ll have to start remote debugging. In order to reproduce the bugs, the device has to be setup into a certain state -&gt; which requires another couple of manual steps to do. Once you have found and fixed the bug. The new code has to deployed again and the whole game repeats. This is a very time consuming workflow !!! NEXT SLIDE: Beside time, there is another issue with embedded software development. Consider a team of 10 developer, where each developer needs one device for development
  10. If your team develops iPhone applications this might not be very expensive ….beside the fact of a two year contract… BUT: next slide
  11. If you develop applications for bigger embedded hardware, money can become an issue Like, for an ACCESS GATE from Skidata
  12. Now consider that you have a distributed team. Maybe even a worldwide distributed team, where developers are located in India or China Beside the hardware costs you have to add the shipping costs If your hardware is now as big as SKIDATA’s Access gate, the costs for shipping may explode
  13. So to sum up, by having Device Emulators you can: SAVE TIME,….and SAVE MONEY
  14. Now, let’s take a look at how we have done device emulation. All ideas &amp; implementations presented now, have been developed within a customer project for Skidata. The aim of the project was to develop an EMULATOR for the Access Gate that you have seen on the previous slides !
  15. Before we start to describe emulation I’d like to clarify the notation: What is a device ? The word “device” is general term and can mean anything A toaster can be called a “device” A washing machine can be called a “device” or A mobile phone can be called a “device” or And so on… What we now mean by device is the following -&gt; NEXT SLIDE
  16. Consider the iPhone “device” If we take a closer look at it, we see that the iPhone is assembled by several other devices Here we have: A Display device A GSM Modem device An Audio Device What we now mean by the word “device” is peace of hardware that has a very special purpose, like the GSM Modem.
  17. If we take a look the Access Gate “Device” we can identify the following real devices: Display Device RFID Device (for ticket scanning) Barcode Device (for ticket scanning) Lightsensor Device
  18. Now what about OSGi and Flash ?
  19. The special thing about the ACCESS GATE is that the embedded application running on the gate is based on OSGi &amp; Java As an embedded Java VM, we are using a ported version of IBM’s J9 Java Virtual Machine. The porting has been done by MicroDoc. As the OSGi runtime, we are using Eclipse Equinox
  20. Now, let’s take a deeper look into the embedded OSGi software solution. Here we have the two worlds of development: the Hardware side and the Software side On the one side we have hardware devices: For example: RFID reader, Turnstiles, Sensors,… And on the other side we have SW that controls the hardware. In other words these software devices are like “device drivers” On top of the devices we have a business application Each component in the architecture is represented by an OSGi bundle This design allows a simple approach for emulation
  21. In the emulator that we have build for Skidata, hardware devices are RFID Reader, Barcode Reader, Lightsensors, and so on.
  22. In order to emulate these hardware devices, we have to replace the software device by emulated devices.
  23. So there is no need for the hardware any more.
  24. Let’s look how we have implemented an “emulated device” Our device is split into two parts: Into a JAVA part that implements the device API, and Into a FLASH part that implements all graphical elements.
  25. The interesting thing now is, how does the Java part communicate with the Flash part ? Basically, there are 5 ways to communicate:
  26. The simplest way to communicate is by using URL Encoding: In order to communicate, you can send a URL with parameters encoded in strings. On the other side, you simply parse the request parameters and process them The drawback is that the URL request forces to load a response page, which means reloading the Flash session. So this approach is not suitable for our emulator.
  27. As an improvement over straight URL encoding, you can use a LoadVats object. It is still an asynchronous HTTP transmisson but without reloading the Flash Movie. However, asynchronous transmisson is also not suitable for an emulator that should react fast.
  28. The third approach to communicate is via XML Objects It works basically the same as with the loadVars object, but transmits XML objects instead of loadVar objects The sender has to build a String message, send it, and on the receiver side the String message has to be parsed again. Again, the request is an HTTP request with all its drawbacks.
  29. Instead of using an XML object through HTTP, you can use a XML-socket persistent connection This connection is ideal for fast-responding applications like games, or an emulator application The drawback is that you have to build and parse XML, which introduces some development overhead.
  30. All of the previous methods basically transfer string information. A more sophisticated approach is via Flash Remoting Flash Remoting is a binary protocol over HTTP or HTTPS The drawback of the remoting protocol is that it uses a proprietary format.
  31. We use XML socket because, We need a communication that allow fast responses, and Because we do not want to use proprietary formats.
  32. In the HW emulator a lot of special purpose devices need to be emulated Each Java and Flash part have to implement the communication layer/protocol via XML Sockets To simplify the development of new emulated devices we have implemented a framework that does most of the job
  33. We use XML socket because, We need a communication that allow fast responses, and Because we do not want to use proprietary formats.
  34. Framework Feature 1: The most important feature is the communication between the Java and the Flash part
  35. Framework Feature 2: OSGi is dynamic module system where bundles can be installed, started and stopped on runtime. Emulated Device are also OSGi bundles that can be started and stopped. However, the tricky part is to bring this dynamic loading mechanism into the world of Flash. Our framework supports dynamic loading of Flash components.
  36. Framework Feature 3: Consider the following use case with an access gate in a ski resort: A skier comes across The skier hides light-sensors The Skier’s RFID Ski-Ticket is read The application evaluates the Ticket The application shows something on the Display The application opens the turnstile So we have certain events (sensor events) and actions (application reactions) These are very common situations that you like to test very often By using the GUI of the emulator you’d have to manually trigger all events, and you have to verify the correct application response also manually !! By using our Emulator this tasks can be automated
  37. Framework Feature 3: What we now want to automate are the event triggers. Application responses, calls Actions here, happen on behalf of the application The emulator can now be programmed to trigger events Event can be triggered by time Or by action. This means if a certain action happens, a defined event is thrown.
  38. Framework Feature 3: The emulator behavior is represented by an XML file that is loaded into the simulator The language to write the behavior is in its current implementation very basic, but it might be of use to introduce e domain specific language for programming emulator behavior.
  39. Feature 4: The feature to automate the trigger of event is very useful, but we can get a step further: “ WHY NOT ALSO CHECK IF ACTIONS (THAT ARE APPLICATIONS RESPONSES IN FACT) ARE CORRECT ?” What we do is, we simply compare actual actions with expected actions.
  40. Executing a testcase includes the following steps: Write a test case Load a test case Execute that test case
  41. Do we really need a GUI ?
  42. Do we really need a GUI ?
  43. How do we trigger tests without a GUI ?
  44. In order to trigger the execution of emulator test cases, we ca use the eFitNesse testing framework. eFitnesse is a testing framework that allows the definition of test cases within a human-readable form: an excel sheet, a wiki page. Moreover, eFitnesse allows to execute test-cases on a remote embedded device.
  45. eFitnesse can trigger the testcases eFitnesse can be included in an automated build and test process.
  46. So with eFitnesse, testcases can be executed on the emulated and on the real device
  47. So what we get by using the emulators with the framework is a “A Quality Gate through, ...through, continuous and automated testing”
  48. This is not major feature, but to complete the feature list I want to mention it here: Logging is also supported by the framework – as well as for the Java side, but also on the Flash side.
  49. Using two different technologies to interoperate introduces some effort to get things working I’d like to point out some of the issues that we encountered.
  50. First, Flash has a security sandbox which restricts access. For example access to the local file system very limited. Moreover, a lot of security settings have to be made.
  51. A flash local connection can be used for communication between different flash files. Such connections have been used to implement the dynamic loading of the emulator flash parts The special thing is that a local connection has a machine-wide unique string id. Event if the same id is used in a completely different Flashmovie. Our solution was to dynamically generate such ids
  52. Flash Error Debugging: The picture on the slide shows a runtime error….. That occurred in line 1050. However, the class does only have 150 lines of code….so where did the error happen ??
  53. Now, you might be thinking…..”well, Flash is cool, but there are a lot of issues that need to be solved. Why shouldn’t I use Swing instead ?” Good question !
  54. The first reason to use Flash was: the excellent support of implementing Animations, like a turning turnstile, or a blinking traffic light.
  55. The second reason was: User Experience, or in other words Look &amp; Feel. With Flash you can build an relatively easy good looking GUIs I am sure that by using Swing or SWT you might also get good looking GUIs,…but
  56. …but if take a look at the labor market, we see that there is a huge number of developers and designers for the Adobe Product Line, and only few for SWT/SWING
  57. JavaFX does also a pretty good job concerning ANIMATION, and With JavaFX it is also possible to implement a great Look &amp; Feel BUT: JavaFX was simply not available when our project started.
  58. Is the framework open source: The answer is: No, not at the moment. But maybe in the future
  59. Now I want to show you the Skidata Emulator: Here you can see a picture of the device. The SKIDATA FREEMOTION TURNSTILE The Turnstile is assembled by couple of special purpose devices: Turnstile VGA Display Barcode Ticket Reader RFDI TicketReader
  60. I am now finished with my presentation. Are there any questions ? or comment ! ?