Fix issues in connectedcup device

application-manager-new
charitha 8 years ago
parent 85c5be77c3
commit 5feb7f82f2

@ -1,8 +1,47 @@
<iframe src="{{dashboardserverURL}}/portal/gadgets/connected-cup-analytics/landing" width="100%" height="1700" frameBorder="0"></iframe> {{!
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
<style> WSO2 Inc. licenses this file to you under the Apache License,
#rangeSliderWrapper{ display: none;} Version 2.0 (the "License"); you may not use this file except
</style> 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.
}}
<span id="connectedcup-details" data-devices="{{devices}}" data-devicename="{{device.name}}"
data-deviceid="{{device.deviceIdentifier}}"
data-appcontext="{{@app.context}}"></span>
<div id="connectedcup-div-chart" data-backend-api-url= {{backendApiUri}}>
<div class="chartWrapper" id="chartWrapper">
<h3 id="span-title">Temperature</h3>
<div id="y_axis-temperature" class="custom_y_axis"></div>
<div class="legend_container">
<div id="smoother-temperature" title="Smoothing"></div>
<div id="legend-temperature"></div>
</div>
<div id="chart-temperature" class="custom_rickshaw_graph"></div>
<div id="x_axis-temperature" class="custom_x_axis"></div>
<div id="slider-temperature" class="custom_slider"></div>
</div>
<div class="chartWrapper" id="chartWrapper">
<h3 id="span-title">Coffee Level</h3>
<div id="y_axis-coffeelevel" class="custom_y_axis"></div>
<div class="legend_container">
<div id="smoother-coffeelevel" title="Smoothing"></div>
<div id="legend-coffeelevel"></div>
</div>
<div id="chart-coffeelevel" class="custom_rickshaw_graph"></div>
<div id="x_axis-coffeelevel" class="custom_x_axis"></div>
<div id="slider-coffeelevel" class="custom_slider"></div>
</div>
</div>
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/connectedcup.js"}} {{js "js/connectedcup.js"}}

@ -17,29 +17,25 @@
*/ */
function onRequest(context) { function onRequest(context) {
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devices = context.unit.params.devices; var devices = context.unit.params.devices;
var deviceType = context.uriParams.deviceType; var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter('deviceId'); var deviceId = request.getParameter("deviceId");
if (devices) { if (devices) {
return { return {
'devices': stringify(devices), "devices": stringify(devices),
'backendApiUri': devicemgtProps['httpsURL'] + '/connectedcup/stats/', "backendApiUri": "/connectedcup/stats/"
'dashboardserverURL': devicemgtProps['dashboardserverURL']
}; };
} else if (deviceType && deviceId) { } else if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require('/app/modules/device.js').deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId); var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != 'error') { if (device && device.status != "error") {
return { return {
'device': device.content, "device": device.content,
'backendApiUri': devicemgtProps['httpsURL'] + '/connectedcup/stats/' + deviceId, "backendApiUri": "/connectedcup/stats/" + deviceId
'dashboardserverURL': devicemgtProps['dashboardserverURL']
}; };
} 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!");
exit(); exit();
} }
} }

@ -224,7 +224,8 @@ function drawGraph_connectedcup(from, to) {
if (devices) { if (devices) {
getData(); getData();
} else { } else {
var backendApiUrl = $('#connectedcup-div-chart').data('backend-api-url') + '/sensors/temperature' + '?from=' + from + '&to=' + to; var backendApiUrl = $('#connectedcup-div-chart').data('backend-api-url') + '/sensors/temperature'
+ '?from=' + from + '&to=' + to;
var successCallback = function (data) { var successCallback = function (data) {
if (data) { if (data) {
drawTemperatureLineGraph(JSON.parse(data)); drawTemperatureLineGraph(JSON.parse(data));
@ -249,8 +250,7 @@ function drawGraph_connectedcup(from, to) {
return; return;
} }
var backendApiUrl = $('#connectedcup-div-chart').data('backend-api-url') + devices[deviceIndex].deviceIdentifier var backendApiUrl = $('#connectedcup-div-chart').data('backend-api-url') + devices[deviceIndex].deviceIdentifier
+ '/sensors/temperature' + '/sensors/temperature?from=' + from + '&to=' + to;
+ '?from=' + from + '&to=' + to;
var successCallback = function (data) { var successCallback = function (data) {
if (data) { if (data) {
drawTemperatureLineGraph(JSON.parse(data)); drawTemperatureLineGraph(JSON.parse(data));
@ -264,7 +264,7 @@ function drawGraph_connectedcup(from, to) {
getData(); getData();
}); });
var coffeeLevelApiUrl = $('#connectedcup-div-chart').data('backend-api-url') + devices[deviceIndex].deviceIdentifier var coffeeLevelApiUrl = $('#connectedcup-div-chart').data('backend-api-url') + devices[deviceIndex].deviceIdentifier
+ '/sensors/coffeelevel' + '?from=' + from + '&to=' + to; + '/sensors/coffeelevel?from=' + from + '&to=' + to;
var successCallbackCoffeeLevel = function (data) { var successCallbackCoffeeLevel = function (data) {
if (data) { if (data) {

@ -24,26 +24,23 @@
</div> </div>
{{/zone}} {{/zone}}
{{#zone "device-detail-properties"}} {{#zone "device-view-tabs"}}
<div class="media"> <li class="active"><a class="list-group-item" href="#device_statistics" role="tab"
<div class="media-left col-xs-12 col-sm-2 col-md-2 col-lg-2"> data-toggle="tab" aria-controls="device_statistics">Device
<ul class="list-group" role="tablist"> Statistics</a>
<li class="active">
<a class="list-group-item" href="#device_statistics" role="tab" data-toggle="tab"
aria-controls="device_statistics">Device Statistics</a>
</li> </li>
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab" <li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
aria-controls="event_log">Operations Log</a></li> aria-controls="event_log">Operations Log</a></li>
</ul> {{/zone}}
</div>
<div class="media-body add-padding-left-5x remove-padding-xs tab-content"> {{#zone "device-view-tab-contents"}}
<div class="panel-group tab-content">
<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> <div class="panel-heading">Device Statistics</div>
{{unit "cdmf.unit.device.type.connectedcup.realtime.analytics-view" device=device}} {{unit "cdmf.unit.device.type.connectedcup.realtime.analytics-view" device=device}}
</div> </div>
<div class="panel panel-default tab-pane" id="event_log" role="tabpanel" <div class="panel panel-default tab-pane" id="event_log" role="tabpanel"
aria-labelledby="event_log"> aria-labelledby="event_log">
<div class="panel-heading">Operations Log <span><a href="#" <div class="panel-heading">Operations Log <span><a href="#"
@ -52,9 +49,9 @@
<div class="panel-body"> <div class="panel-body">
<div id="operations-spinner" class="wr-advance-operations-init hidden"> <div id="operations-spinner" class="wr-advance-operations-init hidden">
<br> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i class="fw fw-settings fw-spin fw-2x"></i> <i class="fw fw-settings fw-spin fw-2x"></i>
&nbsp;&nbsp;&nbsp;
Loading Operations Log . . . Loading Operations Log . . .
<br> <br>
<br> <br>
@ -67,7 +64,4 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div>
{{/zone}} {{/zone}}

@ -18,26 +18,23 @@
function onRequest(context) { function onRequest(context) {
var log = new Log('detail.js');
var deviceType = context.uriParams.deviceType; var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter('id'); var deviceId = request.getParameter('id');
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
if (deviceType && deviceId) { if (deviceType && deviceId) {
var deviceModule = require('/app/modules/device.js').deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js").deviceModule;
var device = deviceModule.viewDevice(deviceType, deviceId); var deviceData = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != 'error') { if (deviceData && deviceData.status != 'error') {
var device = deviceData.content;
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var tokenPair = session.get(constants.ACCESS_TOKEN_PAIR_IDENTIFIER); var tokenPair = JSON.parse(session.get(constants.TOKEN_PAIR));
var token = '';
if (tokenPair) { if (tokenPair) {
token = tokenPair.accessToken; device.accessToken = tokenPair.accessToken;
} }
device.accessToken = token; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
device.ip = devicemgtProps['httpsWebURL']; device.ip = devicemgtProps['httpsWebURL'];
return {'device': device.content}; return {'device': deviceData.content};
} }
} }
} }

@ -1,8 +1,25 @@
{{!
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.
}}
{{unit "cdmf.unit.lib.rickshaw-graph"}} {{unit "cdmf.unit.lib.rickshaw-graph"}}
<div id="div-chart" data-websocketurl="{{websocketEndpoint}}"> <div id="div-chart" data-websocketurl="{{websocketEndpoint}}">
<div class="chartWrapper" id="chartWrapper"> <div class="chartWrapper" id="chartWrapper">
<div id="y_axis" class="custom_y_axis">Temperature</div> <div id="y_axis" class="custom_y_axis" style="margin-top: -20px;">Temperature</div>
<div class="legend_container"> <div class="legend_container">
<div id="smoother" title="Smoothing"></div> <div id="smoother" title="Smoothing"></div>
<div id="legend"></div> <div id="legend"></div>

@ -17,16 +17,28 @@
*/ */
function onRequest(context) { function onRequest(context) {
var log = new Log("stats.js");
var carbonServer = require("carbon").server;
var device = context.unit.params.device; var device = context.unit.params.device;
var devicemgtProps = require('/app/conf/devicemgt-props.js').config(); 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 websocketEndpoint = devicemgtProps['wssURL'].replace('https', 'wss'); var websocketEndpoint = devicemgtProps["wssURL"].replace("https", "wss");
var tokenPair = session.get(constants.ACCESS_TOKEN_PAIR_IDENTIFIER); var jwtService = carbonServer.osgiService(
var token = ''; 'org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService');
var jwtClient = jwtService.getJWTClient();
var encodedClientKeys = session.get(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"]);
var token = "";
if (encodedClientKeys) {
var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"];
var resp = tokenUtil.decode(encodedClientKeys).split(":");
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {});
if (tokenPair) { if (tokenPair) {
token = tokenPair.accessToken; token = tokenPair.accessToken;
} }
websocketEndpoint = websocketEndpoint + '/secured-outputui/org.wso2.iot.connectedcup/1.0.0?' + websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.temperature/1.0.0?"
'token=' + token + '&deviceId=' + device.deviceIdentifier; + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type;
return {'device': device, 'websocketEndpoint': websocketEndpoint}; var websocketToken= {'name':'websocket-token','value': token, 'path':'/', "maxAge":18000};
response.addCookie(websocketToken);
}
return {"device": device, "websocketEndpoint": websocketEndpoint};
} }

@ -18,41 +18,30 @@
var ws; var ws;
var graph; var graph;
var temperatureData = []; var chartData = [];
var coffeeData = []; var palette = new Rickshaw.Color.Palette({scheme: "classic9"});
var temperature = 0;
var coffeelevel = 0;
var lastTime = 0;
var palette = new Rickshaw.Color.Palette({scheme: 'classic9'});
$(window).load(function () { $(window).load(function () {
var tNow = new Date().getTime() / 1000; var tNow = new Date().getTime() / 1000;
for (var i = 0; i < 30; i++) { for (var i = 0; i < 30; i++) {
temperatureData.push({ chartData.push({
x: tNow - (30 - i) * 15,
y: parseFloat(0)
});
coffeeData.push({
x: tNow - (30 - i) * 15, x: tNow - (30 - i) * 15,
y: parseFloat(0) y: parseFloat(0)
}); });
} }
graph = new Rickshaw.Graph({ graph = new Rickshaw.Graph({
element: document.getElementById('chart'), element: document.getElementById("chart"),
width: $('#div-chart').width() - 50, width: $("#div-chart").width() - 50,
height: 300, height: 300,
renderer: 'line', renderer: "line",
interpolation: "linear",
padding: {top: 0.2, left: 0.0, right: 0.0, bottom: 0.2}, padding: {top: 0.2, left: 0.0, right: 0.0, bottom: 0.2},
xScale: d3.time.scale(), xScale: d3.time.scale(),
series: [{ series: [{
'color': palette.color(), 'color': palette.color(),
'data': coffeeData, 'data': chartData,
'name': 'Coffee Level' 'name': "Temperature"
}, {
'color': palette.color(),
'data': temperatureData,
'name': 'Temperature'
}] }]
}); });
@ -77,11 +66,11 @@ $(window).load(function () {
formatter: function (series, x, y) { formatter: function (series, x, y) {
var date = '<span class="date">' + moment(x * 1000).format('Do MMM YYYY h:mm:ss a') + '</span>'; 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>'; var swatch = '<span class="detail_swatch" style="background-color: ' + series.color + '"></span>';
return swatch + series.name + ': ' + parseInt(y) + '<br>' + date; return swatch + series.name + ": " + parseInt(y) + '<br>' + date;
} }
}); });
var websocketUrl = $('#div-chart').data('websocketurl'); var websocketUrl = $("#div-chart").data("websocketurl");
connect(websocketUrl) connect(websocketUrl)
}); });
@ -101,25 +90,12 @@ 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 (lastTime < parseInt(dataPoint[4]) / 1000) { chartData.push({
lastTime = parseInt(dataPoint[4]) / 1000; x: parseInt(dataPoint[4]) / 1000,
if (dataPoint[3] == 'temperature') { y: parseFloat(dataPoint[5])
temperature = parseFloat(dataPoint[5]);
} else if (dataPoint[3] == 'coffeelevel') {
coffeelevel = parseFloat(dataPoint[6]);
}
temperatureData.push({
x: lastTime,
y: temperature
});
temperatureData.shift();
coffeeData.push({
x: lastTime,
y: coffeelevel
}); });
coffeeData.shift(); chartData.shift();
graph.update(); graph.update();
}
}; };
} }
} }

@ -0,0 +1,66 @@
/*
* Copyright (c) 2017, 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.
*/
.circle {
background: none repeat scroll 0 0 #191919;
border-radius: 50px;
height: 50px;
padding: 10px;
width: 50px;
color: #fff;
}
.padding-top-double {
padding-top: 20px;
}
.padding-double {
padding: 20px;
}
.grey {
color: #333;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #7f7f7f;
margin: 1em 0;
padding: 0;
opacity: 0.2;
}
.light-grey {
color: #7c7c7c;
}
.uppercase {
text-transform: uppercase;
}
.grey-bg {
background-color: #f6f4f4;
}
.doc-link{
background: none;
color: #000;
padding: 10px 0px;
}
.doc-link a {
color: #006eff;
}

@ -16,13 +16,13 @@
* under the License. * under the License.
*/ */
var modalPopup = '.wr-modalpopup'; var modalPopup = ".modal";
var modalPopupContainer = modalPopup + ' .modalpopup-container'; var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + ' .modalpopup-content'; var modalPopupContent = modalPopup + " .modal-content";
var body = 'body'; var body = "body";
/* /*
* set popup maximum height function. * Set popup maximum height function.
*/ */
function setPopupMaxHeight() { function setPopupMaxHeight() {
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30))); $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));
@ -33,36 +33,14 @@ function setPopupMaxHeight() {
* show popup function. * show popup function.
*/ */
function showPopup() { function showPopup() {
$(modalPopup).show(); $(modalPopup).modal('show');
setPopupMaxHeight(); setPopupMaxHeight();
$('#downloadForm').validate({ var deviceType = "";
rules: {
deviceName: {
minlength: 4,
required: true
}
},
highlight: function (element) {
$(element).closest('.control-group').removeClass('success').addClass('error');
},
success: function (element) {
$(element).closest('.control-group').removeClass('error').addClass('success');
$('label[for=deviceName]').remove();
}
});
var deviceType = '';
$('.deviceType').each(function () { $('.deviceType').each(function () {
if (this.value != '') { if (this.value != '') {
deviceType = this.value; deviceType = this.value;
} }
}); });
if (deviceType == 'digitaldisplay') {
$('.sketchType').remove();
$('input[name="sketchType"][value="digitaldisplay"]').prop('checked', true);
$('label[for="digitaldisplay"]').text('Simple Agent');
} else {
$('.sketchTypes').remove();
}
} }
/* /*
@ -72,7 +50,7 @@ function hidePopup() {
$('label[for=deviceName]').remove(); $('label[for=deviceName]').remove();
$('.control-group').removeClass('success').removeClass('error'); $('.control-group').removeClass('success').removeClass('error');
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).hide(); $(modalPopup).modal('hide');
} }
/* /*
@ -88,46 +66,9 @@ function attachEvents() {
* when a user clicks on "Download" link * when a user clicks on "Download" link
* 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 deviceType = $(this).data('devicetype');
var downloadDeviceAPI = '/devicemgt/api/devices/sketch/generate_link';
var payload = {'sketchType': sketchType, 'deviceType': deviceType};
$(modalPopupContent).html($('#download-device-modal-content').html()); $(modalPopupContent).html($('#download-device-modal-content').html());
showPopup(); showPopup();
var deviceName;
$('a#download-device-download-link').click(function () {
$('.new-device-name').each(function () {
if (this.value != '') {
deviceName = this.value;
}
});
$('label[for=deviceName]').remove();
if (deviceName && deviceName.length >= 4) {
payload.deviceName = deviceName;
invokerUtil.post(
downloadDeviceAPI,
payload,
function (data, textStatus, jqxhr) {
doAction(data);
},
function (data) {
doAction(data);
}
);
} else if (deviceName) {
$('.controls').append('<label for="deviceName" generated="true" class="error" style="display: inline-block;">Please enter at least 4 characters.</label>');
$('.control-group').removeClass('success').addClass('error');
} else {
$('.controls').append('<label for="deviceName" generated="true" class="error" style="display: inline-block;">This field is required.</label>');
$('.control-group').removeClass('success').addClass('error');
}
});
$('a#download-device-cancel-link').click(function () {
hidePopup();
});
}); });
} }
@ -141,33 +82,40 @@ function downloadAgent() {
values[this.name] = $(this).val(); values[this.name] = $(this).val();
}); });
var deviceName = $inputs[0].value;
$('.new-device-name').each(function () {
if (this.value != '') {
deviceName = this.value;
}
});
var deviceNameFormat = /^[^~?!#$:;%^*`+={}\[\]\\()|<>,'"]{1,30}$/;
if (deviceName && deviceName.length < 4) {
$("#invalid-username-error-msg span").text("Device name should be more than 3 letters!");
$("#invalid-username-error-msg").removeClass("hidden");
} else if (deviceName && deviceNameFormat.test(deviceName)) {
var payload = {}; var payload = {};
payload.name = $inputs[0].value; payload.name = $inputs[0].value;
payload.owner = $inputs[1].value; payload.owner = $inputs[1].value;
var connectedCupRegisterURL = '/connectedcup/device/register?name=' + encodeURI(payload.name); var connectedCupRegisterURL = '/connectedcup/device/register?name=' + encodeURI(payload.name);
invokerUtil.post( invokerUtil.post(
connectedCupRegisterURL, connectedCupRegisterURL,
payload, payload,
function (data, textStatus, jqxhr) { function (data, textStatus, jqxhr) {
$(modalPopupContent).html($('#device-created-content').html());
$('#device-created-link').click(function () {
hidePopup(); hidePopup();
},
function (data) {
hidePopup();
}
);
var deviceName;
$('.new-device-name').each(function () {
if (this.value != '') {
deviceName = this.value;
}
}); });
if (deviceName && deviceName.length >= 4) {
setTimeout(function () { setTimeout(function () {
hidePopup(); hidePopup();
}, 1000); }, 1000);
},
function (data) {
doAction(data)
}
);
} else {
$("#invalid-username-error-msg span").text("Invalid device name");
$("#invalid-username-error-msg").removeClass("hidden");
} }
} }

@ -1,16 +1,28 @@
<div class="col-lg-12 margin-top-double" xmlns="http://www.w3.org/1999/html"> {{!
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.
}}
<div class="col-lg-12 margin-top-double">
<h1 class="grey ">Connected Cup</h1> <h1 class="grey ">Connected Cup</h1>
<hr> <hr>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top"> <div class="col-xs-12 col-sm-4 col-md-3 col-lg-3 padding-top">
<img src="{{@unit.publicUri}}/images/coffeecup.png" class="img-responsive"> <img src="{{@unit.publicUri}}/images/coffeecup.png" class="img-responsive">
</div> </div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top"> <div class="col-xs-12 col-sm-8 col-md-9 col-lg-9 padding-top">
<h4 class="doc-link">Click
<a href="https://docs.wso2.com/display/IoTS100/Sample+-+Getting+the+Connected+Cup+into+the+WSO2+IoT+Server"
target="_blank">[ here ]</a> for latest instructions and troubleshooting.</h4>
</div>
<div class="col-xs-12 col-sm-6 col-md-8 col-lg-8 padding-top">
<h3 class="uppercase">What it Does</h3> <h3 class="uppercase">What it Does</h3>
<hr> <hr>
<p class="grey margin-top">Connected cup is a virtual simulation of a smart coffee cup from the IOT Hardware <p class="grey margin-top">Connected cup is a virtual simulation of a smart coffee cup from the IOT Hardware
@ -18,35 +30,36 @@
around with the temperature and Coffee level. And the information will be relayed back to around with the temperature and Coffee level. And the information will be relayed back to
the IoTServer and summarized. the IoTServer and summarized.
</p> </p>
<p>The device supports communication via HTTPS only.</p> <p>The device supports communication via HTTPS only.</p>
<br> <br>
<h3 class="uppercase">What You Need</h3> <h3 class="uppercase">What You Need</h3>
<hr> <hr>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"><span class="circle">STEP 01</span>&nbsp;&nbsp;&nbsp;Go ahead and <li class="padding-top-double">
[Crete an Instance] of the Device. <span class="badge">STEP 01</span>
Go ahead and [Download] the Device.
</li> </li>
<li class="padding-top-double"><span class="circle">STEP 02</span>&nbsp;&nbsp;&nbsp;Give a name to your <li>
Connected Cup instance. <span class="badge">STEP 02</span>
Proceed to [Prepare] section.
</li> </li>
<li class="padding-top-double"><span class="circle">STEP 03</span>&nbsp;&nbsp;&nbsp;Read <li>
[Try Out] section <span class="badge">STEP 03</span>
to further experiment with the device. Read [Try Out] section to further experiment with the device.
</li> </li>
</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"
class="btn-operations" target="_blank"><i class="fw fw-api"></i> View API</i> &nbsp;</a> class="btn-operations"
<a href="#" class="download-link btn-operations"><i class="fw fw-download"></i>Create an Instance</a> target="_blank"><i class="fw fw-api"></i> View API</i>
</a>
<a href="#" class="download-link btn-operations">
<i class="fw fw-download"></i>Create an instance</a>
<div id="download-device-modal-content" class="hide"> <div id="download-device-modal-content" class="hide">
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">
<div class="col-md-7 col-centered"> <div class="col-md-7 col-centered">
<h3>Name your device and download the agent from following link.</h3> <h3>Name your Connected cup instance.</h3>
<br/> <br/>
<form id="downloadForm"> <form id="downloadForm">
<div class="control-group"> <div class="control-group">
@ -69,16 +82,16 @@
</div> </div>
</div> </div>
<div id="download-device-modal-content-links" class="hide"> <div id="device-created-content" class="hide">
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">
<div class="col-md-7 col-centered center-container"> <div class="col-md-7 col-centered center-container">
<h3>Please download the file from following link(Press CTRL+C).</h3> <h3>Connected cup device created. </h3>
<br/> <p> Select instance of the Connected Cup you created from the "Devices" section. </p>
<div class="buttons">
<div> <a href="#" id="device-created-link" class="btn-operations">
<input id="download-device-url" style="color:#3f3f3f;padding:5px" &nbsp;&nbsp;&nbsp;&nbsp;OK&nbsp;&nbsp;&nbsp;&nbsp;
type="text" value="" placeholder="Type here" size="60"> </a>
</div> </div>
</div> </div>
</div> </div>
@ -176,75 +189,28 @@
<p class="grey margin-top">Access your Device</p> <p class="grey margin-top">Access your Device</p>
<br/> <br/>
<ul> <ul>
<p class="padding-top-double"><span class="circle">01</span> Select instance of the Connected Cup you created from the "Devices" section and click "View".</p> <p class="padding-top-double"><span class="circle">01</span> Select instance of the Connected Cup you created from the "Devices" section.</p>
<p class="padding-top-double"><span class="circle">02</span> Click the [Go to Device] button from the "Operations" section and you will be able to view and experiment with the device.</p> <p class="padding-top-double"><span class="circle">02</span> Click the [Go to Device] button from the "Operations" section and you will be able to view and experiment with the device.</p>
</ul> </ul>
<br> <br>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-12 padding-double"> <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-double">
<h3 class="uppercase">Connected Cup Agent</h3><hr> <h3 class="uppercase">Connected Cup Agent</h3><hr>
<p class="grey margin-top">Click on the image to zoom</p> <p class="grey margin-top">Click on the image to zoom</p>
<center> <center>
<a href="{{@unit.publicUri}}/images/coffee_stats.png" target="_blank"> <a href="{{@unit.publicUri}}/images/coffee_stats.png" target="_blank">
<img src="{{@unit.publicUri}}/images/coffee_stats.png" class="img-responsive" style="max-width: 500px; max-height: 500px"> <img src="{{@unit.publicUri}}/images/coffee_stats.png" class="img-responsive">
</a> </a>
</center> </center>
<br/> <br/>
</div> </div>
</div> {{#zone "topCss"}}
{{css "css/styles.css"}}
<style type="text/css"> {{/zone}}
.circle {
background: none repeat scroll 0 0 #191919;
border-radius: 50px;
height: 50px;
padding: 10px;
width: 50px;
color: #fff;
}
.padding-top-double {
padding-top: 20px;
}
.padding-double {
padding: 20px;
}
.grey {
color: #333;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #7f7f7f;
margin: 1em 0;
padding: 0;
opacity: 0.2;
}
.light-grey {
color: #7c7c7c;
}
.uppercase {
text-transform: uppercase;
}
.grey-bg {
background-color: #f6f4f4;
}
.doc-link {
background: #11375B;
padding: 20px;
color: white;
margin-top: 0;
}
.doc-link a {
color: white;
}
</style>
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "/js/download.js"}} {{js "/js/download.js"}}
{{js "/js/jquery.validate.js"}} {{js "/js/jquery.validate.js"}}
{{/zone}} {{/zone}}

@ -24,6 +24,10 @@
<version>1</version> <version>1</version>
</parent> </parent>
<modules>
<module>connectedcup</module>
</modules>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.iot.devicemgt-plugins</groupId> <groupId>org.wso2.iot.devicemgt-plugins</groupId>
<artifactId>iot-devicetype-samples</artifactId> <artifactId>iot-devicetype-samples</artifactId>
@ -46,13 +50,13 @@
<goal>p2-repo-gen</goal> <goal>p2-repo-gen</goal>
</goals> </goals>
<configuration> <configuration>
<metadataRepository>file:\${basedir}/p2-repo</metadataRepository> <metadataRepository>file:${basedir}/p2-repo</metadataRepository>
<artifactRepository>file:\${basedir}/p2-repo</artifactRepository> <artifactRepository>file:${basedir}/p2-repo</artifactRepository>
<publishArtifacts>true</publishArtifacts> <publishArtifacts>true</publishArtifacts>
<publishArtifactRepository>true</publishArtifactRepository> <publishArtifactRepository>true</publishArtifactRepository>
<featureArtifacts> <featureArtifacts>
<featureArtifactDef> <featureArtifactDef>
org.coffeeking:org.coffeeking.connectedcup.feature:\${carbon.device.mgt.plugin.version} org.coffeeking:org.coffeeking.connectedcup.feature:${carbon.device.mgt.plugin.version}
</featureArtifactDef> </featureArtifactDef>
</featureArtifacts> </featureArtifacts>
</configuration> </configuration>
@ -65,14 +69,14 @@
</goals> </goals>
<configuration> <configuration>
<profile>default</profile> <profile>default</profile>
<metadataRepository>file:\${basedir}/p2-repo</metadataRepository> <metadataRepository>file:${basedir}/p2-repo</metadataRepository>
<artifactRepository>file:\${basedir}/p2-repo</artifactRepository> <artifactRepository>file:${basedir}/p2-repo</artifactRepository>
<destination>\${basedir}/../core/repository/components</destination> <destination>${basedir}/../core/repository/components</destination>
<deleteOldProfileFiles>false</deleteOldProfileFiles> <deleteOldProfileFiles>false</deleteOldProfileFiles>
<features> <features>
<feature> <feature>
<id>org.coffeeking.connectedcup.feature.group</id> <id>org.coffeeking.connectedcup.feature.group</id>
<version>\${carbon.device.mgt.plugin.version}</version> <version>${carbon.device.mgt.plugin.version}</version>
</feature> </feature>
</features> </features>
</configuration> </configuration>

Loading…
Cancel
Save