application-manager-new
charitha 8 years ago
parent 1b42f08a01
commit f071ce0d84

@ -19,11 +19,9 @@
<html> <html>
<head> <head>
<title>Connected Coffee Cup</title> <title>Connected Coffee Cup</title>
<link rel="stylesheet" href="css/coffee.css"> <link rel="stylesheet" href="css/coffee.css">
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
</head> </head>
@ -48,7 +46,6 @@
if (token != null) { if (token != null) {
request.getSession().setAttribute("token", token); request.getSession().setAttribute("token", token);
} }
%> %>
<div class="container"> <div class="container">
@ -100,22 +97,19 @@
<script src="js/libs/htmlpreview.min.js"></script> <script src="js/libs/htmlpreview.min.js"></script>
<script>HTMLPreview.replaceAssets();</script> <script>HTMLPreview.replaceAssets();</script>
<script> <script>
$("#order-cup").click(function () { $('#order-cup').click(function () {
var deviceId = '<%=request.getSession().getAttribute("deviceId")%>'; var deviceId = '<%=request.getSession().getAttribute("deviceId")%>';
var deviceOwner = '<%=request.getSession().getAttribute("deviceOwner")%>'; var deviceOwner = '<%=request.getSession().getAttribute("deviceOwner")%>';
var token = '<%=request.getSession().getAttribute("token")%>'; var token = '<%=request.getSession().getAttribute("token")%>';
var url = "/connectedcup/controller/ordercoffee?deviceId=" + deviceId + "&deviceOwner=" + deviceOwner; var url = '/connectedcup/controller/ordercoffee?deviceId=' + deviceId + '&deviceOwner=' + deviceOwner;
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: url, url: url,
headers: { headers: {
"Authorization": "Bearer " + token 'Authorization': 'Bearer ' + token
} }
}); });
}); });
function sendData() { function sendData() {
@ -123,19 +117,18 @@
var deviceOwner = '<%=request.getSession().getAttribute("deviceOwner")%>'; var deviceOwner = '<%=request.getSession().getAttribute("deviceOwner")%>';
var tenantDomain = '<%=request.getSession().getAttribute("tenantDomain")%>'; var tenantDomain = '<%=request.getSession().getAttribute("tenantDomain")%>';
if (tenantDomain == null) { if (tenantDomain == null) {
tenantDomain = "carbon.super"; tenantDomain = 'carbon.super';
} }
var tempPayload = temperature; var tempPayload = temperature;
var levelPayload = coffee_amount; var levelPayload = coffee_amount;
$.post("/connected-cup-agent/push_temperature?deviceId=" + deviceId + "&deviceOwner=" + deviceOwner + $.post('/connected-cup-agent/push_temperature?deviceId=' + deviceId + '&deviceOwner=' + deviceOwner +
"&payload=" + tempPayload + "&tenantDomain=" + tenantDomain ); '&payload=' + tempPayload + '&tenantDomain=' + tenantDomain);
$.post("/connected-cup-agent/push_level?deviceId=" + deviceId + "&deviceOwner=" + deviceOwner + $.post('/connected-cup-agent/push_level?deviceId=' + deviceId + '&deviceOwner=' + deviceOwner +
"&payload=" + levelPayload + "&tenantDomain=" + tenantDomain); '&payload=' + levelPayload + '&tenantDomain=' + tenantDomain);
setTimeout(sendData, 5000); setTimeout(sendData, 5000);
} }
sendData(); sendData();
</script> </script>
</body> </body>
</html> </html>

@ -19,21 +19,21 @@
var temperature = 0; var temperature = 0;
var coffee_amount = 0; var coffee_amount = 0;
function updateCoffee(newValue){ function updateCoffee(newValue) {
var coffee_level = document.getElementById("coffee_level"); var coffee_level = document.getElementById('coffee_level');
coffee_level.innerHTML = newValue + "%"; coffee_level.innerHTML = newValue + '%';
coffee_amount =newValue; coffee_amount = newValue;
var coffee = document.getElementById("water"); var coffee = document.getElementById('water');
if(newValue == 0){ if (newValue == 0) {
coffee.style.height= (newValue*3) + 'px'; coffee.style.height = (newValue * 3) + 'px';
}else{ } else {
coffee.style.height= (newValue*3) - 3 + 'px'; coffee.style.height = (newValue * 3) - 3 + 'px';
} }
} }
function updateTemperature(newValue){ function updateTemperature(newValue) {
temperature = newValue; temperature = newValue;
var temperature_level = document.getElementById("temperature_level"); var temperature_level = document.getElementById('temperature_level');
temperature_level.innerHTML = newValue + " C"; temperature_level.innerHTML = newValue + ' C';
} }

Loading…
Cancel
Save