SlideShare a Scribd company logo
WSO2 IoT Server
Implementing Device Gateway Pattern using Android Device
& XBee
Sumedha Rubasinghe
Charitha Goonetilleke
June, 2017
2
Solution Overview
NEXBOX A95X
XBee on USB explorer
Arduino with XBee shield
Relay module
3
Device Gateway Pattern (N devices / 1 comm. module)
NEXBOX A95X
XBee on USB explorer
Arduino with XBee shield
Relay module
Device Gateway
Edge Devices
Communication
Module
Coordinator
4
Device Gateway Pattern
NEXBOX A95X
XBee on USB explorer
Arduino with XBee shield
Relay module
Device Gateway
Device1
Device2
Device3
Wireless
Communication
Module
Edge Device
WSO2 Android Agent on Android TV Box
5
WSO2 IoT Platform
6
Device Instance Details Page
WSO2 IoT Platform
7
Device in location X
Control operations on
Android TV Box
Control operation for
configuring XBee devices
Device Instance Details Page
WSO2 IoT Platform
8
Sending Video URL
to a remote TV box
WSO2 IoT Platform
9
Sending message to
a remote TV box
WSO2 IoT Platform
10
Control messages to
XBee module
connected to TV box
WSO2 IoT Platform
11
Adding an edge
XBee device
(name,serial #)
WSO2 IoT Platform
12
Newly added edge device
Light bulb with control
operations ON/OFF
WSO2 IoT Platform
13
Edge Computing with Siddhi + Android
14
WSO2 Android Agent
WSO2 Siddhi
@Plan:name('edgeAnalytics')
define stream edgeDeviceEventStream (ac int, window int, light int, temperature float, humidity float, keycard int);
@info(name = 'alertQuery') from edgeDeviceEventStream[(1 == ac or 1 == window or 1 == light) and 0 == keycard]
select ac, window, light insert into alertOutputStream;
@info(name = 'temperatureQuery') from every te1=edgeDeviceEventStream, te2=edgeDeviceEventStream[te1.temperature != temperature ]
select te2.temperature insert into temperatureOutputStream;
@info(name = 'humidityQuery') from every he1=edgeDeviceEventStream, he2=edgeDeviceEventStream[he1.humidity != humidity ]
select he2.humidity insert into humidityOutputStream;
@info(name = 'acQuery') from every ae1=edgeDeviceEventStream, ae2=edgeDeviceEventStream[ae1.ac != ac ]
select ae2.ac insert into acOutputStream;
@info(name = 'windowQuery') from every we1=edgeDeviceEventStream, we2=edgeDeviceEventStream[we1.window != window ]
select we2.window insert into windowOutputStream;
@info(name = 'keycardQuery') from every ke1=edgeDeviceEventStream, ke2=edgeDeviceEventStream[ke1.keycard != keycard ]
select ke2.keycard insert into keycardOutputStream;
Sample query
15
@Plan:name('edgeAnalytics')
define stream edgeDeviceEventStream (ac int, window int, light int, temperature float,
humidity float, keycard int);
@info(name = 'alertQuery') from edgeDeviceEventStream[(1 == ac or 1 == window or 1 ==
light) and 0 == keycard]
select ac, window, light insert into alertOutputStream;
@info(name = 'temperatureQuery') from every te1=edgeDeviceEventStream,
te2=edgeDeviceEventStream[te1.temperature != temperature ]
select te2.temperature insert into temperatureOutputStream;
@info(name = 'humidityQuery') from every he1=edgeDeviceEventStream,
he2=edgeDeviceEventStream[he1.humidity != humidity ]
select he2.humidity insert into humidityOutputStream;
Sample query
16
@info(name = 'humidityQuery') from every he1=edgeDeviceEventStream,
he2=edgeDeviceEventStream[he1.humidity != humidity ]
select he2.humidity insert into humidityOutputStream;
@info(name = 'acQuery') from every ae1=edgeDeviceEventStream,
ae2=edgeDeviceEventStream[ae1.ac != ac ]
select ae2.ac insert into acOutputStream;
@info(name = 'windowQuery') from every we1=edgeDeviceEventStream,
we2=edgeDeviceEventStream[we1.window != window ]
select we2.window insert into windowOutputStream;
@info(name = 'keycardQuery') from every ke1=edgeDeviceEventStream,
ke2=edgeDeviceEventStream[ke1.keycard != keycard ]
select ke2.keycard insert into keycardOutputStream;
Sample query
17
private void findSerialPortDevice() {
// This snippet will try to open the first encountered usb device connected, excluding usb root hubs
HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();
if (!usbDevices.isEmpty()) {
boolean keep = true;
for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
device = entry.getValue();
int deviceVID = device.getVendorId();
int devicePID = device.getProductId();
Log.d(TAG, "deviceVID: " + Integer.toHexString(deviceVID) + " devicePID: " +
Integer.toHexString(devicePID));
if (deviceVID == 0x0403 && devicePID == 0x6001) {
// There is a device connected to our Android device. Try to open it as a Serial Port.
requestUserPermission();
keep = false;
} else {
connection = null;
device = null;
}
Android to USB
18
THANK YOU
wso2.com

More Related Content

PDF
What’s New in WSO2 IoT Server 3.1.0
PPTX
WSO2 IoT Server and Device Cloud
PPTX
WSO2 IoT Server - Product Overview
PDF
An Introduction to WSO2 IoT Server - Charitha Goonetilleke
PDF
AN INTRODUCTION TO THE WSO2 IOT SERVER
PDF
5 cool things you can do with the WSO2 IoT Server
PPTX
The IoT Open Source World: Where WSO2 stands
PPTX
Connecting Heterogeneus IoT Technologies & Products
What’s New in WSO2 IoT Server 3.1.0
WSO2 IoT Server and Device Cloud
WSO2 IoT Server - Product Overview
An Introduction to WSO2 IoT Server - Charitha Goonetilleke
AN INTRODUCTION TO THE WSO2 IOT SERVER
5 cool things you can do with the WSO2 IoT Server
The IoT Open Source World: Where WSO2 stands
Connecting Heterogeneus IoT Technologies & Products

What's hot (20)

PPTX
Azure IoT End-to-End
PDF
WSO2Con ASIA 2016: WSO2 IoT Server: Your Foundation for the Internet of Things
PPTX
IoT on the Edge
PDF
OSGi Users' Forum Germany - Meeting Darmstadt 2014-04-14 - QIVICON
PPTX
Io t solutions world congress 2018 review Henk Jan van Wijk Conclusion Connect
PPTX
How to Join the Fiware IoT-Ready Programme
PDF
New Features for Mobile Device Management (MDM) With Entgra
PDF
FIWARE Overview of Generic Enablers
PDF
Training thethings.iO
PPTX
Azure IoT suite - A look behind the curtain (Sam Vanhoutte @AZUG Event)
PPTX
201410 1 fiware-overview
PPTX
Using FIWARE and Microsoft Azure for the development of IoT solutions
PPT
Io t idas_intro_ul20_nobkg
PPTX
Securing Access to SaaS Apps with WSO2 Identity Server
PPTX
Build 2017 - B8024 - Connected intelligent things with Windows IoT Core and A...
PDF
WSO2Con EU 2016: WSO2 IoT Server: Your Foundation for the Internet of Things
PPTX
Internet of things (IoT) with Azure
PPTX
Connecting IoT devices to Azure
PPTX
Building IoT Solutions using Windows IoT Core
PPTX
A Complete IoT Backend Infrastructure in FIWARE
Azure IoT End-to-End
WSO2Con ASIA 2016: WSO2 IoT Server: Your Foundation for the Internet of Things
IoT on the Edge
OSGi Users' Forum Germany - Meeting Darmstadt 2014-04-14 - QIVICON
Io t solutions world congress 2018 review Henk Jan van Wijk Conclusion Connect
How to Join the Fiware IoT-Ready Programme
New Features for Mobile Device Management (MDM) With Entgra
FIWARE Overview of Generic Enablers
Training thethings.iO
Azure IoT suite - A look behind the curtain (Sam Vanhoutte @AZUG Event)
201410 1 fiware-overview
Using FIWARE and Microsoft Azure for the development of IoT solutions
Io t idas_intro_ul20_nobkg
Securing Access to SaaS Apps with WSO2 Identity Server
Build 2017 - B8024 - Connected intelligent things with Windows IoT Core and A...
WSO2Con EU 2016: WSO2 IoT Server: Your Foundation for the Internet of Things
Internet of things (IoT) with Azure
Connecting IoT devices to Azure
Building IoT Solutions using Windows IoT Core
A Complete IoT Backend Infrastructure in FIWARE
Ad

Similar to WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBee (20)

PDF
Study and Development of Temperature & Humidity monitoring system through Wir...
PPTX
Building Hierarchy
PDF
WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11
PDF
communicate with instrument by using lan
PPTX
Android Things - The IoT platform from Google
PDF
Introducing the Sun SPOTs
PPT
RAHUL NASKAR IOT.ppt
PPTX
Generating cross platform .NET based azure IoTdevice
PDF
BooT-IoT: A Privacy-Aware Authentication Scheme for Secure Bootstrapping of I...
PPTX
Introduction to Node MCU
PPTX
IoT on Raspberry Pi
PPT
3 2--power-aware-cloud
PDF
How to Program SmartThings
PDF
Advanced View Arduino Projects List - Use Arduino for Projects-2.pdf
PDF
IRJET- Design and Implementation of IoT based Portable Outdoor Dust Density M...
PDF
PDF
How to write clean & testable code without losing your mind
PPTX
Tools and Techniques for Understanding Threading Behavior in Android*
PDF
DEVELOPING A REAL TIME DATA ACQUISITION , FLY-BY-WIRE COMMUNICATION SYSTEM FO...
PPTX
IoT with openHAB on pcDuino3B
Study and Development of Temperature & Humidity monitoring system through Wir...
Building Hierarchy
WIFI ESP01 interfacing with Arduino UNO with Sensor DHT11
communicate with instrument by using lan
Android Things - The IoT platform from Google
Introducing the Sun SPOTs
RAHUL NASKAR IOT.ppt
Generating cross platform .NET based azure IoTdevice
BooT-IoT: A Privacy-Aware Authentication Scheme for Secure Bootstrapping of I...
Introduction to Node MCU
IoT on Raspberry Pi
3 2--power-aware-cloud
How to Program SmartThings
Advanced View Arduino Projects List - Use Arduino for Projects-2.pdf
IRJET- Design and Implementation of IoT based Portable Outdoor Dust Density M...
How to write clean & testable code without losing your mind
Tools and Techniques for Understanding Threading Behavior in Android*
DEVELOPING A REAL TIME DATA ACQUISITION , FLY-BY-WIRE COMMUNICATION SYSTEM FO...
IoT with openHAB on pcDuino3B
Ad

More from WSO2 (20)

PDF
Demystifying CMS-0057-F - Compliance Made Seamless with WSO2
PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
PDF
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
PDF
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
PDF
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
PDF
Platformless Modernization with Choreo.pdf
PDF
Application Modernization with Choreo for the BFSI Sector
PDF
Choreo - The AI-Native Internal Developer Platform as a Service: Overview
PDF
[Roundtable] Choreo - The AI-Native Internal Developer Platform as a Service
PPTX
WSO2Con 2025 - Building AI Applications in the Enterprise (Part 1)
PPTX
WSO2Con 2025 - Building Secure Business Customer and Partner Experience (B2B)...
PPTX
WSO2Con 2025 - Building Secure Customer Experience Apps
PPTX
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
PPTX
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
PPTX
WSO2Con 2025 - Unified Management of Ingress and Egress Across Multiple API G...
PPTX
WSO2Con 2025 - How an Internal Developer Platform Lets Developers Focus on Code
PPTX
WSO2Con 2025 - Architecting Cloud-Native Applications
PDF
Mastering Intelligent Digital Experiences with Platformless Modernization
PDF
Accelerate Enterprise Software Engineering with Platformless
PDF
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
Demystifying CMS-0057-F - Compliance Made Seamless with WSO2
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
Platformless Modernization with Choreo.pdf
Application Modernization with Choreo for the BFSI Sector
Choreo - The AI-Native Internal Developer Platform as a Service: Overview
[Roundtable] Choreo - The AI-Native Internal Developer Platform as a Service
WSO2Con 2025 - Building AI Applications in the Enterprise (Part 1)
WSO2Con 2025 - Building Secure Business Customer and Partner Experience (B2B)...
WSO2Con 2025 - Building Secure Customer Experience Apps
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
WSO2Con 2025 - Unified Management of Ingress and Egress Across Multiple API G...
WSO2Con 2025 - How an Internal Developer Platform Lets Developers Focus on Code
WSO2Con 2025 - Architecting Cloud-Native Applications
Mastering Intelligent Digital Experiences with Platformless Modernization
Accelerate Enterprise Software Engineering with Platformless
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Electronic commerce courselecture one. Pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation theory and applications.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
Teaching material agriculture food technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
A Presentation on Artificial Intelligence
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Dropbox Q2 2025 Financial Results & Investor Presentation
Electronic commerce courselecture one. Pdf
NewMind AI Monthly Chronicles - July 2025
Encapsulation theory and applications.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
The AUB Centre for AI in Media Proposal.docx
Machine learning based COVID-19 study performance prediction
Mobile App Security Testing_ A Comprehensive Guide.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Teaching material agriculture food technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
A Presentation on Artificial Intelligence
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Network Security Unit 5.pdf for BCA BBA.

WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBee

  • 1. WSO2 IoT Server Implementing Device Gateway Pattern using Android Device & XBee Sumedha Rubasinghe Charitha Goonetilleke June, 2017
  • 2. 2 Solution Overview NEXBOX A95X XBee on USB explorer Arduino with XBee shield Relay module
  • 3. 3 Device Gateway Pattern (N devices / 1 comm. module) NEXBOX A95X XBee on USB explorer Arduino with XBee shield Relay module Device Gateway Edge Devices Communication Module Coordinator
  • 4. 4 Device Gateway Pattern NEXBOX A95X XBee on USB explorer Arduino with XBee shield Relay module Device Gateway Device1 Device2 Device3 Wireless Communication Module Edge Device
  • 5. WSO2 Android Agent on Android TV Box 5
  • 6. WSO2 IoT Platform 6 Device Instance Details Page
  • 7. WSO2 IoT Platform 7 Device in location X Control operations on Android TV Box Control operation for configuring XBee devices Device Instance Details Page
  • 8. WSO2 IoT Platform 8 Sending Video URL to a remote TV box
  • 9. WSO2 IoT Platform 9 Sending message to a remote TV box
  • 10. WSO2 IoT Platform 10 Control messages to XBee module connected to TV box
  • 11. WSO2 IoT Platform 11 Adding an edge XBee device (name,serial #)
  • 12. WSO2 IoT Platform 12 Newly added edge device Light bulb with control operations ON/OFF
  • 14. Edge Computing with Siddhi + Android 14 WSO2 Android Agent WSO2 Siddhi
  • 15. @Plan:name('edgeAnalytics') define stream edgeDeviceEventStream (ac int, window int, light int, temperature float, humidity float, keycard int); @info(name = 'alertQuery') from edgeDeviceEventStream[(1 == ac or 1 == window or 1 == light) and 0 == keycard] select ac, window, light insert into alertOutputStream; @info(name = 'temperatureQuery') from every te1=edgeDeviceEventStream, te2=edgeDeviceEventStream[te1.temperature != temperature ] select te2.temperature insert into temperatureOutputStream; @info(name = 'humidityQuery') from every he1=edgeDeviceEventStream, he2=edgeDeviceEventStream[he1.humidity != humidity ] select he2.humidity insert into humidityOutputStream; @info(name = 'acQuery') from every ae1=edgeDeviceEventStream, ae2=edgeDeviceEventStream[ae1.ac != ac ] select ae2.ac insert into acOutputStream; @info(name = 'windowQuery') from every we1=edgeDeviceEventStream, we2=edgeDeviceEventStream[we1.window != window ] select we2.window insert into windowOutputStream; @info(name = 'keycardQuery') from every ke1=edgeDeviceEventStream, ke2=edgeDeviceEventStream[ke1.keycard != keycard ] select ke2.keycard insert into keycardOutputStream; Sample query 15
  • 16. @Plan:name('edgeAnalytics') define stream edgeDeviceEventStream (ac int, window int, light int, temperature float, humidity float, keycard int); @info(name = 'alertQuery') from edgeDeviceEventStream[(1 == ac or 1 == window or 1 == light) and 0 == keycard] select ac, window, light insert into alertOutputStream; @info(name = 'temperatureQuery') from every te1=edgeDeviceEventStream, te2=edgeDeviceEventStream[te1.temperature != temperature ] select te2.temperature insert into temperatureOutputStream; @info(name = 'humidityQuery') from every he1=edgeDeviceEventStream, he2=edgeDeviceEventStream[he1.humidity != humidity ] select he2.humidity insert into humidityOutputStream; Sample query 16
  • 17. @info(name = 'humidityQuery') from every he1=edgeDeviceEventStream, he2=edgeDeviceEventStream[he1.humidity != humidity ] select he2.humidity insert into humidityOutputStream; @info(name = 'acQuery') from every ae1=edgeDeviceEventStream, ae2=edgeDeviceEventStream[ae1.ac != ac ] select ae2.ac insert into acOutputStream; @info(name = 'windowQuery') from every we1=edgeDeviceEventStream, we2=edgeDeviceEventStream[we1.window != window ] select we2.window insert into windowOutputStream; @info(name = 'keycardQuery') from every ke1=edgeDeviceEventStream, ke2=edgeDeviceEventStream[ke1.keycard != keycard ] select ke2.keycard insert into keycardOutputStream; Sample query 17
  • 18. private void findSerialPortDevice() { // This snippet will try to open the first encountered usb device connected, excluding usb root hubs HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList(); if (!usbDevices.isEmpty()) { boolean keep = true; for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) { device = entry.getValue(); int deviceVID = device.getVendorId(); int devicePID = device.getProductId(); Log.d(TAG, "deviceVID: " + Integer.toHexString(deviceVID) + " devicePID: " + Integer.toHexString(devicePID)); if (deviceVID == 0x0403 && devicePID == 0x6001) { // There is a device connected to our Android device. Try to open it as a Serial Port. requestUserPermission(); keep = false; } else { connection = null; device = null; } Android to USB 18