O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Powering a live escape game with ecf and efxclipse

70 visualizações

Publicada em

During the talk I will show how we used Eclipse technologies to create software for an enhanced live escape game. To demonstrate the system I will show the core riddle of the game: a “bomb disarming simulation” where you physically need to cut the correct cables to disarm it, just like 007 in the movies. That is … if you can pass the fingerprint scanner to open the case!

The setup consists of a frontend built with e(fx)clipse which leverages JavaFX to create a cool “spy” look & feel. The disarming simulation itself uses the Raspberry Pi GPIO to talk to its sensors and actors. And of course you need an operator application to supervise the gameplay. The components use the ECF Implementation of OSGi remote services to communicate in a dynamic system of remote IoT gadgets and JavaFX applications. The presentation will show how these components work together.

All the while the clock will be ticking and it will be up to you to pick up the hints and save the day!

The talk is targeted at enthusiasts who would like to leverage Eclipse technologies to create cool stuff in little time and with a small budget.

Publicada em: Software
  • Seja o primeiro a comentar

Powering a live escape game with ecf and efxclipse

  1. 1. Powering a Live Escape Game with ECF and e(fx)clipse Building a bomb disarming simulation
  2. 2. Live Escape Game • Played as a team • You must be physically present • You have 1 hour time • to solve a chain of puzzles Great place to use IoT technologies to create cool interactive puzzle gadgets! int a = LocalDate.now().getMonthValue();
  3. 3. Which cables need to be cut? Every cable has a unique number: 5 = ORANGE 15 = WHITE 30 = BLACK 40 = BLUE 50 = YELLOW Cut the correct cables to disarm the bomb! Java 8
  4. 4. Fingerprint Scanner Touch Sensor (FSR) Magnetic Sensor (Reed)Magnet “Fingerprint Scanner” int c = Character.getNumericValue(System.getProperty("java.version").charAt(0));
  5. 5. Bomb Gadget Hardware Sensors • Touch and magnetic sensors (fake “fingerprint scanner”) • Magnetic lid sensor (turn on lights, lock lid) • 5 Cables (disarm or detonate bomb) Actors • Fingerprint LEDs (red and green) – 5V (via Output) • Lid lock: electromagnet – 12V (via Relay) • LED lights – 12V (via Relay) int e = Integer.valueOf(System.getProperty("java.version").charAt(1)).intValue();
  6. 6. Simple Gadget Setup Hardware • Raspberry Pi 2 or 3 • PiFace Digital 2 (optional) • Sensors (Input) • Actors (Output) Software • Equinox gateway application • Pi4J library (API for PiFace) • ECF Remote Services int e = Integer.valueOf(System.getProperty("java.version").charAt(1)).intValue();
  7. 7. System Architecture Communication lines between all the components with OSGi remote services One Service for every Input (Sensor) and Output (Actor) Bomb Monitor Operator Tool Gadget 4Gadget 3Gadget 2 Bomb Gadget int d = LocalDate.now().getEra().toString().length();
  8. 8. What is an OSGi Service? To create an OSGi service: • Define the interface • Create interface implementation • Use DS to register the implementation • or BundleContext. registerService(…) int a = LocalDate.now().getMonthValue();
  9. 9. Register a Remote Service To turn a local service into a remote service register the service through the API (or use DS) with remote configuration properties int d = LocalDate.now().getEra().toString().length();
  10. 10. Remote Services Why I love OSGi remote services • Type safe development • Loosely coupled architecture • No central server (dependencies by design) • Dynamic (services may come and go) • Protocol independent • Easy testing through mocking int b = Double.valueOf(System.getProperty("java.class.version")).intValue();
  11. 11. ECF • Pluggable distribution providers (generic, r-osgi, JMS, MQTT, REST, …) • Pluggable discovery providers (Zeroconf, Etcd, Zookeeper, SLP, …) • Asynchronous remote services int c = Character.getNumericValue(System.getProperty("java.version").charAt(0));
  12. 12. • Goal: Quickly create new gadgets (or easily move Sensors and Actors between gadgets) •  A framework to easily create the gateway software int a = LocalDate.now().getMonthValue();
  13. 13. Gadget Service Architecture Every service has a unique name to identify it This Ecore diagram is used for presentation purposes only. No EMF model code generation … int cable1 = b - c - e; int d = LocalDate.now().getEra().toString().length();
  14. 14. Gadget Service Architecture Remote control This Ecore diagram is used for presentation purposes only. No EMF model code generation … int cable1 = b - c - e; int d = LocalDate.now().getEra().toString().length(); Information
  15. 15. Gadget Service Architecture Whiteboard Pattern This Ecore diagram is used for presentation purposes only. No EMF model code generation … int cable2 = e - a + d * d; int a = LocalDate.now().getMonthValue();
  16. 16. Sniffers Whiteboard Pattern • The sniffer is registered as a remote OSGi service • by the party that is interested in receiving change notifications • The gadget will pick up the service • and start sending notifications • if connect() returns true int c = Character.getNumericValue(System.getProperty("java.version").charAt(0));
  17. 17. Operator Tool Application for the operator of the game • Observe the state of the sensors and actors • Disable rogue sensors • Manually trigger actors • Manage game and timer • Display hints in case players are stuck int c = Character.getNumericValue(System.getProperty("java.version").charAt(0));
  18. 18. Operator Tool InputService OutputService IOSniffer • Registers Input- and OutputSniffers (Whiteboard Pattern) • Consumes Input- and OutputServices int d = LocalDate.now().getEra().toString().length();
  19. 19. Bomb Monitor Game Timer Reaction to Sensors Animations & Sound effects int d = LocalDate.now().getEra().toString().length();
  20. 20. UI Design in SceneBuilder int cable1 = b - c - e;
  21. 21. OSGi + JavaFX = OSGi + JavaFX • Equinox runtime • JavaFX UI • Eclipse DI • E(fx)clipse Core APIs (i.e. type safe EventBus) int b = Double.valueOf(System.getProperty("java.class.version")).intValue();
  22. 22. Consume OSGi Services 1. org.osgi.util.tracker. ServiceTracker API 2. Declarative Service (DS) Dependency 3. @Inject with Eclipse DI (not dynamic) 4. @Inject @Service with efxclipse (dynamic) 5. org.eclipse.fx.core.Util. lookupService(…) (ServiceUtil since 2.5) int e = Integer.valueOf(System.getProperty("java.version").charAt(1)).intValue();
  23. 23. Project Wizard Options e4 FX Application FX-OSGi Application • with Eclipse DI int b = Double.valueOf(System.getProperty("java.class.version")).intValue();
  24. 24. Game Service and Sniffer OSGi Services • Bomb Monitor registers InputSniffers to get informed of sensors state changes • Uses GameService internally when sniffed sensors change state • Registers GameService for remote use from the operator application • Consumes GameSniffers to inform them of game state changes Whiteboard Pattern int e = Integer.valueOf(System.getProperty("java.version").charAt(1)).intValue();
  25. 25. Hint Display Application to show the game time and hints in case the players are stuck int cable1 = b - c - e;
  26. 26. Hint Display Use GameService internally to create test controls (no need to fire up the operator to test the animations) int cable2 = e - a + d * d;
  27. 27. Operator Tool Consumes for DisplayServices and creates UI dynamically int cable2 = e - a + d * d;
  28. 28. Simulation Prototype Cut the correct cables to disarm the bomb! Every cable has a unique number: 5 = ORANGE 15 = WHITE 30 = BLACK 40 = BLUE 50 = YELLOW Java 8
  29. 29. DISARM IT!