merge-requests/1/head
charitha 8 years ago
parent 1b42f08a01
commit f071ce0d84

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

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

Loading…
Cancel
Save