',
+ {class: 'mui-tabs__pane mui--is-active', id: (temp + '-pane')}).append(
+ blankChart));
+
+ blankChart = this.generateBlankGraph('pressure');
+
+ this.$id.append($('
',
+ {
+ class: 'mui-tabs__pane',
+ id: (pressure + '-pane')
+ }).append(blankChart));
+ }*/
this.$result.temp = $('#' + temp);
this.$result.pressure = $('#' + pressure);
diff --git a/platforms/ios/www/js/device/CC2650/cc2650_humidity.js b/platforms/ios/www/js/device/CC2650/cc2650_humidity.js
index 8dc3179..92c9483 100644
--- a/platforms/ios/www/js/device/CC2650/cc2650_humidity.js
+++ b/platforms/ios/www/js/device/CC2650/cc2650_humidity.js
@@ -5,7 +5,7 @@
* Time: 10:13
*
*/
-/* global CAPABILITY, inheritsFrom, capabilityManager, device */
+/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@@ -87,28 +87,55 @@ var CC2650_HUM = function(p) {
};
this.animateGraph = function() {
- this.simpleGraph(this.data.temp, 'temp');
+ /*
+ This.simpleGraph(this.data.temp, 'temp');
this.simpleGraph(this.data.humidity, 'humidity');
- };
+*/
+ var arcTemp = this.frameID + 'temp-arc';
+ var arcHumidity = this.frameID + 'humidity-arc';
+ this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
+ this.updateArc(this.data.humidity, 'humidity' , arcHumidity, '%RH', 100);
+ };
this.insertFrame = function() {
var self = this;
- var blankChart;
// Call the parent displayForm first...
this.superClass_.insertFrame.call(self);
var temp = this.frameID + '-t';
var humidity = this.frameID + '-h';
- var row = $('
', {class: 'mui-row'});
+
+ var arcB = this.frameID + 'temp-arcB';
+ var arcTemp = this.frameID + 'temp-arc';
+
+
+ var humidityArcB = this.frameID + 'humidity-arcB';
+ var arcHumidity = this.frameID + 'humidity-arc';
+
+
+ var settings = {data: {baseID: this.frameID}};
+ var html = new EJS({url: './partials/cc2650_humidity_dial.ejs'}).render(settings);
+
+ this.$id.append(html);
+
+ document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
+ document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
+
+ document.getElementById(humidityArcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
+ document.getElementById(arcHumidity).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
+
+
+ /*
+ Var row = $('
', {class: 'mui-row'});
$('
',
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
$('
',
- {class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
+ {class: 'mui-col-xs-3 mui--text-light', id: temp}).appendTo(row);
$('
',
{
class: 'mui-col-xs-3 mui--text-accent mui--text-right',
@@ -116,7 +143,7 @@ var CC2650_HUM = function(p) {
}).appendTo(row);
$('
',
- {class: 'mui-col-xs-3 mui--text-dark', id: humidity}).appendTo(row);
+ {class: 'mui-col-xs-3 mui--text-light', id: humidity}).appendTo(row);
this.$id.append(row);
@@ -157,7 +184,7 @@ var CC2650_HUM = function(p) {
class: 'mui-tabs__pane',
id: (humidity + '-pane')
}).append(blankChart));
- }
+ }*/
this.$result.temp = $('#' + temp);
this.$result.humidity = $('#' + humidity);
diff --git a/platforms/ios/www/js/device/CC2650/cc2650_luxometer.js b/platforms/ios/www/js/device/CC2650/cc2650_luxometer.js
index 6492708..deef12f 100644
--- a/platforms/ios/www/js/device/CC2650/cc2650_luxometer.js
+++ b/platforms/ios/www/js/device/CC2650/cc2650_luxometer.js
@@ -95,7 +95,7 @@ var CC2650_LUX = function(p) {
row);
$('
',
- {class: 'mui-col-xs-8 mui--text-dark', id: lux}).appendTo(row);
+ {class: 'mui-col-xs-8 mui--text-light', id: lux}).appendTo(row);
this.$id.append(row);
diff --git a/platforms/ios/www/js/device/CC2650/cc2650_thermopile.js b/platforms/ios/www/js/device/CC2650/cc2650_thermopile.js
index 20ebbf9..20b5f6a 100644
--- a/platforms/ios/www/js/device/CC2650/cc2650_thermopile.js
+++ b/platforms/ios/www/js/device/CC2650/cc2650_thermopile.js
@@ -5,7 +5,7 @@
* Time: 10:13
*
*/
-/* global CAPABILITY, inheritsFrom, capabilityManager */
+/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@@ -87,15 +87,17 @@ var CC2650_TMP = function(p) {
};
this.animateGraph = function() {
- this.simpleGraph(this.data.temp, 'temp');
- this.simpleGraph(this.data.ambient, 'ambient');
+ // This.simpleGraph(this.data.temp, 'temp');
+ // debugger;
+ var arcTemp = this.frameID + 'temp-arc';
+ var arcAmbient = this.frameID + 'ambient-arc';
+ this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
+ this.updateArc(this.data.ambient, 'ambient' , arcAmbient, '°C', 50);
+
};
this.insertFrame = function() {
- var liSetting;
- var tabBody;
- var blankChart;
var self = this;
// Console.log('Overloading...');
// Call the parent displayForm first...
@@ -104,13 +106,33 @@ var CC2650_TMP = function(p) {
var temp = this.frameID + '-t';
var amb = this.frameID + '-a';
- var row = $('
', {class: 'mui-row'});
+
+
+ var arcB = this.frameID + 'temp-arcB';
+ var arcTemp = this.frameID + 'temp-arc';
+
+ var ambientArcB = this.frameID + 'ambient-arcB';
+ var arcAmbient = this.frameID + 'ambient-arc';
+
+ var settings = {data: {baseID: this.frameID}};
+ var html = new EJS({url: './partials/cc2650_thermopile_dial.ejs'}).render(settings);
+
+ this.$id.append(html);
+
+ document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
+ document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
+
+ document.getElementById(ambientArcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
+ document.getElementById(arcAmbient).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
+
+
+ /*Var row = $('
', {class: 'mui-row'});
$('
',
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
$('
',
- {class: 'mui-col-xs-3 mui--text-dark mui--text-left', id: temp}).appendTo(row);
+ {class: 'mui-col-xs-3 mui--text-light mui--text-left', id: temp}).appendTo(row);
$('
',
{
class: 'mui-col-xs-3 mui--text-accent mui--text-right',
@@ -118,7 +140,7 @@ var CC2650_TMP = function(p) {
}).appendTo(row);
$('
',
- {class: 'mui-col-xs-3 mui--text-dark', id: amb}).appendTo(row);
+ {class: 'mui-col-xs-3 mui--text-light', id: amb}).appendTo(row);
this.$id.append(row);
@@ -152,7 +174,7 @@ var CC2650_TMP = function(p) {
this.$id.append($('
',{class: 'mui-tabs__pane',id: (amb + '-pane')}).append(blankChart));
}
-
+*/
this.$result.temp = $('#' + temp);
diff --git a/platforms/ios/www/js/mandecoder.js b/platforms/ios/www/js/mandecoder.js
index b5df1a6..d6d8239 100644
--- a/platforms/ios/www/js/mandecoder.js
+++ b/platforms/ios/www/js/mandecoder.js
@@ -6,7 +6,7 @@
*
*/
-/* global MANUFACTUREDECODER */
+/* global */
/* jshint browser: true , devel: true*/
/**
diff --git a/platforms/ios/www/js/standards/capability.js b/platforms/ios/www/js/standards/capability.js
index 156d349..73b2de6 100644
--- a/platforms/ios/www/js/standards/capability.js
+++ b/platforms/ios/www/js/standards/capability.js
@@ -45,12 +45,47 @@ var CAPABILITY = function(p) {
this.target = null;
this.$frame = null;
+ this.maxLength = 99;
this.previousCeil = 0;
capabilityManager.register({id: this.capabilityID, module: this});
};
+CAPABILITY.prototype.arrayToAscii = function(a) {
+
+ var _a = [].slice.call(a);
+ _a = _a.map(function(num) {
+ return String.fromCharCode(num);
+ });
+
+ return _a.join('');
+};
+
+CAPABILITY.prototype.arrayToHex = function(a) {
+
+ var _a = [].slice.call(a);
+ _a = _a.map(function(num) {
+ return ('00' + num.toString(16)).slice(-2);
+ });
+
+ return _a.join(', ');
+};
+
+
+
+CAPABILITY.prototype.readRaw = function(id, data) {
+
+
+ var a = new Uint8Array(data);
+
+ console.log(id, a);
+ console.log(id, this.arrayToAscii(a));
+ console.log(id, this.arrayToHex(a));
+ console.log(data);
+
+};
+
CAPABILITY.prototype.setFrame = function() {
this.$frame = (this.target !== null) ? $('#' + this.target) : null;
};
@@ -114,7 +149,7 @@ CAPABILITY.prototype.storeData = function(data, alt) {
}
var target = alt || this.data;
- if (target.length === 99) {
+ if (target.length === this.maxLength) {
target = target.slice(1);
}
@@ -242,6 +277,79 @@ CAPABILITY.prototype.animateGraph = function() {
};
+CAPABILITY.prototype.polarToCartesian = function(centerX, centerY, radius, angleInDegrees) {
+ var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;
+
+ return {
+ x: centerX + (radius * Math.cos(angleInRadians)),
+ y: centerY + (radius * Math.sin(angleInRadians))
+ };
+};
+
+
+CAPABILITY.prototype.describeArc = function(x, y, radius, startAngle, endAngle) {
+
+ var start = this.polarToCartesian(x, y, radius, endAngle);
+ var end = this.polarToCartesian(x, y, radius, startAngle);
+
+ var arcSweep = endAngle - startAngle <= 180 ? '0' : '1';
+
+ var d = [
+ 'M', start.x, start.y,
+ 'A', radius, radius, 0, arcSweep, 0, end.x, end.y
+ ].join(' ');
+
+ return d;
+ };
+
+CAPABILITY.prototype.setArc = function(percent) {
+ return (240 / 100) * percent;
+};
+
+CAPABILITY.prototype.updateArc = function(data, subID, elmID, suffix, limiter) {
+
+
+ var ceilingLimit;
+ var ceiling;
+ var _subID;
+ var _data;
+ var _limiter = limiter || null;
+ var _suffix = suffix || '';
+ var label;
+
+ _data = data || this.data;
+
+ _subID = subID || '';
+ label = '#' + this.frameID + _subID + '-label';
+
+ if (_data.length > 0) {
+
+ if (_limiter === null) {
+ ceiling = _data.reduce(function(p, v) {
+ return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
+ });
+
+ ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 10) * 10);
+ if (ceilingLimit > 1000) {
+ ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 50) * 50);
+ }
+
+ } else {
+ ceilingLimit = _limiter;
+ }
+
+ var latest = _data[_data.length - 1];
+ var scale = 100 / ceilingLimit;
+ var arcP = scale * latest;
+
+ document.getElementById(elmID).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(arcP)));
+ $(label).text(latest.toFixed(2) + _suffix);
+ }
+
+
+ };
+
+
CAPABILITY.prototype.simpleGraph = function(data, subID) {
var ceilingLimit;
@@ -272,8 +380,8 @@ CAPABILITY.prototype.simpleGraph = function(data, subID) {
var calcArray = [];
-/*
- var ceilingLimit = Math.floor(ceiling / 10) * 10;
+ /*
+ Var ceilingLimit = Math.floor(ceiling / 10) * 10;
if (ceilingLimit < ceiling) {
ceilingLimit = Math.floor((ceiling + (ceiling * 0.25)) / 10) * 10;
}