var engineoiltemp;
var mafStream;
-var nobdy;
+var vehicle;
var mpgReadings = 0;
var prevMpg = 0;
$("#avgspeed").text(Math.floor(averageVel));
}
+function connected()
+{
+ setInterval(function() {
+ vehicle.get("running_status_speedometer", function(data) {
+
+ adjvalue = data[0].value;
+ var velocityUnits = $('#velocityUnits');
+
+ if(velocityUnits.text() === "MPH")
+ adjvalue = Math.floor(data[0].value * 0.62137);
+
+ $('#velocity').text(adjvalue);
+
+ calcAverageVelocity(adjvalue);
+ },
+ function() { });
+ },1000);
+}
+
window.onload = function()
{
+ vehicle = new Vehicle(connected, function(){$('#velocity').text("ERR");}, "ws://localhost:23000", "http-only");
+
var velocityUnits = $('#velocityUnits');
velocityUnits.click(function() {
- if(velocityUnits.text() == "MPH")
+ if(velocityUnits.text() === "MPH")
{
velocityUnits.text("KPH");
}
else velocityUnits.text("MPH");
});
- nobdy.connected = function () {
+
+
+
+ /*nobdy.connected = function () {
if(nobdy.supported.Velocity) {
velocityStream = nobdy.createStream(nobdy.supported.Velocity);
velocityStream.changed = function (value) {
adjvalue = value;
- if(velocityUnits.text() == "MPH")
+ if(velocityUnits.text() === "MPH")
adjvalue = Math.floor(value * 0.62137);
$('#velocity').text(adjvalue);
calcAverageMpg(mpg);
}
}
- }
+ }*/
- nobdy.connect("localhost:8082");
+ //nobdy.connect("localhost:8082");
}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
- <script type="text/javascript" src="nobdy.js" ></script>
+ <script type="text/javascript" src="api.js" ></script>
<script type="text/javascript" src="jquery-1.6.2.js" ></script>
<script type="text/javascript" src="business.js" ></script>