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.
Precise and Complete Requirements? An Elusive Goal
Powering a live escape game with ecf and efxclipse
1. Powering a Live Escape Game
with ECF and e(fx)clipse
Building a bomb disarming simulation
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. 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. Fingerprint Scanner
Touch Sensor (FSR)
Magnetic Sensor
(Reed)Magnet
“Fingerprint Scanner”
int c = Character.getNumericValue(System.getProperty("java.version").charAt(0));
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. 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. 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. 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. 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. 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. 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. • 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. 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. 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. 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. 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. 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));
20. UI Design in SceneBuilder
int cable1 = b - c - e;
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. 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. Project Wizard Options
e4 FX Application FX-OSGi Application
• with Eclipse DI
int b = Double.valueOf(System.getProperty("java.class.version")).intValue();
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. Hint Display
Application to show the game time and hints in case the
players are stuck
int cable1 = b - c - e;
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;
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
Simple logic, like “turn on the red light, when the touch sensor is pressed but the magnetic sensor is off” can be implemented on the device directly. But often enough, this information needs to be accessible remotely. Let’s take a step back and look at the big picture.
Simple logic, like “turn on the red light, when the touch sensor is pressed but the magnetic sensor is off” can be implemented on the device directly. But often enough, this information needs to be accessible remotely. Let’s take a step back and look at the big picture.
7 Inputs
7 Outputs 5V
2 Relays (up to 20V)
No soldering!
Gadget: Sensors and actors
Application: Graphics and sounds
It’s a game, so an agile development approach is necessary. We want to be able to change this quickly:
Move services from one device to another
Introduce new services and/or new devices
Change the game logic
The distribution provider is responsible for the actual marshalling/serialization and network communication that takes place when a consumer invokes a method on a remote service
The discovery provider is responsible to publish, find and register remote services
Used the Ecore diagram editor to visualize the interface relationships. No EMF model is generated from this.
Used the Ecore diagram editor to visualize the interface relationships. No EMF model is generated from this.
Used the Ecore diagram editor to visualize the interface relationships. No EMF model is generated from this.
This Sniffer is used by the bomb monitor application
FX-E4 Application
This can potentially be a very media enabled application. JavaFX seems a no-brainer in this situation.
JavaFX + OSGi = e(fx)clipse
Bomb monitor application can be in different states, depending on the observed (sniffed) sensor states.
Bomb monitor application can be in different states, depending on the observed (sniffed) sensor states.
Used the Ecore diagram editor to visualize the interface relationships. No EMF model is generated from this.