add screensharing support

revert-dabc3590
warunalakshitha 7 years ago
commit e0b27c0a5c

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>iot-analytics</artifactId> <artifactId>iot-analytics</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>iot-analytics</artifactId> <artifactId>iot-analytics</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>iot-analytics</artifactId> <artifactId>iot-analytics</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>iot-analytics</artifactId> <artifactId>iot-analytics</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>analytics</artifactId> <artifactId>analytics</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>carbon-device-mgt-plugins-parent</artifactId> <artifactId>carbon-device-mgt-plugins-parent</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>androidsense-plugin</artifactId> <artifactId>androidsense-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -153,5 +153,5 @@ select meta_owner, meta_deviceId, meta_timestamp, data_type as type, data_receiv
insert into DataStream; insert into DataStream;
from AndroidSense[meta_type == 'gps'] from AndroidSense[meta_type == 'gps']
select meta_deviceId ,meta_type as meta_deviceType, meta_timestamp as timeStamp, gps_lat as latitude, gps_long as longitude select meta_deviceId ,'android_sense' as meta_deviceType, meta_timestamp as timeStamp, gps_lat as latitude, gps_long as longitude
insert into geoLocationStream; insert into geoLocationStream;

@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>androidsense-plugin</artifactId> <artifactId>androidsense-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>androidsense-plugin</artifactId> <artifactId>androidsense-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -31,52 +31,52 @@
{{/zone}} {{/zone}}
{{#zone "device-details"}} {{#zone "device-details"}}
<span class="device-id"
data-deviceid="{{device.deviceIdentifier}}"
data-type="{{device.type}}"></span>
{{/zone}} {{/zone}}
{{#zone "device-view-tabs"}} {{#zone "device-view-tabs"}}
<li class="active"><a class="list-group-item" href="#device_statistics" role="tab" <li class="active"><a class="list-group-item" href="#device_statistics" role="tab"
data-toggle="tab" aria-controls="device_statistics">Device data-toggle="tab" aria-controls="device_statistics">Device
Statistics</a> Statistics</a>
</li> </li>
<li><a class="list-group-item location_tab" href="#geo_dashboard" role="tab" data-toggle="tab" <li><a class="initGeoLocationLink" href="#geo_dashboard" role="tab" data-toggle="tab"
aria-controls="geo_dashboard">Device Location</a></li> aria-controls="geo_dashboard"
data-lat="{{device.location.latitude}}"
data-long="{{device.location.longitude}}">Device Location</a></li>
{{/zone}} {{/zone}}
{{#zone "device-view-tab-contents"}} {{#zone "device-view-tab-contents"}}
<div class="panel panel-default tab-pane active" <div class="panel panel-default tab-pane active"
id="device_statistics" role="tabpanel" aria-labelledby="device_statistics"> id="device_statistics" role="tabpanel" aria-labelledby="device_statistics">
<div class="panel-heading">Device Statistics</div>
{{unit "cdmf.unit.device.type.android_sense.realtime.analytics-view" device=device}} {{unit "cdmf.unit.device.type.android_sense.realtime.analytics-view" device=device}}
</div> </div>
<div class="panel panel-default tab-pane" <div class="panel panel-default tab-pane"
id="geo_dashboard" role="tabpanel" aria-labelledby="geo_dashboard"> id="geo_dashboard" role="tabpanel" aria-labelledby="geo_dashboard">
<div class="panel-heading">Device Location</div> {{#if locationEnabled}}
<br/> <div id="location" class="tab-pane">
{{unit "cdmf.unit.geo-dashboard" device=device}} <div class="tab-actions">
{{#if locationHistory}} <div class="action-btn-container" id="location-action-bar">
<div id="device-location" </div>
data-locations = "{{locationHistory}}"> </div>
<br/>
{{unit "cdmf.unit.geo-dashboard" device=device noGeoFencing=false hideSearch=true}}
</div> </div>
<br/>
<a class="padding-left" target="_blank"
href="{{portalUrl}}/portal/dashboards/geo-dashboard/?GLOBAL-STATE={{anchor}}">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-map-location fw-stack-1x"></i>
</span> Add Geo Fencing
</a>
{{else}} {{else}}
<div id="map-error" class="message message-warning"> <div id="map-error" class="message message-warning">
<h4 class="remove-margin"> <h4 class="remove-margin">
<i class="icon fw fw-warning"></i> <i class="icon fw fw-warning"></i>
{{#if geoServicesEnabled}}
Device location information is not available. Device location information is not available.
{{else}}
Geo Location Based Services is not enabled.
{{/if}}
</h4> </h4>
</div> </div>
<p class="add-padding-5x"></p> <p class="add-padding-5x"></p>
<p class="add-padding-5x"></p> <p class="add-padding-5x"></p>
<p class="add-padding-5x"></p> <p class="add-padding-5x"></p>
{{/if}} {{/if}}
<div id="chartWrapper">
</div>
</div> </div>
{{/zone}} {{/zone}}

@ -37,6 +37,8 @@ function onRequest(context) {
viewObject.portalUrl = devicemgtProps['portalURL']; viewObject.portalUrl = devicemgtProps['portalURL'];
viewObject.anchor = encodeURI(JSON.stringify(anchor)); viewObject.anchor = encodeURI(JSON.stringify(anchor));
viewObject.locationHistory = stringify(device.content.locationHistory); viewObject.locationHistory = stringify(device.content.locationHistory);
viewObject.locationEnabled = (device.content.locationHistory.length !== 0);
viewObject.geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled;
return viewObject; return viewObject;
} else { } else {
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");

@ -20,29 +20,43 @@ function onRequest(context) {
var log = new Log("stats.js"); var log = new Log("stats.js");
var carbonServer = require("carbon").server; var carbonServer = require("carbon").server;
var device = context.unit.params.device; var device = context.unit.params.device;
// graph configuration // graph configuration
var graphData = { var graphData = {
Sensors:["accelerometer","magnetic", "gravity", "pressure", "proximity", "gyroscope"], Sensors:["accelerometer","magnetic", "gravity", "pressure", "proximity", "gyroscope"],
Realtime_Data:['battery','light','rotation'] Realtime_Data:['battery','light','rotation']
}; };
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var websocketEndpoint = devicemgtProps["wssURL"].replace("https", "wss"); var websocketEndpoint = devicemgtProps["wssURL"].replace("https", "wss");
var jwtService = carbonServer.osgiService( var jwtService = carbonServer.osgiService(
'org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService'); 'org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService');
var jwtClient = jwtService.getJWTClient(); var jwtClient = jwtService.getJWTClient();
var encodedClientKeys = session.get(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"]); var encodedClientKeys = session.get(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"]);
var token = ""; var token = "";
var tokenPair = null;
var user = userModule.getCarbonUser();
var tenantDomain = user.domain;
if (encodedClientKeys) { if (encodedClientKeys) {
var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"];
var resp = tokenUtil.decode(encodedClientKeys).split(":"); var resp = tokenUtil.decode(encodedClientKeys).split(":");
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {}); if (tenantDomain == "carbon.super") {
if (tokenPair) { tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {});
token = tokenPair.accessToken; if (tokenPair) {
token = tokenPair.accessToken;
}
websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.android.sense/1.0.0?" +
"deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token;
} else {
tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + tenantDomain,"default", {});
if (tokenPair) {
token = tokenPair.accessToken;
}
websocketEndpoint = websocketEndpoint + "/secured-websocket/t/"+tenantDomain+"/org.wso2.iot.android.sense/1.0.0?" +
"deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token;
} }
websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.android.sense/1.0.0?" +
"deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token;
} }
return {"device": device, "websocketEndpoint": websocketEndpoint, "graphData":graphData}; return {"device": device, "websocketEndpoint": websocketEndpoint, "graphData":graphData};
} }

@ -158,6 +158,15 @@ function threeDlineGraph(type, xChartData, yChartData, zChartData) {
graph: graph graph: graph
}); });
new Rickshaw.Graph.HoverDetail({
graph: graph,
formatter: function (series, x, y) {
var date = '<span class="date">' + moment(x * 1000).format('Do MMM YYYY h:mm:ss a') + '</span>';
var swatch = '<span class="detail_swatch" style="background-color: ' + series.color + '"></span>';
return swatch + series.name + ": " + parseInt(y) + '<br>' + date;
}
});
graph.render(); graph.render();
return graph; return graph;
@ -234,58 +243,61 @@ function connect(target) {
if (ws) { if (ws) {
ws.onmessage = function (event) { ws.onmessage = function (event) {
var dataPoint = JSON.parse(event.data); var dataPoint = JSON.parse(event.data);
if (dataPoint) { if (dataPoint) {
var time = parseInt(dataPoint[4]) / 1000; var time = parseInt(dataPoint[4]) / 1000;
switch (dataPoint[typeId]) { switch (dataPoint[typeId]) {
case "battery": case "battery":
graphUpdate(batteryData, time, dataPoint[batteryId], graphMap["battery"]); graphUpdate(batteryData, time, dataPoint[batteryId]);
graphMap["battery"].update();
break; break;
case "light": case "light":
graphUpdate(lightData, time, dataPoint[lightId], graphMap["light"]); graphUpdate(lightData, time, dataPoint[lightId]);
graphMap["light"].update();
break; break;
case "pressure": case "pressure":
graphUpdate(pressureData, time, dataPoint[pressureId], graphMap["pressure"]); graphUpdate(pressureData, time, dataPoint[pressureId]);
graphMap["pressure"].update();
break; break;
case "proximity": case "proximity":
graphUpdate(proximityData, time, dataPoint[proximityId], graphMap["proximity"]); graphUpdate(proximityData, time, dataPoint[proximityId]);
graphMap["proximity"].update();
break; break;
case "accelerometer": case "accelerometer":
dataUpdate(accelerometer_xData, time, dataPoint[accelerometer_xId]); graphUpdate(accelerometer_xData, time, dataPoint[accelerometer_xId]);
dataUpdate(accelerometer_yData, time, dataPoint[accelerometer_yId]); graphUpdate(accelerometer_yData, time, dataPoint[accelerometer_yId]);
dataUpdate(accelerometer_zData, time, dataPoint[accelerometer_zId]); graphUpdate(accelerometer_zData, time, dataPoint[accelerometer_zId]);
graphMap["accelerometer"].update(); graphMap["accelerometer"].update();
break; break;
case "magnetic": case "magnetic":
dataUpdate(magnetic_xData, time, dataPoint[magnetic_xId]); graphUpdate(magnetic_xData, time, dataPoint[magnetic_xId]);
dataUpdate(magnetic_yData, time, dataPoint[magnetic_yId]); graphUpdate(magnetic_yData, time, dataPoint[magnetic_yId]);
dataUpdate(magnetic_zData, time, dataPoint[magnetic_zId]); graphUpdate(magnetic_zData, time, dataPoint[magnetic_zId]);
graphMap["magnetic"].update(); graphMap["magnetic"].update();
break; break;
case "gyroscope": case "gyroscope":
dataUpdate(gyroscope_xData, time, dataPoint[gyroscope_xId]); graphUpdate(gyroscope_xData, time, dataPoint[gyroscope_xId]);
dataUpdate(gyroscope_yData, time, dataPoint[gyroscope_yId]); graphUpdate(gyroscope_yData, time, dataPoint[gyroscope_yId]);
dataUpdate(gyroscope_zData, time, dataPoint[gyroscope_zId]); graphUpdate(gyroscope_zData, time, dataPoint[gyroscope_zId]);
graphMap["gyroscope"].update(); graphMap["gyroscope"].update();
break; break;
case "rotation": case "rotation":
dataUpdate(magnetic_xData, time, dataPoint[rotation_xId]); graphUpdate(magnetic_xData, time, dataPoint[rotation_xId]);
dataUpdate(magnetic_yData, time, dataPoint[rotation_yId]); graphUpdate(magnetic_yData, time, dataPoint[rotation_yId]);
dataUpdate(magnetic_zData, time, dataPoint[rotation_zId]); graphUpdate(magnetic_zData, time, dataPoint[rotation_zId]);
graphMap["rotation"].update(); graphMap["rotation"].update();
break; break;
case "gravity": case "gravity":
dataUpdate(gravity_xData, time, dataPoint[gravity_xId]); graphUpdate(gravity_xData, time, dataPoint[gravity_xId]);
dataUpdate(gravity_yData, time, dataPoint[gravity_yId]); graphUpdate(gravity_yData, time, dataPoint[gravity_yId]);
dataUpdate(gravity_zData, time, dataPoint[gravity_zId]); graphUpdate(gravity_zData, time, dataPoint[gravity_zId]);
graphMap["gravity"].update(); graphMap["gravity"].update();
break; break;
} }
@ -294,16 +306,7 @@ function connect(target) {
} }
} }
function graphUpdate(chartData, xValue, yValue, graph) { function graphUpdate(chartData, xValue, yValue) {
chartData.push({
x: parseInt(xValue),
y: parseFloat(yValue)
});
chartData.shift();
graph.update();
}
function dataUpdate(chartData, xValue, yValue) {
chartData.push({ chartData.push({
x: parseInt(xValue), x: parseInt(xValue),
y: parseFloat(yValue) y: parseFloat(yValue)

@ -17,7 +17,7 @@
}} }}
{{unit "cdmf.unit.device.type.qr-modal" enrollmentURL=enrollmentURL deviceTypeName="Android"}} {{unit "cdmf.unit.device.type.qr-modal" enrollmentURL=enrollmentURL deviceTypeName="Android"}}
{{unit "cdmf.unit.device.type.email.invite-modal" deviceTypeView="androidsense"}} {{unit "cdmf.unit.device.type.email.invite-modal" deviceTypeView="android_sense"}}
<div class="col-lg-12 margin-top-double"> <div class="col-lg-12 margin-top-double">
<h1 class="grey ">Android Sense</h1> <h1 class="grey ">Android Sense</h1>
@ -41,7 +41,7 @@
<a href="#" class="download-link btn-operations"><i class="fw fw-mobile fw-inverse fw-lg add-margin-1x"></i> Enroll Device</a> <a href="#" class="download-link btn-operations"><i class="fw fw-mobile fw-inverse fw-lg add-margin-1x"></i> Enroll Device</a>
<a href="{{hostName}}{{@unit.publicUri}}/asset/androidsense.apk" class="btn-operations"><i class="fw fw-download fw-inverse fw-lg add-margin-1x"></i> Download APK</a> <a href="{{hostName}}{{@unit.publicUri}}/asset/androidsense.apk" class="btn-operations"><i class="fw fw-download fw-inverse fw-lg add-margin-1x"></i> Download APK</a>
<a href="javascript:toggleEmailInvite()" class="btn-operations"><i class="fw fw-mail fw-inverse fw-lg add-margin-1x"></i> Invite by Email</a> <a href="javascript:toggleEmailInvite()" class="btn-operations"><i class="fw fw-mail fw-inverse fw-lg add-margin-1x"></i> Invite by Email</a>
<p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS300/Android+Sense" <p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS310/Android+Sense"
target="_blank">[ here ]</a> for latest instructions and target="_blank">[ here ]</a> for latest instructions and
troubleshooting.</p> troubleshooting.</p>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>device-types</artifactId> <artifactId>device-types</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>arduino-plugin</artifactId> <artifactId>arduino-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>arduino-plugin</artifactId> <artifactId>arduino-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -221,13 +221,21 @@ public class ArduinoServiceImpl implements ArduinoService {
String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm() String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm()
.getRealmConfiguration().getAdminUserName() + "@" + PrivilegedCarbonContext .getRealmConfiguration().getAdminUserName() + "@" + PrivilegedCarbonContext
.getThreadLocalCarbonContext().getTenantDomain(); .getThreadLocalCarbonContext().getTenantDomain();
;
if (apiApplicationKey == null) { if (apiApplicationKey == null) {
String adminUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration().getAdminUserName();
String tenantAdminDomainName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
String[] tags = {ArduinoConstants.DEVICE_TYPE}; String[] tags = {ArduinoConstants.DEVICE_TYPE};
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( try{
ArduinoConstants.DEVICE_TYPE, tags, KEY_TYPE, applicationUsername, true, PrivilegedCarbonContext.startTenantFlow();
ArduinoConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantAdminDomainName);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(adminUsername);
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
ArduinoConstants.DEVICE_TYPE, tags, KEY_TYPE, applicationUsername, true,
ArduinoConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD);
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
} }
JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient(); JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient();
String scopes = " device_" + deviceId + " perm:arduino:enroll"; String scopes = " device_" + deviceId + " perm:arduino:enroll";

@ -23,7 +23,7 @@
<parent> <parent>
<artifactId>arduino-plugin</artifactId> <artifactId>arduino-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -73,9 +73,9 @@ $(window).load(function () {
connect(websocketUrl) connect(websocketUrl)
}); });
$(window).unload(function () { window.onbeforeunload = function() {
disconnect(); disconnect();
}); };
//websocket connection //websocket connection
function connect(target) { function connect(target) {

@ -31,8 +31,7 @@
<div class="col-xs-12 col-sm-8 col-md-9 col-lg-9 padding-top"> <div class="col-xs-12 col-sm-8 col-md-9 col-lg-9 padding-top">
<h3 class="uppercase">What it Does</h3> <h3 class="uppercase">What it Does</h3>
<hr> <hr>
<p class="grey margin-top">Connect Arduino UNO board to WSO2 IoT Server and visualize sensor <p class="grey margin-top">Connect the Arduino UNO board to WSO2 IoT Server and visualize sensor data.</p>
data.</p>
<br> <br>
<h3 class="uppercase">What You Need</h3> <h3 class="uppercase">What You Need</h3>
<hr> <hr>
@ -43,20 +42,19 @@
</li> </li>
<li> <li>
<span class="badge">ITEM 02</span> <span class="badge">ITEM 02</span>
Adafruit Wifi Shield for Arduino. Adafruit WiFi Shield for Arduino.
</li> </li>
<li> <li>
<span class="badge">ITEM 03</span> <span class="badge">ITEM 03</span>
LED bulb connected to Pin 13. A LED bulb connected to pin 13. If you do not have a LED bulb, use the one on the Arduino board. The one on the board is connected to pin 13 by default.
<i>(If not available, will use the one on the board.)</i>
</li> </li>
<li> <li>
<span class="badge">ITEM 04</span> <span class="badge">ITEM 04</span>
Resister( e.g 330 ohms ) Resister (e.g., 330 ohm)
</li> </li>
<li> <li>
<span class="badge">STEP 05</span> <span class="badge">STEP 05</span>
Proceed to [Prepare] section. Next, proceed to the [Prepare] section. (remove the step 5 coz that' is the only step all the others are items.)
</ul> </ul>
<br> <br>
<a href="/api-store/apis/info?name={{@uriParams.deviceType}}&version=1.0.0&provider=admin" <a href="/api-store/apis/info?name={{@uriParams.deviceType}}&version=1.0.0&provider=admin"
@ -66,7 +64,7 @@
<a href="#" class="download-link btn-operations"> <a href="#" class="download-link btn-operations">
<i class="fw fw-download add-margin-1x"></i>Download Sketch <i class="fw fw-download add-margin-1x"></i>Download Sketch
</a> </a>
<p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS300/Arduino" <p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS310/Arduino"
target="_blank">here</a> for latest instructions and target="_blank">here</a> for latest instructions and
troubleshooting.</p> troubleshooting.</p>
<div id="download-device-modal-content" class="hide"> <div id="download-device-modal-content" class="hide">
@ -197,11 +195,11 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">01</span> <span class="badge">01</span>
Wifi-Shield mounted onto the Arduino-UNO board Mount the WiFi shield to the Arduino UNO board.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">02</span> <span class="badge">02</span>
Connect LED bulb to arduino as follows Connect the LED bulb to Arduino as shown below:
<br/><br/> <br/><br/>
<a href="{{@unit.publicUri}}/images/schematicsGuide.jpg" target="_blank"> <a href="{{@unit.publicUri}}/images/schematicsGuide.jpg" target="_blank">
<img src="{{@unit.publicUri}}/images/schematicsGuide.jpg" class="img-responsive"> <img src="{{@unit.publicUri}}/images/schematicsGuide.jpg" class="img-responsive">
@ -211,26 +209,25 @@
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">03</span> <span class="badge">03</span>
Download Arduino-Sketch from [Download Sketch] link above. Click [Download Sketch] above to download the Arduino Sketch.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">04</span> <span class="badge">04</span>
Unzip the downloaded Arduino Agent Unzip the downloaded Arduino agent.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">05</span> <span class="badge">05</span>
Create a folder called "ArduinoBoardSketch" and move all source files Create a folder by the name ArduinoBoardSketch and move the downloaded agent and the source files to it.
inside
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">06</span> <span class="badge">06</span>
Open ArduinoBoardSketch.h and provide appropriate values for Open the ArduinoBoardSketch.h file and provide the values for the
<i>[WLAN_SSID]</i>, <i>[WLAN_SSID]</i>,
<i>[WLAN_PASS]</i>, <i>[WLAN_PASS]</i>,
<i>[SERVICE_PORT]</i>, <i>[SERVICE_PORT]</i>,
<i>[server]</i> and <i>[server]</i> and
<i>[deviceIP]</i> <i>[deviceIP]</i>
variables according to your network. variables for the device to connect to your WiFi network.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">07</span> <span class="badge">07</span>
@ -242,14 +239,14 @@
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i> <i class="fw fw-right-arrow fw-stack-1x"></i>
</span> </span>
Arduino will publish it's internal temperature to WSO2-IoT-Server The Arduino will publish its internal temperature to WSO2 IoT Server.
<br/><br/> <br/><br/>
<span class="fw-stack margin-right"> <span class="fw-stack margin-right">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i> <i class="fw fw-right-arrow fw-stack-1x"></i>
</span> </span>
LED on <i>PIN 13</i> can be controlled from Device Management page. Control the LED on <i>PIN 13</i> via the Device Management page.
</li> </li>
</ul> </ul>
<br> <br>
@ -263,18 +260,16 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">01</span> <span class="badge">01</span>
You can view all your connected devices at View all your connected devices in the
<a href="{{@app.context}}/devices">[Device Management]</a> page. <a href="{{@app.context}}/devices">[Device Management]</a> page.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">02</span> <span class="badge">02</span>
Select one of connected devices and check for available control Try out the control operations on your connected devices and monitor real-time data.
operations and monitor Real-Time data.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">03</span> <span class="badge">03</span>
You can also view analytics of the data published to IoT-Server by Do we need this step? Is this supported?
navigating to Device Analytics page.
</li> </li>
</ul> </ul>
<br/> <br/>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>device-types</artifactId> <artifactId>device-types</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>carbon-device-mgt-plugins-parent</artifactId> <artifactId>carbon-device-mgt-plugins-parent</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>raspberrypi-plugin</artifactId> <artifactId>raspberrypi-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>raspberrypi-plugin</artifactId> <artifactId>raspberrypi-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -203,14 +203,23 @@ public class RaspberryPiServiceImpl implements RaspberryPiService {
throw new DeviceManagementException(msg); throw new DeviceManagementException(msg);
} }
if (apiApplicationKey == null) { if (apiApplicationKey == null) {
String adminUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration().getAdminUserName();
String tenantAdminDomainName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm() String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm()
.getRealmConfiguration().getAdminUserName() + "@" + PrivilegedCarbonContext .getRealmConfiguration().getAdminUserName() + "@" + PrivilegedCarbonContext
.getThreadLocalCarbonContext().getTenantDomain(); .getThreadLocalCarbonContext().getTenantDomain();
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
String[] tags = {RaspberrypiConstants.DEVICE_TYPE}; String[] tags = {RaspberrypiConstants.DEVICE_TYPE};
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( try{
RaspberrypiConstants.DEVICE_TYPE, tags, KEY_TYPE, applicationUsername, true, PrivilegedCarbonContext.startTenantFlow();
RaspberrypiConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantAdminDomainName);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(adminUsername);
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
RaspberrypiConstants.DEVICE_TYPE, tags, KEY_TYPE, applicationUsername, true,
RaspberrypiConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD);
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
} }
JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient(); JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient();
String scopes = " device_" + deviceId; String scopes = " device_" + deviceId;

@ -23,7 +23,7 @@
<parent> <parent>
<artifactId>raspberrypi-plugin</artifactId> <artifactId>raspberrypi-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -84,8 +84,8 @@ function attachEvents() {
* on Device Management page in WSO2 DC Console. * on Device Management page in WSO2 DC Console.
*/ */
$("a.download-link").click(function () { $("a.download-link").click(function () {
var sketchType = $(this).data("sketchtype"); var sketchType = $(".deviceType").val();
var deviceType = $(this).data("devicetype"); var deviceType = $(".sketchType").val();
var downloadDeviceAPI = "/devicemgt/api/devices/sketch/generate_link"; var downloadDeviceAPI = "/devicemgt/api/devices/sketch/generate_link";
var payload = {"sketchType": sketchType, "deviceType": deviceType}; var payload = {"sketchType": sketchType, "deviceType": deviceType};
$(modalPopupContent).html($('#download-device-modal-content').html()); $(modalPopupContent).html($('#download-device-modal-content').html());
@ -100,16 +100,24 @@ function attachEvents() {
$('label[for=deviceName]').remove(); $('label[for=deviceName]').remove();
if (deviceName && deviceName.length >= 4) { if (deviceName && deviceName.length >= 4) {
payload.deviceName = deviceName; payload.deviceName = deviceName;
invokerUtil.post( var request = {
downloadDeviceAPI, url: downloadDeviceAPI,
payload, type: "POST",
function (data, textStatus, jqxhr) { contentType: "application/json",
doAction(data); data: JSON.stringify(payload),
}, accept: "application/json",
function (data) { async : true,
doAction(data); success: doAction,
error: function (jqXHR) {
if (jqXHR.status == 401) {
$(modalPopupContent).html($("#error-msg").html());
showPopup();
} else {
doAction(jqXHR);
}
} }
); };
$.ajax(request);
}else if(deviceName){ }else if(deviceName){
$('.controls').append('<label for="deviceName" generated="true" class="error" ' + $('.controls').append('<label for="deviceName" generated="true" class="error" ' +
'style="display: inline-block;">Please enter at least 4 ' + 'style="display: inline-block;">Please enter at least 4 ' +
@ -159,10 +167,7 @@ function doAction(data) {
if (data.status == "200") { if (data.status == "200") {
$(modalPopupContent).html($('#download-device-modal-content-links').html()); $(modalPopupContent).html($('#download-device-modal-content-links').html());
$("input#download-device-url").val(data.responseText); $("#download-device-url").html(data.responseText);
$("input#download-device-url").focus(function () {
$(this).select();
});
showPopup(); showPopup();
} else if (data.status == "401") { } else if (data.status == "401") {
$(modalPopupContent).html($('#device-401-content').html()); $(modalPopupContent).html($('#device-401-content').html());

@ -62,7 +62,7 @@
<i class="fw fw-download add-margin-1x"></i>Download Agent <i class="fw fw-download add-margin-1x"></i>Download Agent
</a> </a>
<p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS300/Raspberry+Pi" <p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS310/Raspberry+Pi"
target="_blank">here</a> for latest instructions and target="_blank">here</a> for latest instructions and
troubleshooting.</p> troubleshooting.</p>
<div id="download-device-modal-content" class="hide"> <div id="download-device-modal-content" class="hide">
@ -85,9 +85,9 @@
name="deviceName" size="60" required> name="deviceName" size="60" required>
<br/> <br/>
<input type="hidden" class="deviceType" name="deviceType" <input type="hidden" class="deviceType" name="deviceType"
value="raspberrypi"/> value="raspberrypi" />
<input type="hidden" class="sketchType" name="sketchType" <input type="hidden" class="sketchType" name="sketchType"
value="raspberrypi"/> value="raspberrypi" />
</div> </div>
</div> </div>
<div class="buttons" style="padding-bottom: 0px"> <div class="buttons" style="padding-bottom: 0px">
@ -112,6 +112,15 @@
</div> </div>
</div> </div>
</div> </div>
<div id="download-device-modal-content-links" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h4 id="download-device-url"></h4>
</div>
</div>
</div>
</div>
<div id="device-400-content" class="hide"> <div id="device-400-content" class="hide">
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>device-types</artifactId> <artifactId>device-types</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<artifactId>virtual-fire-alarm-plugin</artifactId> <artifactId>virtual-fire-alarm-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>virtual-fire-alarm-plugin</artifactId> <artifactId>virtual-fire-alarm-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>virtual-fire-alarm-plugin</artifactId> <artifactId>virtual-fire-alarm-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -233,15 +233,27 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService {
throw new DeviceManagementException(msg); throw new DeviceManagementException(msg);
} }
if (apiApplicationKey == null) { if (apiApplicationKey == null) {
String adminUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm()
.getRealmConfiguration().getAdminUserName();
String tenantAdminDomainName = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getTenantDomain();
String applicationUsername = String applicationUsername =
PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration() PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration()
.getAdminUserName() + "@" + PrivilegedCarbonContext.getThreadLocalCarbonContext() .getAdminUserName() + "@" + PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getTenantDomain(); .getTenantDomain();
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
String[] tags = {VirtualFireAlarmConstants.DEVICE_TYPE}; String[] tags = {VirtualFireAlarmConstants.DEVICE_TYPE};
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys( try {
VirtualFireAlarmConstants.DEVICE_TYPE, tags, KEY_TYPE, applicationUsername, true, PrivilegedCarbonContext.startTenantFlow();
VirtualFireAlarmConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantAdminDomainName);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(adminUsername);
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
VirtualFireAlarmConstants.DEVICE_TYPE, tags, KEY_TYPE, applicationUsername, true,
VirtualFireAlarmConstants.APIM_APPLICATION_TOKEN_VALIDITY_PERIOD);
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
} }
JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient(); JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient();
String scopes = " device_" + deviceId; String scopes = " device_" + deviceId;

@ -23,7 +23,7 @@
<parent> <parent>
<artifactId>virtual-fire-alarm-plugin</artifactId> <artifactId>virtual-fire-alarm-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -59,7 +59,7 @@
<p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS310/Enterprise+IoT+solution" <p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS310/Enterprise+IoT+solution"
target="_blank">[ here ]</a> for the latest instructions and troubleshooting tips. target="_blank">[ here ]</a> for the latest instructions and troubleshooting tips.
We need to link the 310 pack to the 310 docs.</p> </p>
<div id="download-device-modal-content" class="hide"> <div id="download-device-modal-content" class="hide">
<div class="modal-header"> <div class="modal-header">
<h4 class="pull-left modal-title"> <h4 class="pull-left modal-title">

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>device-types</artifactId> <artifactId>device-types</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -18,7 +18,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>appm-connector</artifactId> <artifactId>appm-connector</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -18,7 +18,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>appm-connector</artifactId> <artifactId>appm-connector</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>extensions</artifactId> <artifactId>extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId> <artifactId>cdmf-transport-adapters</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>extensions</artifactId> <artifactId>extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>mb-extensions</artifactId> <artifactId>mb-extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>extensions</artifactId> <artifactId>extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>carbon-device-mgt-plugins-parent</artifactId> <artifactId>carbon-device-mgt-plugins-parent</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>pull-notification-listeners</artifactId> <artifactId>pull-notification-listeners</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>extensions</artifactId> <artifactId>extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>siddhi-extensions</artifactId> <artifactId>siddhi-extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -20,7 +20,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>siddhi-extensions</artifactId> <artifactId>siddhi-extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>extensions</artifactId> <artifactId>extensions</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>android-plugin</artifactId> <artifactId>android-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -73,13 +73,13 @@ public class EventReceiverServiceImpl implements EventReceiverService {
String eventPayload = eventBeanWrapper.getPayload(); String eventPayload = eventBeanWrapper.getPayload();
JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class); JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class);
Object payload[] = { Object payload[] = {
jsonObject.get(TIME_STAMP), jsonObject.get(TIME_STAMP).getAsLong(),
jsonObject.get(LONGITUDE), jsonObject.get(LONGITUDE).getAsDouble(),
jsonObject.get(LATITUDE) jsonObject.get(LATITUDE).getAsDouble()
}; };
try { try {
if (AndroidAPIUtils.getEventPublisherService().publishEvent( if (AndroidAPIUtils.getEventPublisherService().publishEvent(
EVENT_STREAM_DEFINITION, "1.0.0", new Object[0], new Object[0], payload)) { EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) {
message.setResponseCode("Event is published successfully."); message.setResponseCode("Event is published successfully.");
return Response.status(Response.Status.CREATED).entity(message).build(); return Response.status(Response.Status.CREATED).entity(message).build();
} else { } else {

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>android-plugin</artifactId> <artifactId>android-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -156,7 +156,7 @@ public class TryIt {
if (!new File(localPath).delete()) { if (!new File(localPath).delete()) {
System.out.println("Delete " + localPath + " and try again"); System.out.println("Delete " + localPath + " and try again");
} }
handleException("Downloading " + localPath + " failed.", e); handleException("Download failed for file : " + localPath, e);
} finally { } finally {
if (in != null) if (in != null)
try { try {
@ -193,7 +193,7 @@ public class TryIt {
String response = new Scanner(System.in, StandardCharsets.UTF_8.toString()).next(); String response = new Scanner(System.in, StandardCharsets.UTF_8.toString()).next();
String emulatorLocationPath = response + File.separator + "tools" + File.separator + "emulator"; String emulatorLocationPath = response + File.separator + "tools" + File.separator + "emulator";
if (osSuffix.equals(Constants.WINDOWS_OS)) { if (osSuffix.equals(Constants.WINDOWS_OS)) {
emulatorLocationPath += Constants.WINDOWS_EXTENSION_BAT; emulatorLocationPath += Constants.WINDOWS_EXTENSION_EXE;
} }
if (new File(emulatorLocationPath).exists()) { if (new File(emulatorLocationPath).exists()) {
androidSdkHome = response; androidSdkHome = response;
@ -255,7 +255,7 @@ public class TryIt {
private void getTools(String url, String folderName) { private void getTools(String url, String folderName) {
System.out.println("Downloading " + folderName); System.out.println("Downloading " + folderName);
downloadArtifacts(url, androidSdkHome + File.separator + folderName); downloadArtifacts(url, androidSdkHome + File.separator + folderName);
System.out.println("Configuring " + folderName); System.out.println("Configuring " + folderName + ", please wait");
extractFolder(androidSdkHome + File.separator + folderName); extractFolder(androidSdkHome + File.separator + folderName);
} }
@ -269,7 +269,7 @@ public class TryIt {
checkForSystemImages(); checkForSystemImages();
if (!new File(wso2AvdLocation).isDirectory()) { if (!new File(wso2AvdLocation).isDirectory()) {
Scanner read = new Scanner(System.in, StandardCharsets.UTF_8.toString()); Scanner read = new Scanner(System.in, StandardCharsets.UTF_8.toString());
System.out.print("Do you want to create WSO2_AVD with default configs (Y/n)?: "); System.out.print("Do you want to create WSO2_AVD with default configs (y/n)?: ");
if (read.next().toLowerCase().matches("y")) { if (read.next().toLowerCase().matches("y")) {
createAVD(); createAVD();
return; return;
@ -494,17 +494,29 @@ public class TryIt {
/** /**
* This method gets the Android SDK location if available and sets the SDK path else downloads the SDK. * This method gets the Android SDK location if available and sets the SDK path else downloads the SDK.
*/ */
private int count = 0;
private void setAndroidSDK() { private void setAndroidSDK() {
sdkConfigFile = new File("sdkConfigLocation"); sdkConfigFile = new File("sdkConfigLocation");
if (!(sdkConfigFile.exists() && !sdkConfigFile.isDirectory())) { if (!(sdkConfigFile.exists() && !sdkConfigFile.isDirectory())) {
//TODO //TODO
Scanner read = new Scanner(System.in, StandardCharsets.UTF_8.toString()); Scanner read = new Scanner(System.in, StandardCharsets.UTF_8.toString());
System.out.print("Do you have an Android SDK installed on your computer (y/N) ? : "); System.out.print("Do you have an Android SDK installed on your computer (y/n) ? : ");
String response = read.next().toLowerCase(); String response = read.nextLine().toLowerCase();
if (response.matches("y")) { if (response.matches("y")) {
setSDKPath(); setSDKPath();
} else { } else if (response.matches("n")) {
getAndroidSDK(); getAndroidSDK();
} else {
if (count < 5) {
System.out.println("Please enter a valid parameter .");
count++;
setAndroidSDK();
return;
} else {
System.out.println("Terminating process");
System.exit(1);
}
} }
} else { } else {
Scanner scanner = null; Scanner scanner = null;
@ -634,7 +646,7 @@ public class TryIt {
*/ */
private void installAgent() { private void installAgent() {
String androidAgentLocation = workingDirectory + Constants.APK_LOCATION; String androidAgentLocation = workingDirectory + Constants.APK_LOCATION;
System.out.println("Installing agent ..."); System.out.println("Installing agent, please wait...");
ProcessBuilder installAgentProcessBuilder = new ProcessBuilder(adbLocation, "install", ProcessBuilder installAgentProcessBuilder = new ProcessBuilder(adbLocation, "install",
androidAgentLocation); androidAgentLocation);
try { try {
@ -722,19 +734,24 @@ public class TryIt {
if (!new File(haxmLocation).mkdirs()) { if (!new File(haxmLocation).mkdirs()) {
makeDirectoryError(haxmLocation, androidSdkHome); makeDirectoryError(haxmLocation, androidSdkHome);
} }
String folderName = "_haxm.zip"; String haxmInstaller;
getTools(System.getProperty(Constants.HAXM_URL), haxmLocation + File.separator String folderName = "extras" + File.separator + "intel" + File.separator
+ folderName); + "Hardware_Accelerated_Execution_Manager" + File.separator + "_haxm.zip";
String haxmInstaller = haxmLocation + File.separator + "silent_install"; getTools(System.getProperty(Constants.HAXM_URL), folderName);
if (osSuffix.equals(Constants.WINDOWS_OS)) { ProcessBuilder processBuilder;
haxmInstaller += Constants.WINDOWS_EXTENSION_BAT; if (osSuffix.equals(Constants.MAC_OS)) {
haxmInstaller = haxmLocation + File.separator + "silent_install.sh";
setExecutePermission(haxmInstaller);
processBuilder = new ProcessBuilder("sudo", haxmInstaller, "-m", "2048", "-log",
androidSdkHome + File.separator + "haxmSilentRun.log");
} else { } else {
haxmInstaller += Constants.MAC_HAXM_EXTENSION; haxmInstaller = haxmLocation + File.separator + "silent_install.bat";
setExecutePermission(haxmInstaller);
processBuilder = new ProcessBuilder(haxmInstaller, "-m", "2048", "-log",
androidSdkHome + File.separator + "haxmSilentRun.log");
} }
setExecutePermission(haxmInstaller);
ProcessBuilder processBuilder = new ProcessBuilder(haxmInstaller, "-m", "2048", "-log", System.out.println("Installing intel HAXM, Please wait . . . ");
workingDirectory + File.separator + "haxmSilentRun.log");
processBuilder.directory(new File(haxmLocation)); processBuilder.directory(new File(haxmLocation));
processBuilder.redirectInput(ProcessBuilder.Redirect.INHERIT); processBuilder.redirectInput(ProcessBuilder.Redirect.INHERIT);
processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT); processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
@ -818,6 +835,7 @@ public class TryIt {
private void checkCacheImg(String deviceId) { private void checkCacheImg(String deviceId) {
File cacheImg = new File(userHome + File.separator + ".android" File cacheImg = new File(userHome + File.separator + ".android"
+ File.separator + "avd" + File.separator + deviceId + ".avd" + File.separator + "cache.img"); + File.separator + "avd" + File.separator + deviceId + ".avd" + File.separator + "cache.img");
System.out.print("Creating cache image, please wait ");
while (!cacheImg.exists()) { while (!cacheImg.exists()) {
System.out.print("."); System.out.print(".");
delay(1000); delay(1000);

@ -23,13 +23,13 @@
<parent> <parent>
<artifactId>android-plugin</artifactId> <artifactId>android-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.mobile.android.ui</artifactId> <artifactId>org.wso2.carbon.device.mgt.mobile.android.ui</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<name>WSO2 Carbon - Mobile Android UI</name> <name>WSO2 Carbon - Mobile Android UI</name>
<packaging>pom</packaging> <packaging>pom</packaging>

@ -147,7 +147,7 @@
<span>Logcat</span> <span>Logcat</span>
</a> </a>
</li> </li>
<li><a href="#3a" data-toggle="tab"> <li><a href="#3a" data-toggle="tab">
<span>Screen Share</span> <span>Screen Share</span>
</a> </a>
</li> </li>
@ -175,27 +175,25 @@
</div> </div>
<textarea id="logcat-response" readonly rows="30"></textarea> <textarea id="logcat-response" readonly rows="30"></textarea>
</div> </div>
<div class="tab-pane" id="3a"> <div class="tab-pane" id="3a">
<button id="btn-start-screen" type="button" class="btn btn-success"> <button id="btn-start-screen" type="button" class="btn btn-success">
Start Start
</button> </button>
<div id="loading-screen" class="hidden"> <div id="loading-screen" class="hidden">
<i class="fw fw-loader fw-spin"></i> <i class="fw fw-loader fw-spin"></i>
<span>Start Screen Sharing....</span> <span>Start Screen Sharing....</span>
</div> </div>
<div id="remote-control-pannel" style="overflow: auto" class="hidden"> <div id="remote-control-pannel" style="overflow: auto" class="hidden">
<canvas id="canvas"></canvas> <canvas id="canvas"></canvas>
</div> </div>
<button id="btn-stop-screen" type="button" class="btn btn-danger hidden"> <button id="btn-stop-screen" type="button" class="btn btn-danger hidden">
Stop Stop
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-default visible-xs-block" role="tabpanel" <div class="panel panel-default visible-xs-block" role="tabpanel"
id="policy_compliance_tab"> id="policy_compliance_tab">
<div class="panel-heading visible-xs collapsed" id="policy_compliance"> <div class="panel-heading visible-xs collapsed" id="policy_compliance">

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>android-plugin</artifactId> <artifactId>android-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>mobile-plugins</artifactId> <artifactId>mobile-plugins</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>carbon-device-mgt-plugins-parent</artifactId> <artifactId>carbon-device-mgt-plugins-parent</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>windows-plugin</artifactId> <artifactId>windows-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -49,7 +49,6 @@ public class DiscoveryServiceImpl implements DiscoveryService {
public static final String FEDERATED = "Federated"; public static final String FEDERATED = "Federated";
private static final String DELIMITER = "@"; private static final String DELIMITER = "@";
private static final int DOMAIN_SEGMENT = 1;
private static Log log = LogFactory.getLog( private static Log log = LogFactory.getLog(
org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.impl.DiscoveryServiceImpl.class); org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.impl.DiscoveryServiceImpl.class);
@ -67,7 +66,7 @@ public class DiscoveryServiceImpl implements DiscoveryService {
String emailId = discoveryRequest.getEmailId(); String emailId = discoveryRequest.getEmailId();
String[] userDomains = emailId.split(DELIMITER); String[] userDomains = emailId.split(DELIMITER);
String domain = userDomains[DOMAIN_SEGMENT]; String domain = userDomains[(userDomains.length)-1];
DiscoveryResponse discoveryResponse; DiscoveryResponse discoveryResponse;
if (!PluginConstants.WindowsVersionProperties.REQUESTED_WIN81_VERSION.equals(discoveryRequest.getVersion()) if (!PluginConstants.WindowsVersionProperties.REQUESTED_WIN81_VERSION.equals(discoveryRequest.getVersion())

@ -102,9 +102,10 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
String message; String message;
ConfigurationEntry licenseEntry = null; ConfigurationEntry licenseEntry = null;
PlatformConfiguration configuration = new PlatformConfiguration(); PlatformConfiguration configuration = new PlatformConfiguration();
configuration.setConfiguration(windowsPlatformConfiguration.getConfiguration());
try { try {
configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
List<ConfigurationEntry> configs = configuration.getConfiguration(); List<ConfigurationEntry> configs = windowsPlatformConfiguration.getConfiguration();
for (ConfigurationEntry entry : configs) { for (ConfigurationEntry entry : configs) {
if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) {
License license = new License(); License license = new License();

@ -23,13 +23,13 @@
<parent> <parent>
<artifactId>windows-plugin</artifactId> <artifactId>windows-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.mobile.windows.ui</artifactId> <artifactId>org.wso2.carbon.device.mgt.mobile.windows.ui</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<name>WSO2 Carbon - Mobile Windows UI</name> <name>WSO2 Carbon - Mobile Windows UI</name>
<packaging>pom</packaging> <packaging>pom</packaging>

@ -17,12 +17,12 @@
data-owner="{{device.owner}}" data-owner="{{device.owner}}"
data-status="{{device.status}}"> data-status="{{device.status}}">
{{device.owner}}'s {{device.name}} {{device.owner}}'s {{device.name}}
<a id="device-info-tooltip" href="#" data-toggle="tooltip" title="Device Identifier: {{device.deviceIdentifier}} </h1>
<a id="device-info-tooltip" href="#" data-toggle="tooltip" title="Device Identifier: {{device.deviceIdentifier}}
Firmware Build Date: {{device.osBuildDate}} Firmware Build Date: {{device.osBuildDate}}
UDID: {{device.udid}}"> UDID: {{device.udid}}">
<i class="fw fw-info"></i> <i class="fw fw-info"></i>
</a> </a>
</h1>
{{#if device.model}} {{#if device.model}}
<h4>{{device.vendor}} {{device.model}}</h4> <h4>{{device.vendor}} {{device.model}}</h4>
{{/if}} {{/if}}

@ -91,7 +91,7 @@ function onRequest(context) {
viewModel["ramUsage"]["value"] = (filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"]); viewModel["ramUsage"]["value"] = (filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"]);
viewModel["internalMemory"] = {}; viewModel["internalMemory"] = {};
viewModel["internalMemory"]["value"] = Math.round((filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"]) / 1024); viewModel["internalMemory"]["value"] = replaceNaNVal(Math.round((filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"]) / 1024));
} }
if (!filteredDeviceData["initialDeviceInfo"] && !filteredDeviceData["latestDeviceInfo"]) { if (!filteredDeviceData["initialDeviceInfo"] && !filteredDeviceData["latestDeviceInfo"]) {
@ -118,4 +118,11 @@ function onRequest(context) {
deviceViewData["autoCompleteParams"] = autoCompleteParams; deviceViewData["autoCompleteParams"] = autoCompleteParams;
deviceViewData["permissions"] = permissions; deviceViewData["permissions"] = permissions;
return deviceViewData; return deviceViewData;
function replaceNaNVal(val) {
if (isNaN(val)) {
return "N/A";
}
return val;
}
} }

@ -84,7 +84,7 @@ $(document).ready(function () {
toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
}); });
var windowsConfigAPI = "/api/device-mgt/windows/v1.0/services/configuration"; var windowsConfigAPI = "/api/device-mgt/windows/v1.0/configuration";
invokerUtil.get( invokerUtil.get(
windowsConfigAPI, windowsConfigAPI,
@ -193,24 +193,24 @@ $(document).ready(function () {
$("#config-save-form").addClass("hidden"); $("#config-save-form").addClass("hidden");
$("#record-created-msg").removeClass("hidden"); $("#record-created-msg").removeClass("hidden");
} else if (data == 500) { } else if (data == 500) {
$(errorMsg).text("Exception occurred at backend."); $(errorMsgWindows).text("Exception occurred at backend.");
} else if (data == 400) { } else if (data == 400) {
$(errorMsg).text("Configurations cannot be empty."); $(errorMsgWindows).text("Configurations cannot be empty.");
} else { } else {
$(errorMsg).text("An unexpected error occurred."); $(errorMsgWindows).text("An unexpected error occurred.");
} }
$(errorMsgWrapperWindows).removeClass("hidden"); $(errorMsgWrapperWindows).removeClass("hidden");
}, function (data) { }, function (data) {
data = data.status; data = data.status;
if (data == 500) { if (data == 500) {
$(errorMsg).text("Exception occurred at backend."); $(errorMsgWindows).text("Exception occurred at backend.");
} else if (data == 403) { } else if (data == 403) {
$(errorMsg).text("Action was not permitted."); $(errorMsgWindows).text("Action was not permitted.");
} else { } else {
$(errorMsg).text("An unexpected error occurred."); $(errorMsgWindows).text("An unexpected error occurred.");
} }
$(errorMsgWrapper).removeClass("hidden"); $(errorMsgWrapperWindows).removeClass("hidden");
} }
); );
} }

@ -10,7 +10,9 @@
"perm:windows:lock-reset", "perm:windows:lock-reset",
"perm:windows:reboot", "perm:windows:reboot",
"perm:windows:location", "perm:windows:location",
"perm:windows:disenroll" "perm:windows:disenroll",
"perm:windows:manage-configuration",
"perm:windows:view-configuration"
], ],
"analyticsEnabled": "false", "analyticsEnabled": "false",
"groupingEnabled": "false", "groupingEnabled": "false",

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>windows-plugin</artifactId> <artifactId>windows-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>mobile-plugins</artifactId> <artifactId>mobile-plugins</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>analytics-feature</artifactId> <artifactId>analytics-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,13 +23,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>analytics-feature</artifactId> <artifactId>analytics-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.analytics.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.analytics.feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - IoT Server Analytics Feature</name> <name>WSO2 Carbon - IoT Server Analytics Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -23,13 +23,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>analytics-feature</artifactId> <artifactId>analytics-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.iot.device.statistics.dashboard.feature</artifactId> <artifactId>org.wso2.carbon.iot.device.statistics.dashboard.feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - IoT Server Analytics Feature</name> <name>WSO2 Carbon - IoT Server Analytics Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>analytics-feature</artifactId> <artifactId>analytics-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>carbon-device-mgt-plugins-parent</artifactId> <artifactId>carbon-device-mgt-plugins-parent</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

@ -23,13 +23,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>androidsense-plugin-feature</artifactId> <artifactId>androidsense-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - IoT Server Android Sense Analytics Feature</name> <name>WSO2 Carbon - IoT Server Android Sense Analytics Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -23,13 +23,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>androidsense-plugin-feature</artifactId> <artifactId>androidsense-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.backend.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.androidsense.backend.feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - IoT Server Android Sense Backend Feature</name> <name>WSO2 Carbon - IoT Server Android Sense Backend Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -23,13 +23,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>androidsense-plugin-feature</artifactId> <artifactId>androidsense-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.ui.feature</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.androidsense.ui.feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - IoT Server Android Sense UI Feature</name> <name>WSO2 Carbon - IoT Server Android Sense UI Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>device-types-feature</artifactId> <artifactId>device-types-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>arduino-plugin-feature</artifactId> <artifactId>arduino-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>arduino-plugin-feature</artifactId> <artifactId>arduino-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>arduino-plugin-feature</artifactId> <artifactId>arduino-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>device-types-feature</artifactId> <artifactId>device-types-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,13 +22,13 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>carbon-device-mgt-plugins-parent</artifactId> <artifactId>carbon-device-mgt-plugins-parent</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>device-types-feature</artifactId> <artifactId>device-types-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - Device Management IoT Plugins Feature</name> <name>WSO2 Carbon - Device Management IoT Plugins Feature</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>raspberrypi-plugin-feature</artifactId> <artifactId>raspberrypi-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>raspberrypi-plugin-feature</artifactId> <artifactId>raspberrypi-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>raspberrypi-plugin-feature</artifactId> <artifactId>raspberrypi-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>device-types-feature</artifactId> <artifactId>device-types-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>virtual-fire-alarm-plugin-feature</artifactId> <artifactId>virtual-fire-alarm-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>virtual-fire-alarm-plugin-feature</artifactId> <artifactId>virtual-fire-alarm-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>virtual-fire-alarm-plugin-feature</artifactId> <artifactId>virtual-fire-alarm-plugin-feature</artifactId>
<version>4.0.35-SNAPSHOT</version> <version>4.0.53-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save