Atlas & Atlas Reactivity Engine Hands -on Session Mobile Computing - CNT 5517-5564

19
Atlas & Atlas Reactivity Engine Hands-on Session Mobile Computing - CNT 5517-5564 Dr. Sumi Helal Professor Computer & Information Science & Engineering Department University of Florida, Gainesville, FL 32611 [email protected]

description

Atlas & Atlas Reactivity Engine Hands -on Session Mobile Computing - CNT 5517-5564. Dr. Sumi Helal Professor Computer & Information Science & Engineering Department University of Florida, Gainesville, FL 32611 [email protected] . Agenda. Demo Knopflerfish Atlas Middleware - PowerPoint PPT Presentation

Transcript of Atlas & Atlas Reactivity Engine Hands -on Session Mobile Computing - CNT 5517-5564

Page 1: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Atlas & Atlas Reactivity Engine Hands-on Session

Mobile Computing - CNT 5517-5564

Dr. Sumi HelalProfessor

Computer & Information Science & Engineering DepartmentUniversity of Florida, Gainesville, FL 32611

[email protected]

Page 2: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Agenda• Demo

– Knopflerfish– Atlas Middleware– Atlas Emulators– KitSampleApp– Atlas Reactivity Engine

• Atlas Service API– AtlasService & AtlasClient Interface– KitSampleApp Code Study

• ARE Code Review• Q&A

Page 3: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

DEMO

Page 4: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Project Set Up

• Install Knophlerfish OSGi (Version 1.3.5)– http://www.knopflerfish.org/download.html#1.3.5

• Install Atlas middleware– http://www.icta.ufl.edu/atlas/

• Install Atlas Device Emulators– http://www.icta.ufl.edu/atlas/emulator/

• Atlas demo application

• Install Atlas Reactivity Engine– http://www.icta.ufl.edu/atlas/are/

(You may find all the links in http://www.icta.ufl.edu/atlas/)

Page 5: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Install Knophlerfish

• Download and install.• After installation, launch

the Knopflerfish OSGi framework by double clicking the executable JAR file “framework.jar” or typing “java –jar framework.jar” in the command line.

• The OSGi window (right) will pop up.

Page 6: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Install Atlas Middleware

• Install the middleware bundles. Click FileOpen Bundles in the OSGi menu

• Launch all middleware bundles• Bundles reside in the directory:

…\AtlaSoft-1.5 clean\AtlaSoft-1.5 copy\atlas\

Page 7: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Install Atlas Device Emulators

• Device emulators include:- DigitalContactSensorEmulator- HS322ServoEmulator- HumiditySensorEmulator- InterlinkPressureSensorEmulator- TemperatureSensorEmulator

• Install and launch• The GUI for the emulators is

shown (right)

Page 8: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Atlas Demo ApplicationKitSampleApp.jar is an Atlas demo application (bundle) that will use the device services provided by the emulator bundles.

- Install the Atlas Kit Sample Application bundle. Click FileOpen Bundles in the OSGi menu, launch KitSampleApp.jar.

- The GUI for the kit sample application (right). Note that devices are shown as offline if their corresponding service bundles have not yet been activated

Page 9: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Atlas Demo Application

• Customize sensor measurements. Readings and the sampling rate of the

Pressure sensor can now be customized using the GUI interface. User can

change their values by either sliding the slider or typing in a value in the text box.

Once changes are applied by pressing the update button, they will be reflected in

the application window.

• Maneuvering servos. Controlling the servo is the other way around since it is an

actuator. Users issue “move servo” command from the application window and

specify a turning angle by sliding the slider. The servo emulator will virtually turn

the angle and shows the current position.

• Uninstall emulators. Uninstalling emulators is easy. Just click on the close button

on the emulator window. The bundle will be ejected from the OSGi automatically.

And the device icons on the application will return to offline.

Page 10: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Install Reactivity Engine • Find the engine in:

…\AtlasRE\ATLAS RE REFERENCE IMPLEMENTATION\src\AtlasReactivityEngine10\jars\ReactiveEngine.jar

• Install and launch Atlas Reactivity Engine. The GUI for it will pop up immediately.(Right)

Page 11: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Reactivity Engine Code Review

• An OSGi bundle is basically like a normal Java application instantiated by an Activator class.

• Each bundle have its own Activator which links the application into OSGi.

• Reactivity Engine is implemented as an OSGi bundle as well.

• Our job mainly focuses on the .java file “KitSampleApp.java”

Page 12: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

ATLAS Service API*

* http://www.icta.ufl.edu/atlas/emulator/AtlasDev_Javadocs/doc/

Page 13: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Atlas Service

• Atlas Service– Providing basic Atlas Service Functions such as sensor data

subscription & delivery– A base class (interface) for developers to extend and build their own

Atlas device services, e.g. temperature sensor, sensor emulators. – Two versions (package: com.pervasa.atlas.dev.service)

• Interface AtlasService• Class AtlasServieClass

– Key methods:• DataHandler(String, String)• subscribeToSensorData(AtlasClient)• unsubscribeToSensorData(AtlasClient)• getData(AtlasService) -> getSensorReading(AtlasClient) *

Page 14: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Atlas Client

• Atlas Client– An interface implemented by applications require

sensor data from the Atlas network– For example, KitSampleApp and ARE are Atlas

Clients.– package: com.pervasa.atlas.dev.service– Key methods:

• ReceivedData(String, Properties)

Page 15: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Push & Pull APIs• Push

• PullEmulator Method name

ContactSensor void getContactReading(AtlasClient ac)

InterlinkPressure void getPressureReading(AtlasClient ac)

Humidity void getSensorReading(AtlasClient ac)

Temperature void getSensorReading(AtlasClient ac)

Method namevoid subscribeToSensorReading(AtlasClient ac)void unsubscribeToSensorReading (AtlasClient ac)void ReceivedData (AtlasClient ac)

Page 16: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

CODE REVIEW

Page 17: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Command Interpreter

• LIST: list all the basic events, basic actions, user-defined events, user-defined actions and rules.

• BASIC: list all the basic events, basic actions.• DEFINE: used to define event, condition

– Define atomic event:

DEFINE event e1=ref_ID (range)- Define composite event:

DEFINE event e2=e1+e2*e3- Define action:

DEFINE action a1=ref_ID(range)

Page 18: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Command Interpreter

• DEFINE: used to define event, condition– Define condition:

DEFINE condition c1=true (or false)– Define rule:

DEFINE rule r1=e1,c1,a1

• RUN• STOP

Page 19: Atlas  & Atlas Reactivity  Engine Hands -on Session Mobile Computing - CNT 5517-5564

Q & A