|
|
|
@ -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>
|