Upload
ghassen-chaieb
View
45
Download
0
Embed Size (px)
Citation preview
Building Blocks for Smart Applications
Présenté par Ghassen Chaieb
Ready-to-use Building Blocks!Why spend hours trying to understand a protocol or piece of hardware? Others may have already done the work for you,
Inside Reactive Blocks you will find a comprehensive library of building blocks ready-to-use in your application
Reactive Blocks is a professional tool to build robust IoT
applications: Simpler, faster and safer.
Reactive Blocks is an plugin
How Reactive Blocks Works:
1. Discover existing
building blocks.
2. Build your application by combining the
blocks.
3. Deploy the automatically built
application package.
Building Blocks for EverythingsAnything that can be writtenin code, can be encapsulated in a block. A block can represent a component, a function, parts of a system or a protocol.
Building blocks are available for many IoT standards, like MQTT, Kura, CoAP, Modbus and OPC UA.
Building Blocks are Similar to APIsIn addition they contain a behavioral contract. This contract covers information about the sequence in which parameters must be provided, when parameters are expected and simple but effective timing information. The contracts ensures that building blocks are used and reused correctly.
Make Applications from Building Blocks
You can use blocks from existing libraries by simply dropping them into a new application.
Applications are Structured in a Hierarchy of Building BlocksApplication
Blocks
SubBlock
Analyze Applications AutomaticallyThe automatic analysis finds intricate design errors that a normal compiler cannot find. With the analysis, you can detect deadlocks, errors in synchronizations, race conditions and other behavior you did not think of. The analysis runs automatically on all building blocks, without any extra effort.
Compile Executable Code from the Building BlocksThe compiler generates complete and executable applications from the building blocks. Again, this works completely automated, and you don't have to change anything in the generated code. The resulting code is event-driven and highly concurrent by construction, and runs efficiently.
Building blocks The complete application
InstallationReactive Blocks is an plugin, so installing it means installing a JDK (Java Developer Kit), then Eclipse and then Reactive Blocks.
To download or share building blocks and build applications, you will also need to register.
Step 1: Install Java
Step 2: Install Eclipse
Step 3: Install Reactive Blocks In Eclipse, select Help / Eclipse Marketplace... The Marketplace Wizard should open. Search for "Reactive Blocks" Click on Install
The Marketplace Wizard will ask you for the features to install:
By default, only the required Reactive Blocks base feature is selected. It allows you to build code on Java SE. In case you already know that you want to develop for OSGi or Eclipse Kura, select these features as well. If you are not sure, just install the required base feature.
Step 4: Restart EclipseAfter the installation, restart Eclipse
Open the Reactive Blocks: Window → Open Perspective → Other... → Reactive Blocks
Further Steps
• Import Examples or Reference Systems.
• Have a look at the Tutorials within the Documentation.http://reference.bitreactive.com/tutorials/http://reference.bitreactive.com/
• Read Essentials: Reactive Blocks in a Nutshell. http://reference.bitreactive.com/reference/essentials.html
Getting Started
Tutorial: Take a SelfieThis tutorial explains how to import, extend and run the example Selfie. This example uses speech synthesis to let you know when the picture will be taken so that you are preparedStep 1: Import the ExampleThe example is called (Level 1) Getting started: Take a Selfie and you can import it from within Reactive Blocks.• The imported project (Level 1) Getting started: Take a Selfie can be found within
tabProjects within the Blocks view to the left.• Double-click on the block Selfie Basic to open it.
Step 3: Build the Application
Before you can start the application, you need to generate it's code:• Right-click on the block Selfie Basic in the Blocks View to show the
menu.• Select Build → Select Build Target Platform …• In the platform dialog, select Java Standard Edition - J2SE as platform.• In the parameter dialog, leave the default values.• After the generation, the Package Explorer View will open with a new
project, called com.bitreactive.tutorial.selfie.selfiebasic_exe.
It should look something like this:
• This _exe project is a pure Java project, not dependent on anything from Reactive Blocks.• The generated code is based upon the graphical specification of
concurrent behavior and the java code within operations.• In principle, you may alter code in this project as you want. Just notice
that every time you build the system again, these changes are overwritten.
Step 4: Start the Application:• Since the application uses speech synthesis: Turn up your volume!• Right-click on file SelfieBasic.launch in the generated _exe project• Select Run As → 1 SelfieBasic
Step 5: Extend the Application• Once the example is running, you may change it, just to play with
it. For example:• Save the taken picture to disk:• Drag and drop the block Image To JPEG (from the Camera and
utilities library) into the application block.• Add a fork and an activity edge to provide the added block with the taken
photo.• Give notice once the picture has been taken:• Add another instance of block Speak from the Speech (FreeTTS) library.• Add another operation, e.g. notice• Connect the new elements so that the user will be notified after the
picture has been taken.
To make sure that everything is fine, analyse the new system! Choose Analyze from the blocks context menu:
Analysis is a powerful tool fro automatic verification making sure that all involved blocks are used as intended.
Merci!