Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

332 views

Published on

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

Published in: Technology
  • Be the first to comment

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

  1. 1. WSO2 IoT Server Implementing Device Gateway Pattern using Android Device & XBee Sumedha Rubasinghe Charitha Goonetilleke June, 2017
  2. 2. 2 Solution Overview NEXBOX A95X XBee on USB explorer Arduino with XBee shield Relay module
  3. 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. 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. 5. WSO2 Android Agent on Android TV Box 5
  6. 6. WSO2 IoT Platform 6 Device Instance Details Page
  7. 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. 8. WSO2 IoT Platform 8 Sending Video URL to a remote TV box
  9. 9. WSO2 IoT Platform 9 Sending message to a remote TV box
  10. 10. WSO2 IoT Platform 10 Control messages to XBee module connected to TV box
  11. 11. WSO2 IoT Platform 11 Adding an edge XBee device (name,serial #)
  12. 12. WSO2 IoT Platform 12 Newly added edge device Light bulb with control operations ON/OFF
  13. 13. WSO2 IoT Platform 13
  14. 14. Edge Computing with Siddhi + Android 14 WSO2 Android Agent WSO2 Siddhi
  15. 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. 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. 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. 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
  19. 19. THANK YOU wso2.com

×