cleaned up code. added test for getHistory. added (but disabled) smake manifest 69/8569/1 submit/tizen/20130823.193412
authorKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 22 Aug 2013 23:53:04 +0000 (16:53 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Fri, 23 Aug 2013 18:31:48 +0000 (11:31 -0700)
business.js
gc.manifest [new file with mode: 0644]
index.html
packaging/GhostCluster.changes
packaging/GhostCluster.spec

index 68a458c..46a7917 100644 (file)
@@ -36,99 +36,6 @@ function calcAverageVelocity(newVel) {
        $("#avgspeed").text(Math.floor(averageVel));
 }
 
-function connected()
-{
-    /*vehicle.subscribe(["running_status_speedometer", "running_status_engine_speed", "running_status_transmission_gear_status", "running_status_steering_wheel_angle"]);
-    //vehicle.subscribe(["running_status_engine_speed"]);
-    //vehicle.subscribe(["running_status_transmission_gear_status"]);
-    //vehicle.subscribe(["running_status_steering_wheel_angle"]);
-    vehicle.subscribe(["ThrottlePosition"]);
-    vehicle.subscribe(["EngineCoolantTemperature"]);
-    vehicle.subscribe(["MachineGunTurretStatus"]);
-    vehicle.subscribe(["AirIntakeTemperature"]);*/
-
-    vehicle.subscribe(["VehicleSpeed","EngineSpeed","MassAirFlow","AirIntakeTemperature","ThrottlePosition","EngineCoolantTemperature", "TransmissionShiftPosition",
-                       "SteeringWheelAngle","MachineGunTurretStatus"]);
-
-    document.addEventListener("VehicleSpeed",function(data) {
-
-                                  adjvalue = data.value.value;
-                                  curVss = adjvalue;
-                                  var velocityUnits = $('#velocityUnits');
-
-                                  if(velocityUnits.text() === "MPH")
-                                      adjvalue = Math.floor(adjvalue * 0.62137);
-
-                                  $('#velocity').text(adjvalue);
-
-                                  calcAverageVelocity(adjvalue);
-                              },false);
-
-    document.addEventListener("EngineSpeed", function(data) {
-                                  var value = data.value.value;
-                                  if(value > 10000) value =10000;
-                                  var needleDegs = value / 10000 * 180;
-                                  $('#rpms').text(value);
-                                  $('#rpmNeedle').css("-webkit-transform","rotate("+needleDegs+"deg)");
-                              },false);
-
-    document.addEventListener("TransmissionShiftPosition",function(data) {
-                                  value = data.value.value;
-                                                                 if(value == 128)
-                                                                         $('#gear').text('Reverse');
-                                                                 else if(value == 0)
-                                                                         $('#gear').text('Neutral');
-                                  else $('#gear').text(value);
-                                                                 
-                              },false);
-
-    document.addEventListener("SteeringWheelAngle", function(data) {
-                                  value = data.value.value;
-                                  $('#wheel').css("-webkit-transform","rotate("+value+"deg)");
-                                  $('#machinegun').css("-webkit-transform","rotate("+value+"deg)");
-                              },false);
-
-    document.addEventListener("ThrottlePosition", function(data) {
-                                  value = data.value.value;
-                                  var needleDegs = (value / 100 * 180) + 270
-
-                                  $('#throttleNeedle').css("-webkit-transform","rotate("+needleDegs+"deg)");
-
-                              },false);
-
-    document.addEventListener("EngineCoolantTemperature", function(data) {
-                                  value = data.value.value;
-                                  var needleDegs = (value / 180 * 70) + 270
-
-                                  $('#engineCoolantNeedle').css("-webkit-transform","rotate("+needleDegs+"deg)");
-
-                              },false);
-
-    document.addEventListener("MachineGunTurretStatus", function(data) {
-                                  value = data.value.value;
-                                  if(value === "1")
-                                      $('#machineGunTurretPopup').popup('open');
-                                  else $('#machineGunTurretPopup').popup('close');
-
-                              },false);
-
-    document.addEventListener("MassAirFlow", function(data) {
-                                  value = data.value.value;
-                                  var maf = value;
-                                  var vss = curVss;
-                                  var mpg = Math.floor((14.7 * 6.17 * 4.54 * vss * 0.621371) / (3600 * maf / 100));
-
-                                  $('#mpg').text(mpg);
-
-                                  calcAverageMpg(mpg);
-
-                              },false);
-
-
-
-}
-
-
 window.onload = function()
 {
     var addy = "127.0.0.1:23000";
@@ -138,6 +45,22 @@ window.onload = function()
     var vehicleSpeed = vehicle.get("VehicleSpeed");
     console.log("Vehicle speed: " + vehicleSpeed.vehicleSpeed);
 
+    try {
+         var begin = new Date(10000000);
+         var end = new Date();
+         vehicle.getHistory("VehicleSpeed", begin, end ,
+                                function(data){ 
+                                     console.log("Vehicle data: " +
+                                     data.toString()); 
+                                }, 
+                                function(err) {
+                                      console.log("getHistory() Error: " + err); 
+                            });
+    }
+    catch(err){
+         console.log("Vehicle GetHistory failed!" + err);
+    }
+
     if(typeof(Storage)!== "undefined")
     {
         addyTemp = localStorage.address;
@@ -147,11 +70,8 @@ window.onload = function()
     $("#address").val(addy);
     $("#address").change(function() { localStorage.address = $("#address").val(); });
 
-    $("#connectButton").click(function() { 
-       vehicle.set("MachineGunTurretStatus", { "machineGunTurretStatus" : true },
-                function(error) { console.log("error " + error);});
-
-     });
+    vehicle.set("MachineGunTurretStatus", { "machineGunTurretStatus" : true },
+                function(error) { console.log("set() error " + error); });
 
     var velocityUnits = $('#velocityUnits');
     velocityUnits.click(function() {
diff --git a/gc.manifest b/gc.manifest
new file mode 100644 (file)
index 0000000..b7ffb10
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="AMB::machinegun" />
+       </request>
+</manifest>
index bd0414f..859fd9f 100644 (file)
     </head>
     <body>
        <div data-role="page">
-       <div data-role="header"><h1>GhostCluster</h1></div>
+       <!-- <div data-role="header"><h1>GhostCluster</h1></div> -->
        <div data-role="content">
 
-       <a href="#popupBasic" data-role="button" data-rel="popup">Connect</a>
-
-       <div data-role="popup" id="popupBasic" data-transition="flip">
-               <form>
-                       <label>Address:</label>
-                       <input type="text" id="address" name="address" data-theme="a">
-                       <div id="connectButton" data-role="button" >Connect</div>
-               </form>
-       </div>
-
        <div id="mainbox" class="hbox" >
                <div class="needleParent" >
                        <div id="rpmNeedle" class="needle"></div>
index 0aa34b1..f0fc45a 100644 (file)
@@ -1,3 +1,7 @@
+* Fri Aug 16 2013 Kevron Rees <kevron.m.rees@intel.com>
+- Added smack manifest
+- removed connect button
+
 * Tue Aug 06 2013 Kevron Rees <kevron.m.rees@intel.com>
 - updated to reflect latest changes in the vehicle plugin
 
index e9cafaa..3d79c49 100644 (file)
@@ -1,6 +1,6 @@
 Name:       GhostCluster
 Summary:    Automotive Meter Cluster Application
-Version:    0.2013.8.06
+Version:    0.2013.8.23
 Release:    1
 Group:      Applications/System
 License:    Apache 2.0
@@ -32,4 +32,5 @@ fi
 
 %files
 %defattr(-,root,root,-)
+#%manifest gc.manifest
 /opt/usr/apps/.preinstallWidgets/GhostCluster.wgt