Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed...
Transcript of Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed...
![Page 1: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/1.jpg)
Keio USN with Sensor-Over-XMPP
TutorialTakuro Yonezawa Keio University
![Page 2: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/2.jpg)
Agenda• What is USN ? What is SOX ?
• Learning the Architecture
• Tools and libs developed by Keio Univ.
• Install libs and make the programs
• Java or Javascript
![Page 3: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/3.jpg)
What is• Virtual Sensor Network Infrastructure developed and
operated by Keio University HT Lab.
• Flexible, Scalable, Dependable and Secure
• based on Sensor-Over-XMPP by CMU
• Added feature of participatory sensing, cross-domain federation, etc.
• Various libraries and tools are also available.
![Page 4: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/4.jpg)
What is SOX?• Sensor-Over-XMPP (http://xmpp.org/extensions/inbox/
sensors.html)
• Using XMPP PubSub extension for sensor data publishing/subscribing
• Developed by Sensor Andrew Project in CMU
Anthony Rowe (CMU)
![Page 5: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/5.jpg)
XMPP ?• Extensible Messaging and Presence Protocol (XMPP)
• A communications protocol for message-oriented middleware based on XML
• Open standard and uses an open systems approach of development and application
• Specification: RFC 6120, 6121, 6122
★ Decentralization ★Open standards ★ History ★ Security ★ Flexibility
Strength Implementation✓ ejabberd (erlang) ✓ Openfire (java) ✓ etc..
![Page 6: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/6.jpg)
PubSub ?XMPP Server (MQTT server, etc..)
Event Nodes (alias:topic, channel)
economicnews
sportsnews
politicsnews
Publisher Subscriber
SubscribePubilsh
![Page 7: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/7.jpg)
Sensor Andrew• Using PubSub for sensor/actuator network
• Defining Virtual Sensor Node as the pair of meta node and data node
• Sensor-Over-XMPP(SOX) specification defines a payload format for communicating sensor and actuation information
meta node data node(ex. TestSensor_meta) (ex. TestSensor_data)
Virtual Sensor(ex. TestSensor)
TestSensor
Adapter
SOX libSubscribing
User
Sensor Data (via Subscribing)
Meta Data (getting cache)
Meta Data (only once sending)
Sensor Data (periodic sending)
![Page 8: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/8.jpg)
Meta-‐data Publish
XMPP Server
meta node data node
<iq type='set' to=‘pubsub.sox.ht.sfc.keio.ac.jp’ from=‘owner_of_a_sensor’ id='publish1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node=‘a_sensor_meta’> <item id='current'> <device xmlns='http://jabber.org/protocol/sox' name='mote' id='4d4335b0-4134-11e0-9207-0800200c9a66' type=‘outdoor_weather' <transducer name='current temperature' id='temp' canActuate='false' hasOwnNode='false' units='kelvin' unitScalar='0' minValue='270' maxValue='320' resolution=‘0.1'> <transducer name='current humidity' id='humid' canActuate='false' hasOwnNode='false' units='percent' unitScalar='0' minValue='0' maxValue='100' resolution='0.1'> </transducer> </device> </item> </publish> </pubsub></iq>
Meta publish (at sensor deployment step)
![Page 9: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/9.jpg)
Sensor data Publish
XMPP Server
<iq type='set' to=‘pubsub.sox.ht.sfc.keio.ac.jp’ from=‘owner_of_a_sensor’ id='publish2'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='a_sensor_data'> <item id='current'> <data xmlns='http://jabber.org/protocol/sox'> <transducerValue id='temp' typedValue='293.2' timestamp=‘2011-02-25T17:13:20Z'/>
<transducerValue id='humid' typedValue=’82.5’ timestamp='2011-02-25T17:13:20Z'/> </data> </item> </publish> </pubsub></iq>
meta node data nodedata publish (periodically)
![Page 10: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/10.jpg)
Tools and Libs• Available from http://sox.ht.sfc.keio.ac.jp
• Developed by Keio Univ.
• Online testing toolsVisualization Application (Dashboard, Live Earth!)
• Sensorizer - make web as sensors
• SOX Libraries (Java, objective-c, JavaScript, Python)
![Page 11: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/11.jpg)
Run the testing tool
1.Monitor the hogehoge node
2.Publish data
3.Check data will be shown in monitoring page
←check
←click
←click
←select
http://sox.ht.sfc.keio.ac.jp/tools/soxClient2.html
http://sox.ht.sfc.keio.ac.jp/tools/soxDataPublisher2.html
(1)
(2)
![Page 12: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/12.jpg)
Surfboard
![Page 13: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/13.jpg)
Live Earth!
![Page 14: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/14.jpg)
Hello, SOX ! with Java SOX Lib
![Page 15: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/15.jpg)
Hello, SOX!• Preparation: Install Java (>JDK7), eclipse
(recommend)
• Download JSoxLib.zip from http://sox.ht.sfc.keio.ac.jp
• Create new project in eclipse, import library of “JSoxLib.jar” and all jar file in “lib directory”.
• Run “example/subscribe.java”
![Page 16: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/16.jpg)
Create New Project
set project name
1.7 or more
then, finish
![Page 17: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/17.jpg)
Drag-to-Drop JSoxLib.jar and lib dir to created project
Then, you can see those files in the project
![Page 18: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/18.jpg)
(1)click (2)clickOpen Project Properties (3)click
Build Path Setting
![Page 19: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/19.jpg)
Add jar files
![Page 20: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/20.jpg)
Select all jar files
(1)click
(2)click
(3)click
![Page 21: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/21.jpg)
Drag-to-Drop example dir and src dir
Then, you can see those files in the project
![Page 22: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/22.jpg)
(1)open Subscribe.java
(2)click run command
![Page 23: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/23.jpg)
You can see raw XML communication for debugging
Message will be appear in your console
![Page 24: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/24.jpg)
Use test publish tool in “sox.ht.sfc.keio.ac.jp”-> ・Test Sensor-Data Publishing
(1)select hedgehog node
(2)click
Then, you can see the published data when Subscribe.java is running
Or You can run Publish.java
![Page 25: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/25.jpg)
SoxConnection con = new SoxConnection("sox.ht.sfc.keio.ac.jp", “YOUR_JID", “YOUR_PASSWORD", true);
SoxConnection con = new SoxConnection("sox.ht.sfc.keio.ac.jp", true);
Bind virtual sensor node in SOX to SoxDevice object
Connect to SOX sensor
As anonymous user
As registered user
SoxDevice soxDevice = new SoxDevice(con, "hogehoge");
Subscribe & register event listenersoxDevice.subscribe();soxDevice.addSoxEventListener(this);
![Page 26: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/26.jpg)
1. Create “test_yourname” sensor node by your JID
2. Publish meta information to the node by your JID
•set 2 transducers :temperature and humidity
3.Subscribe the node, and publish sensor data to the node by anonymous user
See Create.java
See Subscribe.java
See Publish.java
For more understanding..
You can also monitor your sensor node by online monitoring tool or dashboard
![Page 27: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/27.jpg)
Sensorizer• Make WEB page as Sensor
• Extracting data and send the data to PubSub node
• Checking the status via http://sensorizer.ht.sfc.keio.ac.jp:8888/list
• Monitoring the active sensor node by monitoring page
![Page 28: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/28.jpg)
WEB Sensorizer Usage Guide
ver.20140614
{jin, takuro}@ht.sfc.keio.ac.jp
Jin Nakazawa and Takuro Yonezawa
28
![Page 29: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/29.jpg)
Install• Install the Chrome Extension of Sensorize It! to Google Chrome• Sensorize It! can be downloaded from
https://www.dropbox.com/s/ys2nzvg6dwdywil/chrome.crx
After install the extension, you can see the menu
29
![Page 30: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/30.jpg)
Usage Process1. Create a virtual sensor device
2. Add sensors(we call transducers) to the virtual sensor device
3. Configure the information of the device and transducers
4. Sensorize !
Just 4 steps :)
30
![Page 31: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/31.jpg)
1. Create a virtual sensor device
(1) right click where the text is appropriate as sensor node name
(2) Select this menu
31
![Page 32: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/32.jpg)
1. Create a virtual sensor device
You can edit name of the device, also define location of the device
32
![Page 33: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/33.jpg)
2. Add transducers to the device
(1) right click where you want to add the sensor information as transducer
(2) Select this menu33
![Page 34: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/34.jpg)
3. Configure the information of the node and transducers
Define the transducer name and unit
lat&lon transducers are automatically added if you set the device’s location34
![Page 35: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/35.jpg)
4. Sensorize ! Click
Click
35
![Page 36: Keio USN with Sensor-Over-XMPP TutorialWhat is • Virtual Sensor Network Infrastructure developed and operated by Keio University HT Lab. • Flexible, Scalable, Dependable and Secure](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f08f38a7e708231d4248429/html5/thumbnails/36.jpg)
Architecture
(based on Sensor Andrew)Virtual Sensor Device (PubSub Node)
Subscribe App
App
App
App…
36