diff --git a/package.json b/package.json new file mode 100644 index 0000000..e30ba12 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "sensortoy", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "http://gitlab.silvrtree.co.uk/martind2000/sensortoy.git" + }, + "author": "Martin Donnelly ", + "license": "ISC", + "devDependencies": { + "gulp": "^3.9.1", + "gulp-autoprefixer": "^3.1.0", + "gulp-cache": "^0.4.5", + "gulp-concat": "^2.6.0", + "gulp-cssnano": "^2.1.2" + } +} diff --git a/platforms/android/assets/www/css/progress.css b/platforms/android/assets/www/css/progress.css new file mode 100644 index 0000000..c2b6981 --- /dev/null +++ b/platforms/android/assets/www/css/progress.css @@ -0,0 +1,94 @@ +/* Progress Bar */ +.progress { + position: relative; + height: 4px; + display: block; + width: 100%; + background-color: #acece6; + border-radius: 2px; + background-clip: padding-box; + /* margin: 0.5rem 0 1rem 0; */ + overflow: hidden; } + +.progress .determinate { + position: absolute; + background-color: inherit; + top: 0; + bottom: 0; + background-color: #26a69a; + transition: width .3s linear; } + +.progress .indeterminate { + background-color: #26a69a; } + +.progress .indeterminate:before { + content: ''; + position: absolute; + background-color: inherit; + top: 0; + left: 0; + bottom: 0; + will-change: left, right; + -webkit-animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; + animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; } + +.progress .indeterminate:after { + content: ''; + position: absolute; + background-color: inherit; + top: 0; + left: 0; + bottom: 0; + will-change: left, right; + -webkit-animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite; + animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite; + -webkit-animation-delay: 1.15s; + animation-delay: 1.15s; } + +@-webkit-keyframes indeterminate { + 0% { + left: -35%; + right: 100%; } + 60% { + left: 100%; + right: -90%; } + 100% { + left: 100%; + right: -90%; } + } + +@keyframes indeterminate { + 0% { + left: -35%; + right: 100%; } + 60% { + left: 100%; + right: -90%; } + 100% { + left: 100%; + right: -90%; } + } + +@-webkit-keyframes indeterminate-short { + 0% { + left: -200%; + right: 100%; } + 60% { + left: 107%; + right: -8%; } + 100% { + left: 107%; + right: -8%; } + } + +@keyframes indeterminate-short { + 0% { + left: -200%; + right: 100%; } + 60% { + left: 107%; + right: -8%; } + 100% { + left: 107%; + right: -8%; } + } diff --git a/platforms/android/assets/www/css/ripple.css b/platforms/android/assets/www/css/ripple.css new file mode 100644 index 0000000..b470db6 --- /dev/null +++ b/platforms/android/assets/www/css/ripple.css @@ -0,0 +1,195 @@ + +@-webkit-keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +@-webkit-keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +@-moz-keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +@-ms-keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +@-moz-keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +@-webkit-keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +@-o-keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +@keyframes uil-ripple { + 0% { + width: 0; + height: 0; + opacity: 0; + margin: 0 0 0 0; + } + 33% { + width: 44%; + height: 44%; + margin: -22% 0 0 -22%; + opacity: 1; + } + 100% { + width: 88%; + height: 88%; + margin: -44% 0 0 -44%; + opacity: 0; + } +} +.uil-ripple-css { + background: none; + position: relative; + width: 200px; + height: 200px; +} +.uil-ripple-css div { + position: absolute; + top: 50%; + left: 50%; + margin: 0; + width: 0; + height: 0; + opacity: 0; + border-radius: 50%; + border-width: 12px; + border-style: solid; + -ms-animation: uil-ripple 2s ease-out infinite; + -moz-animation: uil-ripple 2s ease-out infinite; + -webkit-animation: uil-ripple 2s ease-out infinite; + -o-animation: uil-ripple 2s ease-out infinite; + animation: uil-ripple 2s ease-out infinite; +} +.uil-ripple-css div:nth-of-type(1) { + border-color: #afafb7; +} +.uil-ripple-css div:nth-of-type(2) { + border-color: #5cffd6; + -ms-animation-delay: 1s; + -moz-animation-delay: 1s; + -webkit-animation-delay: 1s; + -o-animation-delay: 1s; + animation-delay: 1s; +} diff --git a/platforms/android/assets/www/fonts/Material_Icons-normal-400.woff b/platforms/android/assets/www/fonts/Material_Icons-normal-400.woff new file mode 100644 index 0000000..c6b6610 Binary files /dev/null and b/platforms/android/assets/www/fonts/Material_Icons-normal-400.woff differ diff --git a/platforms/android/assets/www/fonts/Ubuntu-normal-300.woff b/platforms/android/assets/www/fonts/Ubuntu-normal-300.woff new file mode 100644 index 0000000..eeff903 Binary files /dev/null and b/platforms/android/assets/www/fonts/Ubuntu-normal-300.woff differ diff --git a/platforms/android/assets/www/fonts/Ubuntu-normal-400.woff b/platforms/android/assets/www/fonts/Ubuntu-normal-400.woff new file mode 100644 index 0000000..f8c1d67 Binary files /dev/null and b/platforms/android/assets/www/fonts/Ubuntu-normal-400.woff differ diff --git a/platforms/android/assets/www/fonts/Ubuntu-normal-500.woff b/platforms/android/assets/www/fonts/Ubuntu-normal-500.woff new file mode 100644 index 0000000..1166e73 Binary files /dev/null and b/platforms/android/assets/www/fonts/Ubuntu-normal-500.woff differ diff --git a/platforms/android/assets/www/fonts/Ubuntu-normal-700.woff b/platforms/android/assets/www/fonts/Ubuntu-normal-700.woff new file mode 100644 index 0000000..a387b46 Binary files /dev/null and b/platforms/android/assets/www/fonts/Ubuntu-normal-700.woff differ diff --git a/platforms/android/assets/www/fonts/Ubuntu_Condensed-normal-400.woff b/platforms/android/assets/www/fonts/Ubuntu_Condensed-normal-400.woff new file mode 100644 index 0000000..47864fe Binary files /dev/null and b/platforms/android/assets/www/fonts/Ubuntu_Condensed-normal-400.woff differ diff --git a/platforms/android/assets/www/fonts/fonts.css b/platforms/android/assets/www/fonts/fonts.css new file mode 100644 index 0000000..1bd87c9 --- /dev/null +++ b/platforms/android/assets/www/fonts/fonts.css @@ -0,0 +1,41 @@ +@font-face { + font-family: 'Material Icons'; + font-style: normal; + font-weight: 400; + src: url(Material_Icons-normal-400.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 300; + src: url(Ubuntu-normal-300.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 400; + src: url(Ubuntu-normal-400.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 500; + src: url(Ubuntu-normal-500.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 700; + src: url(Ubuntu-normal-700.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu Condensed'; + font-style: normal; + font-weight: 400; + src: url(Ubuntu_Condensed-normal-400.woff) format('woff'); +} \ No newline at end of file diff --git a/platforms/android/assets/www/js/device/CC2650/cc2650_humidity.js b/platforms/android/assets/www/js/device/CC2650/cc2650_humidity.js new file mode 100644 index 0000000..d9416e0 --- /dev/null +++ b/platforms/android/assets/www/js/device/CC2650/cc2650_humidity.js @@ -0,0 +1,144 @@ +/** + * + * User: Martin Donnelly + * Date: 2016-05-20 + * Time: 10:13 + * + */ +/* global CAPABILITY, inheritsFrom */ +/* global ble */ +/* jshint browser: true , devel: true*/ + +var CC2650_HUM = function(p) { + 'use strict'; + this.name = 'Humidity'; + this.deviceID = p.deviceID || null; + this.target = p.target || null; + + this.capabilityID = 'F000AA20-0451-4000-B000-000000000000'; + this.serviceDef = { + service: 'F000AA20-0451-4000-B000-000000000000', + data: 'F000AA21-0451-4000-B000-000000000000', + notification: 'F0002902-0451-4000-B000-000000000000', + configuration: 'F000AA22-0451-4000-B000-000000000000', + period: 'F000AA23-0451-4000-B000-000000000000' + + }; + this.data = {temp: [], humidity: []}; + this.$result = {temp: null, humidity: null}; + this.setFrame(); + + this.startService = function() { + 'use strict'; + if (this.deviceID !== null) { + + console.log('Starting CC2650 Humidity Service on ', this.deviceID); + console.log(this.serviceDef); + this.insertFrame(); + + ble.startNotification(this.deviceID, + this.serviceDef.service, + this.serviceDef.data, + this.onHumidityData.bind(this), + this.onError); + + //Turn on barometer + var humidityConfig = new Uint8Array(1); + humidityConfig[0] = 0x01; + ble.write(this.deviceID, + this.serviceDef.service, + this.serviceDef.configuration, + humidityConfig.buffer, + function() { console.log('Started Humidity.'); }, + this.onError); + + } + + }; + + this.onHumidityData = function(data) { + var hStr; + var tStr; + // Console.log(data); + var message; + var raw = new Uint16Array(data); + + //-- calculate temperature [°C] + var temp = (raw[0] / 65536) * 165 - 40; + + //-- calculate relative humidity [%RH] + var hum = (raw[1] / 65536) * 100; + + tStr = temp.toFixed(2) + '°C'; + hStr = hum.toFixed(2) + '%RH'; + + message = 'Temperature
' + tStr + 'Humidity
' + hStr; + + this.data.temp = this.storeData(temp, this.data.temp); + this.data.humidity = this.storeData(hum, this.data.humidity); + + + this.$result.temp.text(tStr); + this.$result.humidity.text(hStr); + + this.state = message; + + // Console.log('Barometer:', this.state); + }; + + this.animateGraph = function() { + this.simpleGraph(this.data.temp, 'temp'); + this.simpleGraph(this.data.humidity, 'humidity'); + }; + + + 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'}); + + $('
', + {class: 'mui-col-xs-3 mui--text-accent', text: 'Temp:'}).appendTo(row); + + $('
', + {class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row); + $('
', + { + class: 'mui-col-xs-3 mui--text-accent', + text: 'Humidity:' + }).appendTo(row); + + $('
', + {class: 'mui-col-xs-3 mui--text-dark', id: humidity}).appendTo(row); + + this.$id.append(row); + + var tabBody = $('