Merge branch 'release-3.0.x' of https://github.com/wso2/carbon-device-mgt-plugins into windows10

revert-dabc3590
Hasunie 8 years ago
commit 69ebf70484

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>iot-analytics</artifactId>
<version>3.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.iot.das.rest.api</artifactId>
<name>WSO2 Carbon - IoT Server REST API</name>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<executions>
<execution>
<id>generate-scr-descriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Private-Package>
</Private-Package>
<Export-Package>
</Export-Package>
<Import-Package>
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,42 @@
<%
/**
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
(function () {
response.contentType = 'application/json';
var action = request.getParameter("action");
var id = request.getParameter("id");
var type = request.getParameter("type");
var timeFrom = request.getParameter("timeFrom");
var timeTo = request.getParameter("timeTo");
var log = new Log();
var providerAPI = require('js/batch-provider-api.js');
if (action === 'getSchema') {
print(providerAPI.getSchema());
return;
} else if(action === 'getData'){
log.info('FromTime : '+timeFrom+', toTime: '+ timeTo);
print(providerAPI.getData(id, type, timeFrom, timeTo));
return;
}
}());
%>

@ -0,0 +1,150 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush;
(function () {
var PROVIDERS_LOCATION = '/extensions/providers/';
var PROVIDER_NAME = 'batch';
var TYPE = "type";
var TABLE_NAME = "tableName";
var HTTPS_TRANSPORT = "https";
var CONTENT_TYPE_JSON = "application/json";
var AUTHORIZATION_HEADER = "Authorization";
var USER_TOKEN = "user";
var TENANT_DOMAIN = "domain";
var CONST_AT = "@";
var USERNAME = "username";
var HTTP_USER_NOT_AUTHENTICATED = 403;
var JS_MAX_VALUE = "9007199254740992";
var JS_MIN_VALUE = "-9007199254740992";
var tableName = "ORG_WSO2_GEO_FUSEDSPATIALEVENT";
var typeMap = {
"bool": "string",
"boolean": "string",
"string": "string",
"int": "number",
"integer": "number",
"long": "number",
"double": "number",
"float": "number",
"time": "time"
};
var log = new Log();
var carbon = require('carbon');
var configs = require('/configs/designer.json');
var utils = require('/modules/utils.js');
var JSUtils = Packages.org.wso2.carbon.analytics.jsservice.Utils;
var AnalyticsCachedJSServiceConnector = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector;
var AnalyticsCache = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector.AnalyticsCache;
var cacheTimeoutSeconds = 5;
var loggedInUser = null;
if (configs.cacheTimeoutSeconds) {
cacheTimeoutSeconds = parseInt(configs.cacheTimeoutSeconds);
}
var cacheSizeBytes = 1024 * 1024 * 1024; // 1GB
if (configs.cacheSizeBytes) {
cacheSizeBytes = parseInt(configs.cacheSizeBytes);
}
response.contentType = CONTENT_TYPE_JSON;
var authParam = request.getHeader(AUTHORIZATION_HEADER);
if (authParam != null) {
credentials = JSUtils.authenticate(authParam);
loggedInUser = credentials[0];
} else {
var token = session.get(USER_TOKEN);
if (token != null) {
loggedInUser = token[USERNAME] + CONST_AT + token[TENANT_DOMAIN];
} else {
log.error("user is not authenticated!");
response.status = HTTP_USER_NOT_AUTHENTICATED;
print('{ "status": "Failed", "message": "User is not authenticated." }');
return;
}
}
var cache = application.get("AnalyticsWebServiceCache");
if (cache == null) {
cache = new AnalyticsCache(cacheTimeoutSeconds, cacheSizeBytes);
application.put("AnalyticsWebServiceCache", cache);
}
var connector = new AnalyticsCachedJSServiceConnector(cache);
/**
* returns an array of column names & types
* @param providerConfig
*/
getSchema = function () {
var schema = [];
var result = connector.getTableSchema(loggedInUser, tableName).getMessage();
result = JSON.parse(result);
var columns = result.columns;
Object.getOwnPropertyNames(columns).forEach(function (name, idx, array) {
var type = "ordinal";
if (columns[name]['type']) {
type = columns[name]['type'];
}
schema.push({
fieldName: name,
fieldType: typeMap[type.toLowerCase()]
});
});
// log.info(schema);
return schema;
};
/**
* returns the actual data
* @param providerConfig
* @param limit
*/
getData = function (deviceId, deviceType, fromTime, toTime) {
var luceneQuery = "timeStamp:[" + fromTime + " TO " + toTime + "]";
var limit = 100;
var result;
//if there's a filter present, we should perform a Lucene search instead of reading the table
if (luceneQuery) {
luceneQuery = 'id:"' + deviceId + '" AND type:"' + deviceType + '" AND ' + luceneQuery;
var filter = {
"query": luceneQuery,
"start": 0,
"count": limit
};
result = connector.search(loggedInUser, tableName, stringify(filter)).getMessage();
} else {
var from = JS_MIN_VALUE;
var to = JS_MAX_VALUE;
result = connector.getRecordsByRange(loggedInUser, tableName, from, to, 0, limit, null).getMessage();
}
result = JSON.parse(result);
var data = [];
for (var i = 0; i < result.length; i++) {
var values = result[i].values;
data.push(values);
}
return data;
};
}());

@ -0,0 +1,27 @@
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-div .ui_tpicker_unit_hide{ display: none; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dt{ float: right; clear: right; }
.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
/* Shortened version style */
.ui-timepicker-div.ui-timepicker-oneLine { padding-right: 2px; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,
.ui-timepicker-div.ui-timepicker-oneLine dt { display: none; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label { display: block; padding-top: 2px; }
.ui-timepicker-div.ui-timepicker-oneLine dl { text-align: right; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd,
.ui-timepicker-div.ui-timepicker-oneLine dl dd > div { display:inline-block; margin:0; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }

@ -0,0 +1,5 @@
/*! jQuery Timepicker Addon - v1.5.3 - 2015-04-19
* http://trentrichardson.com/examples/timepicker
* Copyright (c) 2015 Trent Richardson; Licensed MIT */
.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:0 10px 10px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0 0;border:0;margin:0;padding:0}.ui-timepicker-div .ui_tpicker_unit_hide{display:none}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}.ui-timepicker-div.ui-timepicker-oneLine{padding-right:2px}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,.ui-timepicker-div.ui-timepicker-oneLine dt{display:none}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label{display:block;padding-top:2px}.ui-timepicker-div.ui-timepicker-oneLine dl{text-align:right}.ui-timepicker-div.ui-timepicker-oneLine dl dd,.ui-timepicker-div.ui-timepicker-oneLine dl dd>div{display:inline-block;margin:0}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before{content:':';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before{content:'.';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{display:none}

@ -79,3 +79,9 @@
box-shadow: 0 5px 15px rgba(0,0,0,.5);
}
.ui-dialog .ui-dialog-title {
word-break: keep-all !important;
word-wrap: normal !important;
white-space: normal !important;
}

@ -102,7 +102,6 @@
<!-- Self javascript libraries (Order of the import is very important, changing the order might shadow some variables, append new script to bottom ) -->
<!-- ** comment out below imports if using minimized wso2_geo.min library ** -->
<script src="js/application_options.js"></script>
<script type="text/javascript">
function reformatRadius(val){
if(val != "" && !isNaN(val)){
@ -136,6 +135,11 @@
<div class="navbar-collapse collapse" style="display:inline-block;">
<ul class="nav">
<li>
<button id='realTimeShow' type="submit" class="btn btn-primary" style="display:none;" onclick='enableRealTime()'>Return to Real Time View</button>
</li>
</ul>
<ul class="nav navbar-nav-left">
<li class="hidden-xs"><a href="#left_side_pannel" data-uk-offcanvas>
<i class="fa fa-list" style="color: #FF9900"></i></a>
@ -240,7 +244,7 @@
<ul class="uk-nav-sub">
<li><a style="margin-left: 20%;" data-toggle="modal" href="/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/modals/speed_alert.jag"
data-target="#commonModal"><i class="fa fa-tachometer"></i> Speed alert</a></li>
<li><a style="margin-left: 20%;" data-toggle="modal" href="/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/modals/proximity_alert.jag"
<li id = "proximity_alert"><a style="margin-left: 20%;" data-toggle="modal" href="/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/modals/proximity_alert.jag"
data-target="#commonModal"><i class="fa fa-link"></i> Proximity alert</a></li>
<li><a style="margin-left: 20%;" data-toggle="modal" href="/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/modals/stationery_alert.jag"
data-target="#commonModal"><i class="fa fa-chain-broken"></i> Stationary alert</a></li>
@ -254,10 +258,6 @@
<ul class="uk-nav-sub">
<li><a style="margin-left: 20%;" data-toggle="modal" href="/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/modals/within_alert.jag"
data-target="#commonModal"><i class="fa fa-square-o"></i> Within</a></li>
<li><a style="margin-left: 20%;color: grey;cursor: not-allowed;"><i
class="fa fa-external-link-square"></i> Approaching</a></li>
<li><a style="margin-left: 20%;color: grey;cursor: not-allowed;"><i class="fa fa-minus"></i>
Cross</a></li>
</ul>
</li>
@ -722,7 +722,17 @@
<p id="information" class="bg-primary" style="margin: 0px;padding: 0px;"></p>
<h6>Speed<span class="label label-primary pull-right"><span id="speed"></span> km/h</span></h6>
<h6>Heading<span id="heading" class="label label-primary pull-right"></span></h6>
<button type="button" class="btn btn-info btn-xs" onClick="focusOnSpatialObject(document.getElementById('objectId').innerHTML);return false;">History</button>
<button type="button" class="btn btn-info btn-xs" onClick="focusOnSpatialObject(document.getElementById('objectId').innerHTML);return false;">Recent History</button>
<button type="button" class="btn btn-info btn-xs" onClick="popupDateRange();">Full History</button>
</div>
</div>
<div id="dateRangePopup">
<!--<h3 class="popover-title">ID <span id="objectId"></span></h3>-->
<div>
<label> From: <input id="timeFrom" type="text"> </label>
<label> To: <input id="timeTo" type="text"> </label>
<button type="button" class="btn btn-info btn-xs" onClick="focusOnHistorySpatialObject(document.getElementById('objectId').innerHTML, document.getElementById('timeFrom').value, document.getElementById('timeTo').value);return false;">Full History</button>
</div>
</div>

@ -82,7 +82,7 @@ function initializeMap() {
map = L.map("map", {
zoom: 14,
center:[51.548525, 0.111749],
center: [51.548525, 0.111749],
layers: [defaultOSM, defaultTFL],
zoomControl: false,
attributionControl: false,
@ -137,7 +137,7 @@ var attributionControl;
var groupedOverlays;
var layerControl;
function processAfterInitializationMap(){
function processAfterInitializationMap() {
attributionControl = L.control({
position: "bottomright"
});
@ -261,9 +261,10 @@ $('#searchbox').typeahead({
}).on('typeahead:selected', function ($e, datum) {
objectId = datum['value'];
focusOnSpatialObject(objectId)
});
});
var toggled = false;
function focusOnSpatialObject(objectId) {
console.log("Selecting" + objectId);
var spatialObject = currentSpatialObjects[objectId];// (local)
@ -302,6 +303,110 @@ function focusOnSpatialObject(objectId) {
}
var getProviderData = function (timeFrom, timeTo) {
var tableData;
$.ajax({
url: '/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/gadget-controller.jag?action=getData&id=' + deviceId + '&type=' + deviceType + '&timeFrom=' + timeFrom + '&timeTo=' + timeTo,
method: "GET",
contentType: "application/json",
async: false,
success: function (data) {
tableData = data;
}
});
return tableData;
};
function notifyError(message) {
$.UIkit.notify({
message: message,
status: 'warning',
timeout: ApplicationOptions.constance.NOTIFY_WARNING_TIMEOUT,
pos: 'bottom-left'
});
}
function enableRealTime() {
document.getElementById('realTimeShow').style.display = 'none';
spatialObject = currentSpatialObjects[selectedSpatialObject];
spatialObject.removePath();
spatialObject.marker.closePopup();
selectedSpatialObject = null;
clearFocus();
clearMap();
document.getElementById('objectInfo').style.display = 'none';
isBatchModeOn = false;
}
function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
if (!timeFrom) {
notifyError('No start time provided to show history. Please provide a suitable value' + timeFrom);
} else if (!timeTo) {
notifyError('No end time provided to show history. Please provide a suitable value' + timeTo);
} else {
document.getElementById('realTimeShow').style.display = 'block';
isBatchModeOn = true;
clearFocus(); // Clear current focus if any
clearMap();
var tableData = getProviderData(timeFrom, timeTo);
for (var i = 0; i < tableData.length; i++) {
var data = tableData[i];
var geoMessage = {
"messageType": "Point",
"type": "Feature",
"id": data.id,
"deviceId": data.id,
"deviceType": data.type,
"properties": {
"speed": data.speed,
"heading": data.heading,
"state": data.state,
"information": data.information,
"notify": data.notify,
"type": data.type
},
"geometry": {
"type": "Point",
"coordinates": [data.longitude, data.latitude]
}
};
processPointMessage(geoMessage);
}
var spatialObject = currentSpatialObjects[objectId];// (local)
if (!spatialObject) {
$.UIkit.notify({
message: "Spatial Object <span style='color:red'>" + objectId + "</span> not in the Map!!",
status: 'warning',
timeout: ApplicationOptions.constance.NOTIFY_WARNING_TIMEOUT,
pos: 'top-center'
});
return false;
}
selectedSpatialObject = objectId; // (global) Why not use 'var' other than implicit declaration http://stackoverflow.com/questions/1470488/what-is-the-function-of-the-var-keyword-and-when-to-use-it-or-omit-it#answer-1471738
console.log("Selected " + objectId + " type " + spatialObject.type);
if (spatialObject.type == "area") {
spatialObject.focusOn(map);
return true;
}
map.setView(spatialObject.marker.getLatLng(), 15, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
$('#objectInfo').find('#objectInfoId').html(selectedSpatialObject);
spatialObject.marker.openPopup();
if (!toggled) {
$('#objectInfo').animate({width: 'toggle'}, 100);
toggled = true;
}
getAlertsHistory(objectId);
spatialObject.drawPath();
setTimeout(function () {
createChart();
chart.load({columns: [spatialObject.speedHistory.getArray()]});
}, 100);
$('#dateRangePopup').dialog('close');
}
}
// Unfocused on current searched spatial object
function clearFocus() {
if (selectedSpatialObject) {

@ -29,6 +29,7 @@ var waitTime = 1000;
var webSocketURL, alertWebSocketURL, trafficStreamWebSocketURL;
var deviceId;
var deviceType;
var isBatchModeOn = false;
function processPointMessage(geoJsonFeature) {
if (geoJsonFeature.id in currentSpatialObjects) {
@ -72,6 +73,10 @@ function SpatialObject(json) {
return this;
}
function popupDateRange(){
$('#dateRangePopup').attr('title', 'Device ID - '+ deviceId +" Device Type - "+ deviceType).dialog();
}
SpatialObject.prototype.update = function (geoJSON) {
this.latitude = geoJSON.geometry.coordinates[1];
this.longitude = geoJSON.geometry.coordinates[0];
@ -163,6 +168,13 @@ SpatialObject.prototype.removeFromMap = function () {
this.marker.closePopup();
};
function clearMap() {
for (var i=0; i< currentSpatialObjects.length; i++ ){
console.log("removed - " + currentSpatialObjects[i]);
currentSpatialObjects[i].removeFromMap();
}
}
SpatialObject.prototype.createLineStringFeature = function (state, information, coordinates) {
return {
"type": "Feature",
@ -269,7 +281,6 @@ function processTrafficMessage(json) {
}
function processAlertMessage(json) {
//console.log(json);
if (json.state != "NORMAL" && json.state != "MINIMAL") {
console.log(json);
notifyAlert("Object ID: <span style='color: blue;cursor: pointer' onclick='focusOnSpatialObject(" + json.id + ")'>" + json.id + "</span> change state to: <span style='color: red'>" + json.state + "</span> Info : " + json.information);
@ -553,12 +564,14 @@ var webSocketOnAlertOpen = function () {
};
var webSocketOnAlertMessage = function processMessage(message) {
if (!isBatchModeOn) {
var json = $.parseJSON(message.data);
if (json.messageType == "Alert") {
processAlertMessage(json);
} else {
console.log("Message type not supported.");
}
}
};
var webSocketOnAlertClose = function (e) {
@ -595,6 +608,7 @@ var webSocketOnOpen = function () {
};
var webSocketOnMessage = function (message) {
if(!isBatchModeOn) {
var json = $.parseJSON(message.data);
if (json.messageType == "Point") {
processPointMessage(json);
@ -603,10 +617,10 @@ var webSocketOnMessage = function (message) {
} else {
console.log("Message type not supported.");
}
}
};
var webSocketOnClose = function (e) {
if (websocket.get_opened()) {
$.UIkit.notify({
message: 'Connection lost with server!!',
@ -689,6 +703,7 @@ function intializeWebsocketUrls() {
.CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION
+ "?deviceId=" + deviceId + "&deviceType=" + deviceType;
document.cookie = "websocket-token=f98d6142-e988-3c7f-a8c9-7e6d74da7113; path=/";
$("#proximity_alert").hide();
initializeWebSocket();
initializeOnAlertWebSocket();
});

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<artifact name="Geo-EventSink-FusedStream" version="1.0.0" type="analytics/eventstore" serverRole="GeoDashboard">
<file>org_wso2_geo_FusedSpatialEvent.xml</file>
</artifact>

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EventStoreConfiguration>
<TableSchema>
<ColumnDefinition>
<Name>id</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>latitude</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>DOUBLE</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>longitude</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>DOUBLE</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>timeStamp</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>LONG</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>type</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>speed</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>FLOAT</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>heading</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>FLOAT</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>state</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>information</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>notify</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>BOOLEAN</Type>
</ColumnDefinition>
</TableSchema>
<Source>
<StreamId>org.wso2.geo.FusedSpatialEvent:1.0.0</StreamId>
</Source>
<MergeSchema>false</MergeSchema>
<RecordStoreName>EVENT_STORE</RecordStoreName>
</EventStoreConfiguration>

@ -9,7 +9,7 @@
"type": "Feature",
"id": {{id}},
"deviceId": {{id}},
"deviceType" : "{{type}}",
"deviceType" : {{type}},
"state": {{state}},
"information": {{information}},
"longitude" : {{longitude}},

@ -27,6 +27,7 @@
<dependency artifact="ThemeGeoDashboard" version="1.0.0" include="true" serverRole="GeoDashboard"/>
<!-- CEP Artifacts -->
<dependency artifact="Geo-Dashboard-Http-Receiver" version="1.0.0" include="true" serverRole="GeoDashboard"/>
<dependency artifact="Geo-EventSink-FusedStream" version="1.0.0" include="true" serverRole="GeoDashboard"/>
<dependency artifact="Geo-ExecutionPlan-EventsFusionGenerateNotifications" version="1.0.0" include="true" serverRole="GeoDashboard"/>
<dependency artifact="Geo-ExecutionPlan-InputStandardizer" version="1.0.0" include="true" serverRole="GeoDashboard"/>
<dependency artifact="Geo-ExecutionPlan-Pass_through" version="1.0.0" include="true" serverRole="GeoDashboard"/>

@ -18,7 +18,7 @@
-->
<artifacts>
<artifact name="android_analytics" version="1.0.0" type="carbon/application">
<artifact name="androidsense" version="1.0.0" type="carbon/application">
<dependency artifact="android_active_stack_chart_gadget" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_active_time_chart_gadget" version="1.0.0" include="true"
@ -54,8 +54,6 @@
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_audio_script" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_audio_streams" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_level_chart_gadget" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_history_chart_gadget" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_percentage_chart_gadget" version="1.0.0" include="true"
@ -65,11 +63,11 @@
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_stats_streams" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_streams" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_ui_event_publisher" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_stats_ui_event_publisher" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_ui_event_publisher" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_streams" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_call_script" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_call_stats_event_sink" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>

@ -147,15 +147,15 @@
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">01</span>
<span class="badge">01</span>
Connect Android device to network.
</li>
<li class="padding-top-double">
<span class="circle">02</span>
<span class="badge">02</span>
Start Android Sense app in your device.
</li>
<li class="padding-top-double">
<span class="circle">03</span>
<span class="badge">03</span>
Fill login form with the credentials.
<i>(Use server URL as [ https://&lt;WSO2_IoT_SERVER_HOST&gt;:&lt;
HTTPS_SERVER_PORT&gt; ] and click on
@ -169,7 +169,7 @@
</li>
<li class="padding-top-double">
<span class="circle">04</span>
<span class="badge">04</span>
Once the device is enrolled, click on <strong>[+]</strong> button to
select the sensors.
<a href="{{@unit.publicUri}}/images/selectSensorView.png" target="_blank"
@ -178,7 +178,7 @@
</a>
</li>
<li class="padding-top-double">
<span class="circle">05</span>
<span class="badge">05</span>
Click on <i>[Publish data]</i> button to publish sensor readings to
IoT server.
<a href="{{@unit.publicUri}}/images/publishDataView.png" target="_blank"
@ -190,12 +190,14 @@
<br>
</div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-double">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 padding-double">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 padding-double">
<h3 class="uppercase">Try Out</h3>
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<span class="fw-stack margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
@ -203,7 +205,7 @@
<a href="{{@app.context}}/devices">[Device Management]</a> page.
</li>
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<span class="fw-stack margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
@ -211,7 +213,7 @@
operations and Real-Time data monitoring.
</li>
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<span class="fw-stack margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span> For historical analytics of sensor data navigate to device
@ -219,12 +221,16 @@
</li>
</ul>
<br/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 padding-double">
<p class="grey margin-top">Click on the image to zoom</p>
<center>
<a href="{{@unit.publicUri}}/images/myDevices_analytics.png" target="_blank">
<img src="{{@unit.publicUri}}/images/myDevices_analytics.png" class="img-responsive">
</a>
</center>
</div>
</div>
</div>
<div id="qr-code-modal" data-enrollment-url="{{hostName}}{{@unit.publicUri}}/asset/androidsense.apk" class="hidden">

@ -196,11 +196,11 @@
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">01</span>
<span class="badge">01</span>
Wifi-Shield mounted onto the Arduino-UNO board
</li>
<li class="padding-top-double">
<span class="circle">02</span>
<span class="badge">02</span>
Connect LED bulb to arduino as follows
<br/><br/>
<a href="{{@unit.publicUri}}/images/schematicsGuide.png" target="_blank">
@ -210,20 +210,20 @@
</li>
<li class="padding-top-double">
<span class="circle">03</span>
<span class="badge">03</span>
Download Arduino-Sketch from [Download Sketch] link above.
</li>
<li class="padding-top-double">
<span class="circle">04</span>
<span class="badge">04</span>
Unzip the downloaded Arduino Agent
</li>
<li class="padding-top-double">
<span class="circle">05</span>
<span class="badge">05</span>
Create a folder called "ArduinoBoardSketch" and move all source files
inside
</li>
<li class="padding-top-double">
<span class="circle">06</span>
<span class="badge">06</span>
Open ArduinoBoardSketch.h and provide appropriate values for
<i>[WLAN_SSID]</i>,
<i>[WLAN_PASS]</i>,
@ -233,19 +233,19 @@
variables according to your network.
</li>
<li class="padding-top-double">
<span class="circle">07</span>
<span class="badge">07</span>
Burn the sketch onto your Arduino board and let the program run.
</li>
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<span class="fw-stack margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
Arduino will publish it's internal temperature to WSO2-IoT-Server
<br/><br/>
<span class="fw-stack fw-lg margin-right">
<span class="fw-stack margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
@ -256,22 +256,23 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 padding-double">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 padding-double">
<h3 class="uppercase">Try Out</h3>
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">01</span>
<span class="badge">01</span>
You can view all your connected devices at
<a href="{{@app.context}}/devices">[Device Management]</a> page.
</li>
<li class="padding-top-double">
<span class="circle">02</span>
<span class="badge">02</span>
Select one of connected devices and check for available control
operations and monitor Real-Time data.
</li>
<li class="padding-top-double">
<span class="circle">03</span>
<span class="badge">03</span>
You can also view analytics of the data published to IoT-Server by
navigating to Device Analytics page.
</li>
@ -287,6 +288,7 @@
</a>
</center>
</div>
</div>
</div>
{{#zone "topCss"}}

@ -192,31 +192,31 @@
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">01</span>
<span class="badge">01</span>
Connect RaspberryPi, DHT11 Temperature sensor and LED as per the
schematic below.
</li>
<li class="padding-top-double">
<span class="circle">02</span>
<span class="badge">02</span>
Ensure your RaspberryPi Board can connect to Internet.
</li>
<li class="padding-top-double">
<span class="circle">03</span>
<span class="badge">03</span>
Download RaspberryPi Agent via [Download Agent] button above.
(Alternatively you can use the "curl" command to directly download the Agent to your
RaspberryPi.)
</li>
<li class="padding-top-double">
<span class="circle">04</span>
<span class="badge">04</span>
Copy downloaded Agent into your RaspberryPi.
</li>
<li class="padding-top-double">
<span class="circle">05</span>
<span class="badge">05</span>
Unzip the downloaded Agent and start terminal to run below commands.
</li>
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<span class="fw-stack margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
@ -225,7 +225,7 @@
</li>
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<span class="fw-stack margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
@ -251,17 +251,17 @@
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">01</span>
<span class="badge">01</span>
You can view all your connected devices at
<a href="{{@app.context}}/devices">[Device Management]</a> page.
</li>
<li class="padding-top-double">
<span class="circle">02</span>
<span class="badge">02</span>
Select one of connected devices and check for available control
operations and monitor Real-Time data.
</li>
<li class="padding-top-double">
<span class="circle">03</span>
<span class="badge">03</span>
You can also view analytics of the data published to IoT-Server by
navigating to Device Analytics page.
</li>

@ -205,19 +205,15 @@
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">01</span>
Download your VirtualFireAlarm using [Download Agent] button above.
</li>
<li class="padding-top-double">
<span class="circle">02</span>
<span class="badge">01</span>
Unzip the downloaded Agent.
</li>
<li class="padding-top-double">
<span class="circle">03</span>
<span class="badge">02</span>
Move into the unzipped Agent folder in the terminal.
</li>
<li class="padding-top-double">
<span class="circle">04</span>
<span class="badge">03</span>
Unzip the downloaded Agent and start terminal to run this command: [sh
start-device.sh]
</li>
@ -240,17 +236,17 @@
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">01</span>
<span class="badge">01</span>
You can view all your connected devices at
<a href="{{@app.context}}/devices">[Device Management]</a> page.
</li>
<li class="padding-top-double">
<span class="circle">02</span>
<span class="badge">02</span>
Select one of connected devices and check for available control
operations and monitor Real-Time data.
</li>
<li class="padding-top-double">
<span class="circle">03</span>
<span class="badge">03</span>
You can also view analytics of the data published to IoT-Server by
navigating to Device Analytics page.
</li>

@ -76,6 +76,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
.target(ApiApplicationRegistrationService.class,
deviceMgtServerUrl + API_APPLICATION_REGISTRATION_CONTEXT);
}
@Override
public void apply(RequestTemplate template) {
if (tokenInfo == null) {
@ -95,10 +96,12 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
tokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password);
tokenInfo.setExpires_in(System.currentTimeMillis() + tokenInfo.getExpires_in());
}
synchronized(tokenInfo) {
if (System.currentTimeMillis() + refreshTimeOffset > tokenInfo.getExpires_in()) {
tokenInfo = tokenIssuerService.getToken(REFRESH_GRANT_TYPE, tokenInfo.getRefresh_token());
tokenInfo.setExpires_in(System.currentTimeMillis() + tokenInfo.getExpires_in());
}
}
String headerValue = "Bearer " + tokenInfo.getAccess_token();
template.header("Authorization", headerValue);
}

@ -37,6 +37,26 @@
<br/><br/>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-12 padding-double grey-bg">
<h3 class="uppercase">Prepare</h3><hr>
<ul class="list-unstyled">
<li class="padding-top-double"><span class="badge">01</span> Download Device Agent into your Android Mobile.</li>
<li><span class="badge">02</span> Install Agent APK file.</li>
<li><span class="badge">03</span> Configure Agent App</li>
</ul>
<br>
</div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-double">
<p class="grey margin-top">Click on the image to zoom</p>
<center>
<a href="{{@unit.publicUri}}/images/android_device.png" target="_blank">
<img src="{{@unit.publicUri}}/images/android_device.png" class="img-responsive">
</a>
</center>
</div>
<br/>
{{#zone "topCss"}}

Loading…
Cancel
Save