mirror of
https://gitlab.silvrtree.co.uk/martind2000/sensortoy-app.git
synced 2025-01-10 20:55:07 +00:00
update from mac
This commit is contained in:
parent
9b5925625d
commit
fcb592adc4
@ -1,16 +1,9 @@
|
||||
body {
|
||||
font-family: Ubuntu, "Helvetica Neue", Helvetica, arial, sans-serif;
|
||||
background-color: #004c6d;
|
||||
}
|
||||
|
||||
#weatherIcon {
|
||||
margin-left:25%;
|
||||
margin-right:25%;
|
||||
height:70px;
|
||||
width:70px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#lightR, #projR { color: red !important; }
|
||||
|
||||
#lightG, #projG { color: green !important; }
|
||||
@ -23,21 +16,7 @@ body {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/*.lightBG {
|
||||
background-color: rgba(255, 255, 0, 0.3);
|
||||
}
|
||||
|
||||
.heatingBG {
|
||||
background-color: rgba(255, 0, 255, 0.3);
|
||||
}
|
||||
|
||||
.projectorBG {
|
||||
background-color: rgba(0, 255, 255, 0.3);
|
||||
}*/
|
||||
|
||||
.mui-panel {
|
||||
background-color: #015579;
|
||||
}
|
||||
|
||||
.h105 {
|
||||
height: 100px;
|
||||
@ -47,9 +26,6 @@ body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mui--text-title {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.item_content {
|
||||
height: 100px;
|
||||
@ -212,50 +188,6 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
color: #e5f7fd;
|
||||
}
|
||||
|
||||
.material-icons.md-18 { font-size: 18px; }
|
||||
|
||||
.material-icons.md-24 { font-size: 24px; }
|
||||
|
||||
.material-icons.md-36 { font-size: 36px; }
|
||||
|
||||
.material-icons.md-48 { font-size: 48px; }
|
||||
|
||||
.material-icons.md-100 { font-size: 100px; }
|
||||
|
||||
/* Rules for using icons as black on a light background. */
|
||||
.material-icons.md-dark { color: rgba(0, 0, 0, 0.54); }
|
||||
|
||||
.material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); }
|
||||
|
||||
/* Rules for using icons as white on a dark background. */
|
||||
.material-icons.md-light { color: rgba(255, 255, 255, 1); }
|
||||
|
||||
.material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); }
|
||||
|
||||
.material-icons.md-bulb {
|
||||
content: ""
|
||||
}
|
||||
|
||||
/*
|
||||
fan : toys
|
||||
|
||||
<i class="material-icons"></i>
|
||||
|
||||
|
||||
bulb : lightbulb_outline
|
||||
<i class="material-icons"></i>
|
||||
|
||||
calendar: event_note
|
||||
<i class="material-icons"></i>
|
||||
|
||||
projector: cast
|
||||
<i class="material-icons"></i>
|
||||
|
||||
*/
|
||||
|
||||
.md-display {
|
||||
opacity: 1;
|
||||
@ -305,3 +237,24 @@ projector: cast
|
||||
85% { opacity: 1; }
|
||||
100% { transform: scale(1); filter: blur(5px); opacity: 0; }
|
||||
}
|
||||
|
||||
|
||||
header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
right:0;
|
||||
transition: left .2s;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.mui-tabs__bar > li.tabOnWhite > a
|
||||
|
||||
{
|
||||
color:#78909C;
|
||||
}
|
||||
|
||||
.mui-tabs__bar > li.mui--is-active.tabOnWhite > a
|
||||
{
|
||||
color:#2196F3;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ body {
|
||||
font-weight: 400;
|
||||
line-height: 1.429;
|
||||
color: rgba(0, 0, 0, 0.87);
|
||||
background-color: #FFF; }
|
||||
background-color: #F5F5F5; }
|
||||
|
||||
input,
|
||||
button,
|
||||
@ -497,7 +497,7 @@ h4, h5, h6 {
|
||||
top: 64px; } }
|
||||
|
||||
.mui-appbar {
|
||||
background-color: #2196F3;
|
||||
background-color: #004c6d;
|
||||
color: #FFF; }
|
||||
|
||||
/**
|
||||
@ -655,21 +655,21 @@ h4, h5, h6 {
|
||||
|
||||
.mui-btn--accent {
|
||||
color: #004c6d;
|
||||
background-color: #bad649; }
|
||||
background-color: #004c6d; }
|
||||
.mui-btn--accent:hover, .mui-btn--accent:focus, .mui-btn--accent:active {
|
||||
color: #004c6d;
|
||||
background-color: #c2db5e; }
|
||||
background-color: #005e87; }
|
||||
.mui-btn--accent[disabled]:hover, .mui-btn--accent[disabled]:focus, .mui-btn--accent[disabled]:active {
|
||||
color: #004c6d;
|
||||
background-color: #bad649; }
|
||||
background-color: #004c6d; }
|
||||
.mui-btn--accent.mui-btn--flat {
|
||||
color: #bad649;
|
||||
color: #004c6d;
|
||||
background-color: transparent; }
|
||||
.mui-btn--accent.mui-btn--flat:hover, .mui-btn--accent.mui-btn--flat:focus, .mui-btn--accent.mui-btn--flat:active {
|
||||
color: #bad649;
|
||||
color: #004c6d;
|
||||
background-color: #f2f2f2; }
|
||||
.mui-btn--accent.mui-btn--flat[disabled]:hover, .mui-btn--accent.mui-btn--flat[disabled]:focus, .mui-btn--accent.mui-btn--flat[disabled]:active {
|
||||
color: #bad649;
|
||||
color: #004c6d;
|
||||
background-color: transparent; }
|
||||
|
||||
.mui-btn--small {
|
||||
@ -1266,7 +1266,7 @@ h4, h5, h6 {
|
||||
|
||||
.mui-select__menu {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
z-index: 2;
|
||||
min-width: 100%;
|
||||
overflow-y: auto;
|
||||
padding: 8px 0;
|
||||
@ -1596,13 +1596,13 @@ th {
|
||||
color: rgba(255, 255, 255, 0.3); }
|
||||
|
||||
.mui--text-accent {
|
||||
color: rgba(186, 214, 73, 0.87); }
|
||||
color: rgba(0, 76, 109, 0.87); }
|
||||
|
||||
.mui--text-accent-secondary {
|
||||
color: rgba(186, 214, 73, 0.54); }
|
||||
color: rgba(0, 76, 109, 0.54); }
|
||||
|
||||
.mui--text-accent-hint {
|
||||
color: rgba(186, 214, 73, 0.38); }
|
||||
color: rgba(0, 76, 109, 0.38); }
|
||||
|
||||
.mui--text-black {
|
||||
color: #000; }
|
||||
|
188
app/index.html
188
app/index.html
@ -1,5 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
<!DOCTYPE html><!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
@ -18,98 +17,103 @@
|
||||
under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
Customize this policy to fit your own app's needs. For more guidance, see:
|
||||
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
|
||||
Some notes:
|
||||
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
|
||||
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
|
||||
* Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
|
||||
* Enable inline JS: add 'unsafe-inline' to default-src
|
||||
-->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
|
||||
<link rel="stylesheet"
|
||||
href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700"
|
||||
type="text/css">
|
||||
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Condensed'
|
||||
rel='stylesheet' type='text/css'>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<!-- endbuild -->
|
||||
<!-- build:css -->
|
||||
<link rel="stylesheet" href="fonts/fonts.css">
|
||||
<link href="css/mui.custom.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/app.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/ripple.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/progress.css" rel="stylesheet" type="text/css"/>
|
||||
<title>Sensor Toy</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin: 0.5rem 0 1rem 0;">
|
||||
<div class="progress" id='ripple' style="display: none;">
|
||||
<div class="indeterminate"></div>
|
||||
<head>
|
||||
<!--
|
||||
Customize this policy to fit your own app's needs. For more guidance, see:
|
||||
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
|
||||
Some notes:
|
||||
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
|
||||
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
|
||||
* Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
|
||||
* Enable inline JS: add 'unsafe-inline' to default-src
|
||||
-->
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<meta name="viewport"
|
||||
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
|
||||
<link rel="stylesheet"
|
||||
href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700"
|
||||
type="text/css">
|
||||
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Condensed'
|
||||
rel='stylesheet' type='text/css'>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">
|
||||
<!-- endbuild -->
|
||||
<!-- build:css -->
|
||||
<link rel="stylesheet" href="fonts/fonts.css">
|
||||
<link href="css/mui.custom.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/app.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/ripple.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="css/progress.css" rel="stylesheet" type="text/css"/>
|
||||
<title>Sensor Toy</title>
|
||||
</head>
|
||||
<body class="mui--no-user-select">
|
||||
<header id="header">
|
||||
<div class="mui-appbar">
|
||||
<ul id='app-tabs' class="mui-tabs__bar mui--z1 mui--appbar-height">
|
||||
<li class="mui--is-active"><a data-mui-toggle="tab"
|
||||
data-mui-controls="pane-default-1">Devices</a>
|
||||
</li>
|
||||
<!--<li><a data-mui-toggle="tab" data-mui-controls="pane-default-2">Tab-2</a>
|
||||
</li>
|
||||
<li><a data-mui-toggle="tab" data-mui-controls="pane-default-3">Tab-3</a>
|
||||
</li>-->
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<div class="mui--appbar-height"></div>
|
||||
<div id="tab-panes" class='' style="height:100%;">
|
||||
<div class="mui-tabs__pane mui--is-active" id="pane-default-1">
|
||||
<div id='app' class="mui-container">
|
||||
<div>
|
||||
<div class="mui-row mui--appbar-height mui--appbar-line-height">
|
||||
<div class="mui-col-xs-6 mui--text-subhead">
|
||||
<span class="">Devices</span>
|
||||
</div>
|
||||
<div class="mui-col-xs-6 mui--text-right">
|
||||
<button class="mui-btn mui-btn--small mui-btn--primary"
|
||||
id="scan">Scan
|
||||
</button>
|
||||
<button class="mui-btn mui-btn--small mui-btn--danger" id="stop"
|
||||
style="display: none;">Stop
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin: 0.5rem 0 1rem 0;">
|
||||
<div class="progress" id='ripple' style="display: none;">
|
||||
<div class="indeterminate"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="scanResults"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id='app' class="mui-container">
|
||||
|
||||
<div class="mui-panel">
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-xs-6">
|
||||
<button class="mui-btn mui-btn--primary" id="scan">Scan</button>
|
||||
<button class="mui-btn mui-btn--danger" id="stop" style="display: none;">Stop</button>
|
||||
</div>
|
||||
|
||||
<div class="mui-col-xs-6">
|
||||
<button class="mui-btn mui-btn--accent" id="longScan">Long</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<table class="mui-table mui--text-white" id="results">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>RSI</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="frames" class="mui-container">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="libs/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="libs/mui/packages/cdn/js/mui.js"></script>
|
||||
<script type="text/javascript" src="libs/bluebird/js/browser/bluebird.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/standards/bluetooth_company_identifiers.js"></script>
|
||||
<script type="text/javascript" src="js/standards/capability.js"></script>
|
||||
<script type="text/javascript" src="js/standards/battery.js"></script>
|
||||
<script type="text/javascript" src="js/standards/button.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/mandecoder.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/device/CC2650/cc2650_accelerometer.js"></script>
|
||||
<script type="text/javascript" src="js/device/CC2650/cc2650_barometer.js"></script>
|
||||
<script type="text/javascript" src="js/device/CC2650/cc2650_luxometer.js"></script>
|
||||
<script type="text/javascript" src="js/device/CC2650/cc2650_thermopile.js"></script>
|
||||
<script type="text/javascript" src="js/device/CC2650/cc2650_humidity.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
</body>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="libs/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="libs/mui/packages/cdn/js/mui.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="libs/bluebird/js/browser/bluebird.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="js/standards/bluetooth_company_identifiers.js"></script>
|
||||
<script type="text/javascript" src="js/standards/capability.js"></script>
|
||||
<script type="text/javascript" src="js/standards/battery.js"></script>
|
||||
<script type="text/javascript" src="js/standards/button.js"></script>
|
||||
<script type="text/javascript" src="js/mandecoder.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="js/device/CC2650/cc2650_accelerometer.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="js/device/CC2650/cc2650_barometer.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="js/device/CC2650/cc2650_luxometer.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="js/device/CC2650/cc2650_thermopile.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="js/device/CC2650/cc2650_humidity.js"></script>
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -9,10 +9,12 @@
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var CC2650_ACCEL = function(deviceId) {
|
||||
var CC2650_ACCEL = function(p) {
|
||||
'use strict';
|
||||
this.name = 'Accelerometer';
|
||||
this.deviceID = deviceId;
|
||||
this.deviceID = p.deviceID || null;
|
||||
this.target = p.target || null;
|
||||
|
||||
this.capabilityID = 'F000AA80-0451-4000-B000-000000000000';
|
||||
this.serviceDef = {
|
||||
service: 'F000AA80-0451-4000-B000-000000000000',
|
||||
@ -26,6 +28,7 @@ var CC2650_ACCEL = function(deviceId) {
|
||||
this.$id = {};
|
||||
this.$result = {};
|
||||
|
||||
this.setFrame();
|
||||
|
||||
this.sensorMpu9250GyroConvert = function(data) {
|
||||
return data / (65536 / 500);
|
||||
@ -89,7 +92,6 @@ var CC2650_ACCEL = function(deviceId) {
|
||||
|
||||
console.log('Starting CC2650 Accelerometer Service on ', this.deviceID);
|
||||
console.log(this.serviceDef);
|
||||
//Ble.startNotification(this.deviceID, , this.onButtonData.bind(this), this.onError);
|
||||
|
||||
ble.startNotification(this.deviceID, this.serviceDef.service, this.serviceDef.data, this.onAccelerometerData.bind(this), this.onError);
|
||||
|
||||
@ -139,7 +141,7 @@ var CC2650_ACCEL = function(deviceId) {
|
||||
|
||||
$('<div />', { class: 'mui-row'}).append($('<div />', { class: 'mui-col-xs-12 mui--text-title mui-ellipsis-2', text: title})).appendTo(frame);
|
||||
|
||||
$('#frames').append(frame);
|
||||
this.$frame.append(frame);
|
||||
this.$id[modeID] = $('#' + this.frames[modeID]);
|
||||
|
||||
// Call the parent displayForm first...
|
||||
@ -152,12 +154,11 @@ var CC2650_ACCEL = function(deviceId) {
|
||||
|
||||
this.$id[modeID].append(row);
|
||||
|
||||
|
||||
row = $('<div />', {class: 'mui-row'});
|
||||
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-white', text: '--', id: this.frames[modeID] + '-x' }).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-white', text: '--', id: this.frames[modeID] + '-y'}).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-white', text: '--', id: this.frames[modeID] + '-z'}).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', text: '--', id: this.frames[modeID] + '-x' }).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', text: '--', id: this.frames[modeID] + '-y'}).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', text: '--', id: this.frames[modeID] + '-z'}).appendTo(row);
|
||||
|
||||
this.$id[modeID].append(row);
|
||||
|
||||
@ -170,3 +171,5 @@ var CC2650_ACCEL = function(deviceId) {
|
||||
|
||||
|
||||
inheritsFrom(CC2650_ACCEL, CAPABILITY);
|
||||
|
||||
capabilityManager.register({id:'F000AA80-0451-4000-B000-000000000000', module:CC2650_ACCEL});
|
||||
|
@ -9,10 +9,12 @@
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var CC2650_BAR = function(deviceId) {
|
||||
var CC2650_BAR = function(p) {
|
||||
'use strict';
|
||||
this.name = 'Barometer';
|
||||
this.deviceID = deviceId;
|
||||
this.deviceID = p.deviceID || null;
|
||||
this.target = p.target || null;
|
||||
|
||||
this.capabilityID = 'F000AA40-0451-4000-B000-000000000000';
|
||||
this.serviceDef = {
|
||||
service: 'F000AA40-0451-4000-B000-000000000000',
|
||||
@ -24,6 +26,7 @@ var CC2650_BAR = function(deviceId) {
|
||||
};
|
||||
this.data = {temp: [], pressure: []};
|
||||
this.$result = {temp: null, pressure: null};
|
||||
this.setFrame();
|
||||
|
||||
this.startService = function() {
|
||||
'use strict';
|
||||
@ -53,7 +56,6 @@ var CC2650_BAR = function(deviceId) {
|
||||
this.onBarometerData = function(data) {
|
||||
var pStr;
|
||||
var tStr;
|
||||
// Console.log(data);
|
||||
var message;
|
||||
var a = new Uint8Array(data);
|
||||
|
||||
@ -68,8 +70,6 @@ var CC2650_BAR = function(deviceId) {
|
||||
message = 'Temperature <br/>' + tStr +
|
||||
'Pressure <br/>' + pStr ;
|
||||
|
||||
// This.data.temp = this.storeData(parseInt(temp), this.data.temp);
|
||||
// this.data.pressure = this.storeData(parseInt(pressure), this.data.pressure);
|
||||
|
||||
this.data.temp = this.storeData(temp, this.data.temp);
|
||||
this.data.pressure = this.storeData(pressure, this.data.pressure);
|
||||
@ -103,30 +103,27 @@ var CC2650_BAR = function(deviceId) {
|
||||
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-accent', text: 'Temp:'}).appendTo(row);
|
||||
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-white', id: temp}).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-accent', text: 'Pressure:'}).appendTo(row);
|
||||
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-white', id: pressure}).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: pressure}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
var tabBody = $('<ul>',{class: 'mui-tabs__bar mui-tabs__bar--justified'});
|
||||
$('<li>',{class: 'mui--is-active'}).append($('<a>',{text:'Temperature','data-mui-toggle': 'tab', 'data-mui-controls': (temp + '-pane')})).appendTo(tabBody);
|
||||
$('<li>').append($('<a>',{text:'Pressure','data-mui-toggle': 'tab', 'data-mui-controls': (pressure + '-pane')})).appendTo(tabBody);
|
||||
$('<li>',{class: 'mui--is-active tabOnWhite'}).append($('<a>',{text:'Temperature','data-mui-toggle': 'tab', 'data-mui-controls': (temp + '-pane')})).appendTo(tabBody);
|
||||
$('<li>',{class: 'tabOnWhite'}).append($('<a>',{text:'Pressure','data-mui-toggle': 'tab', 'data-mui-controls': (pressure + '-pane')})).appendTo(tabBody);
|
||||
|
||||
this.$id.append(tabBody);
|
||||
|
||||
blankChart = this.generateBlankGraph('temp');
|
||||
|
||||
// this.$id.append(blankChart);
|
||||
this.$id.append($('<div>',{'class':'mui-tabs__pane mui--is-active',id:(temp + '-pane')}).append(blankChart));
|
||||
|
||||
blankChart = this.generateBlankGraph('pressure');
|
||||
|
||||
// this.$id.append(blankChart);
|
||||
this.$id.append($('<div>',{'class':'mui-tabs__pane',id:(pressure + '-pane')}).append(blankChart));
|
||||
|
||||
|
||||
this.$result.temp = $('#' + temp);
|
||||
this.$result.pressure = $('#' + pressure);
|
||||
|
||||
@ -136,3 +133,5 @@ var CC2650_BAR = function(deviceId) {
|
||||
|
||||
|
||||
inheritsFrom(CC2650_BAR, CAPABILITY);
|
||||
|
||||
capabilityManager.register({id:'F000AA40-0451-4000-B000-000000000000', module:CC2650_BAR});
|
||||
|
@ -9,10 +9,12 @@
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var CC2650_HUM = function(deviceId) {
|
||||
var CC2650_HUM = function(p) {
|
||||
'use strict';
|
||||
this.name = 'Humidity';
|
||||
this.deviceID = deviceId;
|
||||
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',
|
||||
@ -24,6 +26,7 @@ var CC2650_HUM = function(deviceId) {
|
||||
};
|
||||
this.data = {temp: [], humidity: []};
|
||||
this.$result = {temp: null, humidity: null};
|
||||
this.setFrame();
|
||||
|
||||
this.startService = function() {
|
||||
'use strict';
|
||||
@ -70,10 +73,7 @@ var CC2650_HUM = function(deviceId) {
|
||||
hStr = hum.toFixed(2) + '%RH';
|
||||
|
||||
message = 'Temperature <br/>' + tStr + 'Humidity <br/>' + hStr;
|
||||
|
||||
// This.data.temp = this.storeData(parseInt(temp), this.data.temp);
|
||||
// this.data.humidity = this.storeData(parseInt(hum), this.data.humidity);
|
||||
|
||||
|
||||
this.data.temp = this.storeData(temp, this.data.temp);
|
||||
this.data.humidity = this.storeData(hum, this.data.humidity);
|
||||
|
||||
@ -108,7 +108,7 @@ var CC2650_HUM = function(deviceId) {
|
||||
{class: 'mui-col-xs-3 mui--text-accent', text: 'Temp:'}).appendTo(row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-white', id: temp}).appendTo(row);
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
|
||||
$('<div />',
|
||||
{
|
||||
class: 'mui-col-xs-3 mui--text-accent',
|
||||
@ -116,25 +116,22 @@ var CC2650_HUM = function(deviceId) {
|
||||
}).appendTo(row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-white', id: humidity}).appendTo(row);
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: humidity}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
var tabBody = $('<ul>',{class: 'mui-tabs__bar mui-tabs__bar--justified'});
|
||||
$('<li>',{class: 'mui--is-active'}).append($('<a>',{text: 'Temperature','data-mui-toggle': 'tab', 'data-mui-controls': (temp + '-pane')})).appendTo(tabBody);
|
||||
$('<li>').append($('<a>',{text: 'Humidity','data-mui-toggle': 'tab', 'data-mui-controls': (humidity + '-pane')})).appendTo(tabBody);
|
||||
$('<li>',{class: 'mui--is-active tabOnWhite'}).append($('<a>',{text: 'Temperature','data-mui-toggle': 'tab', 'data-mui-controls': (temp + '-pane')})).appendTo(tabBody);
|
||||
$('<li>',{class: 'tabOnWhite'}).append($('<a>',{text: 'Humidity','data-mui-toggle': 'tab', 'data-mui-controls': (humidity + '-pane')})).appendTo(tabBody);
|
||||
this.$id.append(tabBody);
|
||||
|
||||
blankChart = this.generateBlankGraph('temp');
|
||||
|
||||
// This.$id.append(blankChart);
|
||||
this.$id.append($('<div>',{class: 'mui-tabs__pane mui--is-active',id: (temp + '-pane')}).append(blankChart));
|
||||
|
||||
blankChart = this.generateBlankGraph('humidity');
|
||||
this.$id.append($('<div>',{class: 'mui-tabs__pane',id: (humidity + '-pane')}).append(blankChart));
|
||||
|
||||
// this.$id.append(blankChart);
|
||||
|
||||
this.$result.temp = $('#' + temp);
|
||||
this.$result.humidity = $('#' + humidity);
|
||||
|
||||
@ -143,3 +140,5 @@ var CC2650_HUM = function(deviceId) {
|
||||
};
|
||||
|
||||
inheritsFrom(CC2650_HUM, CAPABILITY);
|
||||
|
||||
capabilityManager.register({id:'F000AA20-0451-4000-B000-000000000000', module:CC2650_HUM});
|
||||
|
@ -9,10 +9,12 @@
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var CC2650_LUX = function(deviceId) {
|
||||
var CC2650_LUX = function(p) {
|
||||
'use strict';
|
||||
this.name = 'Luxometer';
|
||||
this.deviceID = deviceId;
|
||||
this.deviceID = p.deviceID || null;
|
||||
this.target = p.target || null;
|
||||
|
||||
this.capabilityID = 'F000AA70-0451-4000-B000-000000000000';
|
||||
this.serviceDef = {
|
||||
service: 'F000AA70-0451-4000-B000-000000000000',
|
||||
@ -25,6 +27,7 @@ var CC2650_LUX = function(deviceId) {
|
||||
|
||||
this.$result = {temp: null, pressure: null};
|
||||
this.data = [];
|
||||
this.setFrame();
|
||||
|
||||
this.startService = function() {
|
||||
'use strict';
|
||||
@ -57,7 +60,6 @@ var CC2650_LUX = function(deviceId) {
|
||||
this.onLuxData = function(data) {
|
||||
|
||||
var m, e, lux;
|
||||
// Console.log(data);
|
||||
|
||||
var raw = new Uint16Array(data);
|
||||
|
||||
@ -68,13 +70,9 @@ var CC2650_LUX = function(deviceId) {
|
||||
|
||||
this.state = [lux.toFixed(2), 'lux'].join(' ');
|
||||
|
||||
|
||||
//This.storeData(parseInt(lux));
|
||||
this.storeData(lux);
|
||||
|
||||
this.$result.text(this.state);
|
||||
|
||||
// Console.log('Luxometer:', this.state);
|
||||
};
|
||||
|
||||
this.animateGraph = function() {
|
||||
@ -97,7 +95,7 @@ var CC2650_LUX = function(deviceId) {
|
||||
row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-8 mui--text-white', id: lux}).appendTo(row);
|
||||
{class: 'mui-col-xs-8 mui--text-dark', id: lux}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
@ -107,10 +105,9 @@ var CC2650_LUX = function(deviceId) {
|
||||
|
||||
this.$result = $('#' + lux);
|
||||
|
||||
//Window.requestAnimFrame(this.animateFrame.bind(this));
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inheritsFrom(CC2650_LUX, CAPABILITY);
|
||||
capabilityManager.register({id:'F000AA70-0451-4000-B000-000000000000', module:CC2650_LUX});
|
||||
|
@ -9,10 +9,12 @@
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var CC2650_TMP = function(deviceId) {
|
||||
var CC2650_TMP = function(p) {
|
||||
'use strict';
|
||||
this.name = 'Thermopile';
|
||||
this.deviceID = deviceId;
|
||||
this.deviceID = p.deviceID || null;
|
||||
this.target = p.target || null;
|
||||
|
||||
this.capabilityID = 'F000AA00-0451-4000-B000-000000000000';
|
||||
this.serviceDef = {
|
||||
service: 'F000AA00-0451-4000-B000-000000000000',
|
||||
@ -25,6 +27,7 @@ var CC2650_TMP = function(deviceId) {
|
||||
|
||||
this.data = {temp: [], ambient: []};
|
||||
this.$result = {temp: null, ambient: null};
|
||||
this.setFrame();
|
||||
|
||||
this.startService = function() {
|
||||
'use strict';
|
||||
@ -80,8 +83,7 @@ var CC2650_TMP = function(deviceId) {
|
||||
|
||||
this.$result.temp.text(tStr);
|
||||
this.$result.ambient.text(aStr);
|
||||
|
||||
// Console.log('Thermopile:', this.state);
|
||||
|
||||
};
|
||||
|
||||
this.animateGraph = function() {
|
||||
@ -97,6 +99,7 @@ var CC2650_TMP = function(deviceId) {
|
||||
var self = this;
|
||||
// Console.log('Overloading...');
|
||||
// Call the parent displayForm first...
|
||||
|
||||
this.superClass_.insertFrame.call(self);
|
||||
|
||||
var temp = this.frameID + '-t';
|
||||
@ -107,7 +110,7 @@ var CC2650_TMP = function(deviceId) {
|
||||
{class: 'mui-col-xs-3 mui--text-accent', text: 'Temp:'}).appendTo(row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-white', id: temp}).appendTo(row);
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
|
||||
$('<div />',
|
||||
{
|
||||
class: 'mui-col-xs-3 mui--text-accent',
|
||||
@ -115,32 +118,23 @@ var CC2650_TMP = function(deviceId) {
|
||||
}).appendTo(row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-white', id: amb}).appendTo(row);
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: amb}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
var tabBody = $('<ul>',{class: 'mui-tabs__bar mui-tabs__bar--justified'});
|
||||
$('<li>',{class: 'mui--is-active'}).append($('<a>',{text:'Temperature','data-mui-toggle': 'tab', 'data-mui-controls': (temp + '-pane')})).appendTo(tabBody);
|
||||
$('<li>').append($('<a>',{text:'Ambient','data-mui-toggle': 'tab', 'data-mui-controls': (amb + '-pane')})).appendTo(tabBody);
|
||||
$('<li>',{class: 'mui--is-active tabOnWhite'}).append($('<a>',{ text: 'Temperature','data-mui-toggle': 'tab', 'data-mui-controls': (temp + '-pane')})).appendTo(tabBody);
|
||||
$('<li>', {class: 'tabOnWhite'}).append($('<a>',{ text: 'Ambient','data-mui-toggle': 'tab', 'data-mui-controls': (amb + '-pane')})).appendTo(tabBody);
|
||||
|
||||
this.$id.append(tabBody);
|
||||
|
||||
|
||||
/*
|
||||
<div class="mui-tabs__pane mui--is-active" id="pane-justified-1">Pane-1</div>
|
||||
<div class="mui-tabs__pane" id="pane-justified-2">Pane-2</div>
|
||||
|
||||
*/
|
||||
|
||||
blankChart = this.generateBlankGraph('temp');
|
||||
//this.$id.append(blankChart);
|
||||
|
||||
this.$id.append($('<div>',{'class':'mui-tabs__pane mui--is-active',id:(temp + '-pane')}).append(blankChart));
|
||||
this.$id.append($('<div>',{class: 'mui-tabs__pane mui--is-active',id: (temp + '-pane')}).append(blankChart));
|
||||
|
||||
blankChart = this.generateBlankGraph('ambient');
|
||||
|
||||
//this.$id.append(blankChart);
|
||||
this.$id.append($('<div>',{'class':'mui-tabs__pane',id:(amb + '-pane')}).append(blankChart));
|
||||
this.$id.append($('<div>',{class: 'mui-tabs__pane',id: (amb + '-pane')}).append(blankChart));
|
||||
|
||||
this.$result.temp = $('#' + temp);
|
||||
this.$result.ambient = $('#' + amb);
|
||||
@ -150,3 +144,5 @@ var CC2650_TMP = function(deviceId) {
|
||||
};
|
||||
|
||||
inheritsFrom(CC2650_TMP, CAPABILITY);
|
||||
|
||||
capabilityManager.register({id: 'F000AA00-0451-4000-B000-000000000000', module: CC2650_TMP});
|
||||
|
291
app/js/index.js
291
app/js/index.js
@ -17,14 +17,15 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/* global BATTERY, BUTTON */
|
||||
/* global BATTERY, BUTTON, bt_company_ids, ble, LocalFileSystem, capabilityManager */
|
||||
|
||||
var app = {
|
||||
stop: false,
|
||||
log: {},
|
||||
activeServices: [],
|
||||
activeServices: {},
|
||||
|
||||
list: {},
|
||||
foundDevices: {},
|
||||
|
||||
manufactureDecoder: new MANUFACTUREDECODER(),
|
||||
// Application Constructor
|
||||
@ -91,40 +92,118 @@ var app = {
|
||||
company = bt_company_ids.find(cid);
|
||||
|
||||
switch (manID) {
|
||||
case '004c':
|
||||
case '004c': {
|
||||
decoded = app.manufactureDecoder.decodeIbeacon(bin);
|
||||
decoded.company = company;
|
||||
return decoded;
|
||||
break;
|
||||
case '1235':
|
||||
break;
|
||||
}
|
||||
case '1235': {
|
||||
decoded = app.manufactureDecoder.decodeSiliconLabsSensorPuck(bin);
|
||||
decoded.company = company;
|
||||
return decoded;
|
||||
break;
|
||||
case '0060':
|
||||
break;
|
||||
|
||||
}
|
||||
case '0060': {
|
||||
decoded = app.manufactureDecoder.decodeSansible(bin);
|
||||
decoded.company = company;
|
||||
return decoded;
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
default: {
|
||||
console.log('Unknown manID: ', manID);
|
||||
decoded = {company: company};
|
||||
|
||||
}
|
||||
}
|
||||
return {company:company};
|
||||
return decoded;
|
||||
},
|
||||
makeHexBuffer : function(buffer) {
|
||||
makeHexBuffer: function(buffer) {
|
||||
'use strict';
|
||||
var hexBuffer = buffer.map(function(i) {
|
||||
return ('00' + i.toString(16)).slice(-2) + ',';
|
||||
});
|
||||
return hexBuffer;
|
||||
return hexBuffer;
|
||||
},
|
||||
makeChars : function(buffer) {
|
||||
makeChars: function(buffer) {
|
||||
'use strict';
|
||||
var output = buffer.map(function(i) {
|
||||
|
||||
return String.fromCharCode(i);
|
||||
});
|
||||
return String.fromCharCode(i);
|
||||
});
|
||||
|
||||
return output;
|
||||
},
|
||||
buildNewDeviceResultPanel: function(device) {
|
||||
'use strict';
|
||||
var newPanel, newRow;
|
||||
var otherData = device.otherData;
|
||||
var newId = 'd-' + device.id.replace(/:/g, '');
|
||||
var title = device.hasOwnProperty('name') ? device.name : '*** Unknown';
|
||||
|
||||
newPanel = $('<div>',{id: newId,class: 'mui-panel deviceRow', style: 'min-height:75px;'});
|
||||
|
||||
|
||||
newRow = $('<div>',{class: 'mui-row'});
|
||||
|
||||
newRow.append($('<div>',{class: 'mui-col-xs-12 mui--text-title',text: device.id}));
|
||||
|
||||
newPanel.append(newRow);
|
||||
|
||||
|
||||
newRow = $('<div>',{class: 'mui-row'});
|
||||
newRow.append($('<div>',{class: 'mui-col-xs-3',text: 'Title:'}));
|
||||
newRow.append($('<div>',{class: 'mui-col-xs-3',text: title}));
|
||||
newRow.append($('<div>',{class: 'mui-col-xs-3',text: 'RSSI:'}));
|
||||
newRow.append($('<div>',{class: 'mui-col-xs-3',text: device.rssi}));
|
||||
|
||||
newPanel.append(newRow);
|
||||
|
||||
if (typeof otherData !== 'undefined' && otherData !== null) {
|
||||
if (otherData.hasOwnProperty('msg')) {
|
||||
newRow = $('<div>',{class: 'mui-row'});
|
||||
newRow.append($('<div>',{class: 'mui-col-xs-3',text: 'Data:'}));
|
||||
newRow.append($('<div>',{class: 'mui-col-xs-8',text: otherData.msg}));
|
||||
newPanel.append(newRow);
|
||||
}
|
||||
}
|
||||
|
||||
return newPanel;
|
||||
},
|
||||
extractPData: function(prev) {
|
||||
'use strict';
|
||||
|
||||
if (typeof prev === 'undefined' || prev === null) {
|
||||
return {};
|
||||
}
|
||||
return prev.pData;
|
||||
|
||||
},
|
||||
|
||||
processPData: function(newData, oldData) {
|
||||
'use strict';
|
||||
var output = {};
|
||||
var wa = [];
|
||||
if (newData.data === null) {
|
||||
return {};
|
||||
}
|
||||
|
||||
for (var key in newData.data) {
|
||||
|
||||
if (newData.data.hasOwnProperty(key)) {
|
||||
|
||||
if (Object.keys(oldData).indexOf(key) !== -1) {
|
||||
wa = oldData[key];
|
||||
}
|
||||
|
||||
if (wa.length === 99) {
|
||||
wa = wa.slice(1);
|
||||
}
|
||||
|
||||
wa.push(newData.data[key]);
|
||||
|
||||
output[key] = wa;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
@ -145,28 +224,26 @@ var app = {
|
||||
var newTR;
|
||||
var newId;
|
||||
var _device = device;
|
||||
var $newID;
|
||||
|
||||
_device.pData = {};
|
||||
|
||||
otherData = null;
|
||||
msgText = '';
|
||||
console.log(JSON.stringify(device));
|
||||
|
||||
newId = device.id.replace(/:/g, '');
|
||||
console.log(newId);
|
||||
newId = 'd-' + _device.id.replace(/:/g, '');
|
||||
|
||||
this.list[newId] = device.id;
|
||||
this.list[newId] = _device.id;
|
||||
|
||||
newTR = $('<tr id="' + newId + '" class="clickRow">');
|
||||
if (_device.hasOwnProperty('advertising')) {
|
||||
|
||||
newTR.append($('<td>').text(device.id));
|
||||
|
||||
if (device.hasOwnProperty('advertising')) {
|
||||
|
||||
advertBuffer = app.arrayBufferToIntArray(device.advertising);
|
||||
advertBuffer = app.arrayBufferToIntArray(_device.advertising);
|
||||
|
||||
hexBuffer = app.makeHexBuffer(advertBuffer);
|
||||
|
||||
parsed = app.parseAdvertisingData(advertBuffer);
|
||||
|
||||
//Console.log(parsed);
|
||||
// Console.log(parsed);
|
||||
|
||||
if (parsed.hasOwnProperty('9')) {
|
||||
|
||||
@ -188,42 +265,35 @@ var app = {
|
||||
_device.parsed = parsed;
|
||||
}
|
||||
|
||||
if (typeof otherData !== 'undefined' && otherData !== null) {
|
||||
if (otherData.hasOwnProperty('msg')) {
|
||||
msgText = ' - ' + otherData.msg;
|
||||
}
|
||||
}
|
||||
newTR = app.buildNewDeviceResultPanel(device);
|
||||
|
||||
if (device.hasOwnProperty('name')) {
|
||||
newTR.append($('<td>').text(device.name + msgText));
|
||||
$newID = $('div#' + newId);
|
||||
if ($newID.length > 0) {
|
||||
$newID.replaceWith(newTR);
|
||||
} else {
|
||||
newTR.append($('<td>').text('*** Unknown' + msgText));
|
||||
$('#scanResults').append(newTR);
|
||||
}
|
||||
|
||||
newTR.append($('<td>').text(device.rssi));
|
||||
// $('#output').append(JSON.stringify(device) + '<br/>');
|
||||
|
||||
var oldPdata = app.extractPData(app.log[newId]);
|
||||
|
||||
if ($('tr#' + newId).length > 0) {
|
||||
$('tr#' + newId).replaceWith(newTR);
|
||||
} else {
|
||||
$('#tbody').append(newTR);
|
||||
}
|
||||
var newPData = app.processPData(otherData, oldPdata);
|
||||
|
||||
|
||||
//$('#output').append(JSON.stringify(device) + '<br/>');
|
||||
// Console.log(newPData);
|
||||
_device.pData = newPData;
|
||||
|
||||
app.log[newId] = _device;
|
||||
app.foundDevices[newId] = _device;
|
||||
|
||||
console.log(JSON.stringify(_device));
|
||||
// Console.log(JSON.stringify(_device));
|
||||
|
||||
}.bind(this), function(e) {
|
||||
'use strict';
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
var _t = [5000,60000,200][mode];
|
||||
|
||||
|
||||
setTimeout(ble.stopScan,
|
||||
_t,
|
||||
function() { console.log('Scan complete');
|
||||
@ -329,10 +399,9 @@ var app = {
|
||||
this.doScan(1);
|
||||
}.bind(this));
|
||||
|
||||
$('#tbody').on('click', 'tr', function() {
|
||||
$('#scanResults').on('click', 'div.mui-panel.deviceRow', function() {
|
||||
'use strict';
|
||||
var tID = $(this).context.id;
|
||||
|
||||
var id = self.list[tID];
|
||||
|
||||
console.log(tID, id);
|
||||
@ -341,7 +410,31 @@ var app = {
|
||||
self.connect(id);
|
||||
});
|
||||
|
||||
}, // Deviceready Event Handler
|
||||
},
|
||||
addTab: function(tID) {
|
||||
var appTabs = $('#app-tabs');
|
||||
var panes = $('#tab-panes');
|
||||
|
||||
var paneID = 'pane-' + tID;
|
||||
var id = app.list[tID];
|
||||
|
||||
var _device = app.foundDevices[tID];
|
||||
var _name = _device.name || _device.id;
|
||||
|
||||
console.log('Found:', _device);
|
||||
|
||||
$('<div>', {class: 'mui-tabs__pane', id: paneID}).appendTo(panes);
|
||||
|
||||
|
||||
var li = $('<li>').append($('<a>',{'data-mui-toggle': 'tab', 'data-mui-controls': paneID, text: _name }));
|
||||
|
||||
appTabs.append(li);
|
||||
|
||||
return paneID;
|
||||
|
||||
},
|
||||
|
||||
// Deviceready Event Handler
|
||||
//
|
||||
// The scope of 'this' is the event. In order to call the 'receivedEvent'
|
||||
// function, we must explicitly call 'app.receivedEvent(...);'
|
||||
@ -369,84 +462,63 @@ var app = {
|
||||
}
|
||||
|
||||
window.requestAnimFrame(app.doAnimate.bind(this));
|
||||
}
|
||||
|
||||
, connect: function(deviceId) {
|
||||
},
|
||||
connect: function(deviceId) {
|
||||
|
||||
$('#results').slideUp();
|
||||
console.log('Connect to ', deviceId);
|
||||
|
||||
var tID = 'd-' + deviceId.replace(/:/g, '');
|
||||
|
||||
var onConnect = function(a) {
|
||||
var services = [];
|
||||
|
||||
'use strict';
|
||||
|
||||
console.log('A:', a);
|
||||
|
||||
services = a.services;
|
||||
|
||||
|
||||
console.log('Searching services for ', tID);
|
||||
var usedServices = [];
|
||||
|
||||
var target = app.addTab(tID);
|
||||
|
||||
var _params = {
|
||||
deviceID: deviceId,
|
||||
target: target
|
||||
};
|
||||
|
||||
for (var t = 0; t < services.length; t++) {
|
||||
|
||||
var ident = services[t].toUpperCase();
|
||||
|
||||
switch (ident) {
|
||||
case '180F':
|
||||
var batteryStat = new BATTERY(deviceId);
|
||||
batteryStat.startService();
|
||||
// batteryStat.readBatteryState();
|
||||
app.activeServices.push(batteryStat);
|
||||
var SERVICE = capabilityManager.discover(ident);
|
||||
|
||||
break;
|
||||
case 'FFE0':
|
||||
var buttonState = new BUTTON(deviceId);
|
||||
buttonState.startService();
|
||||
app.activeServices.push(buttonState);
|
||||
break;
|
||||
if (SERVICE !== null) {
|
||||
|
||||
case 'F000AA80-0451-4000-B000-000000000000':
|
||||
var cc2650_accel = new CC2650_ACCEL(deviceId);
|
||||
cc2650_accel.startService();
|
||||
app.activeServices.push(cc2650_accel);
|
||||
break;
|
||||
|
||||
case 'F000AA40-0451-4000-B000-000000000000':
|
||||
var cc2650_bar = new CC2650_BAR(deviceId);
|
||||
cc2650_bar.startService();
|
||||
app.activeServices.push(cc2650_bar);
|
||||
break;
|
||||
|
||||
case 'F000AA70-0451-4000-B000-000000000000':
|
||||
var cc2650_lux = new CC2650_LUX(deviceId);
|
||||
cc2650_lux.startService();
|
||||
app.activeServices.push(cc2650_lux);
|
||||
break;
|
||||
|
||||
case 'F000AA00-0451-4000-B000-000000000000':
|
||||
var cc2650_tmp = new CC2650_TMP(deviceId);
|
||||
cc2650_tmp.startService();
|
||||
app.activeServices.push(cc2650_tmp);
|
||||
break;
|
||||
|
||||
|
||||
case 'F000AA20-0451-4000-B000-000000000000':
|
||||
var cc2650_hum = new CC2650_HUM(deviceId);
|
||||
cc2650_hum.startService();
|
||||
app.activeServices.push(cc2650_hum);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error('Unknown service: ', ident);
|
||||
var newService = new SERVICE(_params);
|
||||
newService.startService();
|
||||
usedServices.push(newService);
|
||||
} else {
|
||||
console.error('Unknown service: ', ident);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Starting animation..
|
||||
app.activeServices[tID] = usedServices;
|
||||
|
||||
mui.tabs.activate(target);
|
||||
window.requestAnimFrame(app.doAnimate.bind(this));
|
||||
};
|
||||
|
||||
ble.connect(deviceId, onConnect, function(e) {
|
||||
'use strict';
|
||||
console.error(e);
|
||||
});
|
||||
if (!app.activeServices.hasOwnProperty(tID)) {
|
||||
|
||||
ble.connect(deviceId, onConnect, function(e) {
|
||||
'use strict';
|
||||
console.log(e);
|
||||
console.error(e);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}, onError: function(reason) {
|
||||
console.error('ERROR: ' + reason); // Real apps should use notification.alert
|
||||
@ -456,7 +528,6 @@ var app = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
window.requestAnimFrame = (function() {
|
||||
return window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
@ -466,6 +537,4 @@ window.requestAnimFrame = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
|
||||
app.initialize();
|
||||
|
@ -35,17 +35,17 @@ var MANUFACTUREDECODER = function() {
|
||||
};
|
||||
this.decodeSiliconLabsSensorPuck = function(data) {
|
||||
var bin = data;
|
||||
var obj = {};
|
||||
var obj = {data:{}};
|
||||
//obj.manID = ('0000' + ((bin[1] << 8) | bin[0]).toString(16)).slice(-4);
|
||||
obj.manID = this.getManID(bin);
|
||||
obj.a = (bin[3] << 8) | bin[2];
|
||||
obj.b = (bin[5] << 8) | bin[4];
|
||||
obj.humidity = (bin[7] << 8) | bin[6];
|
||||
obj.temp = (bin[9] << 8) | bin[8];
|
||||
obj.data.humidity = (bin[7] << 8) | bin[6];
|
||||
obj.data.temp = (bin[9] << 8) | bin[8];
|
||||
obj.c = (bin[11] << 8) | bin[10];
|
||||
obj.d = (bin[13] << 8) | bin[12];
|
||||
|
||||
obj.msg = 'Humidity: ' + (obj.humidity / 10) + ', temp: ' + (obj.temp / 10);
|
||||
obj.msg = 'Humidity: ' + (obj.data.humidity / 10) + ', temp: ' + (obj.data.temp / 10);
|
||||
|
||||
return obj;
|
||||
};
|
||||
@ -53,14 +53,14 @@ var MANUFACTUREDECODER = function() {
|
||||
|
||||
this.decodeSansible = function(data) {
|
||||
var bin = data;
|
||||
var obj = {};
|
||||
var obj = {data:{}};
|
||||
// obj.manID = ('0000' + ((bin[1] << 8) | bin[0]).toString(16)).slice(-4);
|
||||
obj.manID = this.getManID(bin);
|
||||
|
||||
obj.p1 = ((bin[2] << 16) | bin[3] << 8 | bin[4])
|
||||
obj.p2 = ((bin[5] << 16) | bin[6] << 8 | bin[7])
|
||||
obj.data.p1 = ((bin[2] << 16) | bin[3] << 8 | bin[4]);
|
||||
obj.data.p2 = ((bin[5] << 16) | bin[6] << 8 | bin[7]);
|
||||
|
||||
obj.msg = 'Left: ' + (obj.p1 / 100) + ' hPa, Right: ' + (obj.p2 / 100) + ' hPa';
|
||||
obj.msg = 'Left: ' + (obj.data.p1 / 100) + ' hPa, Right: ' + (obj.data.p2 / 100) + ' hPa';
|
||||
return obj;
|
||||
|
||||
};
|
||||
|
@ -53,9 +53,9 @@ var BATTERY = function() {
|
||||
this.onError);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inheritsFrom(BATTERY, CAPABILITY);
|
||||
capabilityManager.register({id: '180F', module: BATTERY});
|
||||
|
@ -9,10 +9,12 @@
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var BUTTON = function(deviceId) {
|
||||
var BUTTON = function(p) {
|
||||
'use strict';
|
||||
this.name = 'Button';
|
||||
this.deviceID = deviceId;
|
||||
this.deviceID = p.deviceID || null;
|
||||
this.target = p.target || null;
|
||||
|
||||
this.capabilityID = 'FFE0';
|
||||
this.serviceDef = {
|
||||
service: 'FFE0',
|
||||
@ -25,6 +27,8 @@ var BUTTON = function(deviceId) {
|
||||
REED_SWITCH: 4 // 0100
|
||||
};
|
||||
|
||||
this.setFrame();
|
||||
|
||||
this.onButtonData = function(data) {
|
||||
console.log('+ onButtonData');
|
||||
console.log(data);
|
||||
@ -83,7 +87,7 @@ var BUTTON = function(deviceId) {
|
||||
|
||||
$('<div />', { class: 'mui-col-xs-4 mui--text-accent', text: 'Status:'}).appendTo(row);
|
||||
|
||||
$('<div />', { class: 'mui-col-xs-8 mui--text-white', id: detail}).appendTo(row);
|
||||
$('<div />', { class: 'mui-col-xs-8 mui--text-dark', id: detail}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
this.$result = $('#'+detail);
|
||||
@ -94,3 +98,4 @@ var BUTTON = function(deviceId) {
|
||||
|
||||
|
||||
inheritsFrom(BUTTON, CAPABILITY);
|
||||
capabilityManager.register({id: 'FFE0', module: BUTTON});
|
||||
|
@ -6,6 +6,23 @@
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
var capabilityManager = {
|
||||
capabilityList : [],
|
||||
register : function(details) {
|
||||
console.log('Registered:', details );
|
||||
this.capabilityList.push(details);
|
||||
},
|
||||
discover : function(id) {
|
||||
|
||||
var wanted = this.capabilityList.filter(function(obj) {
|
||||
return obj.id === id;
|
||||
});
|
||||
|
||||
return wanted.length === 1 ? wanted[0].module : null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var CAPABILITY = function(p) {
|
||||
this.name = '-CAPABILITY-';
|
||||
this.capabilityID = p.capabilityID || null;
|
||||
@ -22,6 +39,13 @@ var CAPABILITY = function(p) {
|
||||
this.ctx = null;
|
||||
this.first = false;
|
||||
|
||||
this.target = null;
|
||||
this.$frame = null;
|
||||
capabilityManager.register({id:this.capabilityID, module:this});
|
||||
};
|
||||
|
||||
CAPABILITY.prototype.setFrame = function() {
|
||||
this.$frame = (this.target !== null) ? $('#'+ this.target) : null;
|
||||
};
|
||||
|
||||
CAPABILITY.prototype.setInternalID = function() {
|
||||
@ -51,7 +75,7 @@ CAPABILITY.prototype.insertFrame = function() {
|
||||
|
||||
$('<div />', { class: 'mui-row'}).append($('<div />', { class: 'mui-col-xs-12 mui--text-title', text: title})).appendTo(frame);
|
||||
|
||||
$('#frames').append(frame);
|
||||
this.$frame.append(frame);
|
||||
this.$id = $('#' + this.frameID);
|
||||
};
|
||||
|
||||
@ -122,7 +146,7 @@ CAPABILITY.prototype.generateBlankGraph = function(subID) {
|
||||
line.setAttributeNS(null,'y1','12');
|
||||
line.setAttributeNS(null,'x2','280');
|
||||
line.setAttributeNS(null,'y2', '12');
|
||||
line.setAttributeNS(null,'style','stroke:#bad649;stroke-width:2;');
|
||||
line.setAttributeNS(null,'style','stroke:#004c6d;stroke-width:2;');
|
||||
|
||||
svg.appendChild(line);
|
||||
|
||||
@ -132,7 +156,7 @@ CAPABILITY.prototype.generateBlankGraph = function(subID) {
|
||||
line.setAttributeNS(null,'y1','136');
|
||||
line.setAttributeNS(null,'x2','280');
|
||||
line.setAttributeNS(null,'y2', '136');
|
||||
line.setAttributeNS(null,'style','stroke:#bad649;stroke-width:2;');
|
||||
line.setAttributeNS(null,'style','stroke:#004c6d;stroke-width:2;');
|
||||
|
||||
svg.appendChild(line);
|
||||
|
||||
@ -142,7 +166,7 @@ CAPABILITY.prototype.generateBlankGraph = function(subID) {
|
||||
text.setAttributeNS(null,'x','36');
|
||||
text.setAttributeNS(null,'y','15');
|
||||
text.setAttributeNS(null,'text-anchor', 'end');
|
||||
text.setAttributeNS(null,'style','font-family:"Ubuntu Condensed",sans-serif;font-size:12;fill: #bad649;text-align:right;');
|
||||
text.setAttributeNS(null,'style','font-family:"Ubuntu Condensed",sans-serif;font-size:12;fill: #004c6d;text-align:right;');
|
||||
text.textContent = '000';
|
||||
|
||||
svg.appendChild(text);
|
||||
@ -153,7 +177,7 @@ CAPABILITY.prototype.generateBlankGraph = function(subID) {
|
||||
text.setAttributeNS(null,'x','36');
|
||||
text.setAttributeNS(null,'y','140');
|
||||
text.setAttributeNS(null,'text-anchor', 'end');
|
||||
text.setAttributeNS(null,'style','font-family:"Ubuntu Condensed",sans-serif;font-size:12;fill: #bad649;text-align:right;');
|
||||
text.setAttributeNS(null,'style','font-family:"Ubuntu Condensed",sans-serif;font-size:12;fill: #004c6d;text-align:right;');
|
||||
text.textContent = '0';
|
||||
|
||||
svg.appendChild(text);
|
||||
@ -162,7 +186,7 @@ CAPABILITY.prototype.generateBlankGraph = function(subID) {
|
||||
|
||||
polyline.setAttributeNS(null,'id',lineID);
|
||||
polyline.setAttributeNS(null,'fill','none');
|
||||
polyline.setAttributeNS(null,'stroke','#e5f7fd');
|
||||
polyline.setAttributeNS(null,'stroke','#2196F3');
|
||||
//#e5f7fd
|
||||
// old #B5C7FF
|
||||
polyline.setAttributeNS(null,'text-anchor', 'end');
|
||||
|
15
app/js/standards/gadget.js
Normal file
15
app/js/standards/gadget.js
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-06-01
|
||||
* Time: 13:30
|
||||
*
|
||||
*/
|
||||
|
||||
var GADGET = function(p) {
|
||||
'use strict';
|
||||
|
||||
|
||||
this._gadget = p;
|
||||
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mui",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.9",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
"Andres Morey <andres@muicss.com>"
|
||||
@ -38,14 +38,13 @@
|
||||
"package.json",
|
||||
"test"
|
||||
],
|
||||
"_release": "0.6.0",
|
||||
"_release": "0.5.9",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.6.0",
|
||||
"commit": "f6ffa0a7a64311adbb8a92ae2b3bc05c5bc7bd7b"
|
||||
"tag": "0.5.9",
|
||||
"commit": "12b7c78ed3243af477f16aafb553d977628df82f"
|
||||
},
|
||||
"_source": "https://github.com/muicss/mui.git",
|
||||
"_target": "^0.6.0",
|
||||
"_originalSource": "mui",
|
||||
"_direct": true
|
||||
"_target": "^0.5.3",
|
||||
"_originalSource": "mui"
|
||||
}
|
@ -1,9 +1,5 @@
|
||||
# MUI Changelog
|
||||
|
||||
## 0.6.0 - May 22, 2016
|
||||
|
||||
* Added support for select box label to MUI CSS/JS, MUI React and MUI Angular
|
||||
|
||||
## 0.5.9 - May 17, 2016
|
||||
|
||||
* Set z-index of .mui-select__menu to 2 to fix overlap bug with floating action
|
||||
|
@ -12,8 +12,8 @@ MUI is a lightweight CSS framework that follows Google's Material Design guideli
|
||||
**Use From the CDN:**
|
||||
|
||||
```html
|
||||
<link href="//cdn.muicss.com/mui-0.6.0/css/mui.min.css" rel="stylesheet" type="text/css" />
|
||||
<script src="//cdn.muicss.com/mui-0.6.0/js/mui.min.js"></script>
|
||||
<link href="//cdn.muicss.com/mui-0.5.9/css/mui.min.css" rel="stylesheet" type="text/css" />
|
||||
<script src="//cdn.muicss.com/mui-0.5.9/js/mui.min.js"></script>
|
||||
```
|
||||
|
||||
Or for development you can use the latest:
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mui",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.9",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
"Andres Morey <andres@muicss.com>"
|
||||
|
@ -1503,14 +1503,13 @@ _angular2.default.module(moduleName, []).directive('muiSelect', ['$timeout', fun
|
||||
restrict: 'AE',
|
||||
require: ['ngModel'],
|
||||
scope: {
|
||||
label: '@',
|
||||
name: '@',
|
||||
ngDisabled: '=',
|
||||
ngModel: '='
|
||||
},
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<div class="mui-select" ' + 'ng-blur="onWrapperBlur()" ' + 'ng-focus="onWrapperFocus($event)" ' + 'ng-keydown="onWrapperKeydown($event)">' + '<select ' + 'name="{{name}}" ' + 'ng-click="onClick()" ' + 'ng-disabled="ngDisabled" ' + 'ng-focus="onFocus()" ' + 'ng-model="ngModel" ' + 'ng-mousedown="onMousedown($event)" ' + '>' + '<option ng-repeat="option in options" value="{{option.value}}">{{option.label}}</option>' + '</select>' + '<label>{{label}}</label>' + '<div ' + 'class="mui-select__menu"' + 'ng-show="!useDefault && isOpen"> ' + '<div ' + 'ng-click="chooseOption(option)" ' + 'ng-repeat="option in options track by $index" ' + 'ng-class=\'{"mui--is-selected": $index === menuIndex}\'>{{option.label}}</div>' + '</div>' + '</div>',
|
||||
template: '<div class="mui-select" ' + 'ng-blur="onWrapperBlur()" ' + 'ng-focus="onWrapperFocus($event)" ' + 'ng-keydown="onWrapperKeydown($event)">' + '<select ' + 'name="{{name}}" ' + 'ng-click="onClick()" ' + 'ng-disabled="ngDisabled" ' + 'ng-focus="onFocus()" ' + 'ng-model="ngModel" ' + 'ng-mousedown="onMousedown($event)" ' + '>' + '<option ng-repeat="option in options" value="{{option.value}}">{{option.label}}</option>' + '</select>' + '<div ' + 'class="mui-select__menu"' + 'ng-show="!useDefault && isOpen"> ' + '<div ' + 'ng-click="chooseOption(option)" ' + 'ng-repeat="option in options track by $index" ' + 'ng-class=\'{"mui--is-selected": $index === menuIndex}\'>{{option.label}}</div>' + '</div>' + '</div>',
|
||||
link: function link(scope, element, attrs, controller, transcludeFn) {
|
||||
var wrapperEl = element,
|
||||
menuEl = element.find('div'),
|
||||
|
File diff suppressed because one or more lines are too long
@ -1648,25 +1648,6 @@ h4, h5, h6 {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mui-select > label {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
display: block;
|
||||
width: 100%;
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 15px;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mui-select:focus > label,
|
||||
.mui-select > select:focus ~ label {
|
||||
color: #2196F3;
|
||||
}
|
||||
|
||||
.mui-select__menu {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
|
2
app/libs/mui/packages/cdn/css/mui.min.css
vendored
2
app/libs/mui/packages/cdn/css/mui.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2806,11 +2806,6 @@ var Select = function (_React$Component) {
|
||||
},
|
||||
this.props.children
|
||||
),
|
||||
_react2.default.createElement(
|
||||
'label',
|
||||
null,
|
||||
this.props.label
|
||||
),
|
||||
menuElem
|
||||
);
|
||||
}
|
||||
@ -2825,7 +2820,6 @@ var Select = function (_React$Component) {
|
||||
|
||||
|
||||
Select.propTypes = {
|
||||
label: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
defaultValue: PropTypes.string,
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1648,25 +1648,6 @@ h4, h5, h6 {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mui-select > label {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
display: block;
|
||||
width: 100%;
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 15px;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mui-select:focus > label,
|
||||
.mui-select > select:focus ~ label {
|
||||
color: #2196F3;
|
||||
}
|
||||
|
||||
.mui-select__menu {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
Package.describe({
|
||||
name: 'muicss:mui',
|
||||
version: '0.6.0',
|
||||
version: '0.5.9',
|
||||
// Brief, one-line summary of the package.
|
||||
summary: 'MUI is a lightweight CSS framework based on Google\'s Material Design guidelines',
|
||||
// URL to the Git repository containing the source code for this package.
|
||||
|
@ -251,7 +251,6 @@ import Select from 'muicss/lib/react/select';
|
||||
|
||||
<Select />
|
||||
* {String} defaultValue
|
||||
* {String} label
|
||||
* {String} name
|
||||
* {String} value
|
||||
* {Boolean} autoFocus=false|true
|
||||
|
@ -32,14 +32,13 @@ _angular2.default.module(moduleName, []).directive('muiSelect', ['$timeout', fun
|
||||
restrict: 'AE',
|
||||
require: ['ngModel'],
|
||||
scope: {
|
||||
label: '@',
|
||||
name: '@',
|
||||
ngDisabled: '=',
|
||||
ngModel: '='
|
||||
},
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<div class="mui-select" ' + 'ng-blur="onWrapperBlur()" ' + 'ng-focus="onWrapperFocus($event)" ' + 'ng-keydown="onWrapperKeydown($event)">' + '<select ' + 'name="{{name}}" ' + 'ng-click="onClick()" ' + 'ng-disabled="ngDisabled" ' + 'ng-focus="onFocus()" ' + 'ng-model="ngModel" ' + 'ng-mousedown="onMousedown($event)" ' + '>' + '<option ng-repeat="option in options" value="{{option.value}}">{{option.label}}</option>' + '</select>' + '<label>{{label}}</label>' + '<div ' + 'class="mui-select__menu"' + 'ng-show="!useDefault && isOpen"> ' + '<div ' + 'ng-click="chooseOption(option)" ' + 'ng-repeat="option in options track by $index" ' + 'ng-class=\'{"mui--is-selected": $index === menuIndex}\'>{{option.label}}</div>' + '</div>' + '</div>',
|
||||
template: '<div class="mui-select" ' + 'ng-blur="onWrapperBlur()" ' + 'ng-focus="onWrapperFocus($event)" ' + 'ng-keydown="onWrapperKeydown($event)">' + '<select ' + 'name="{{name}}" ' + 'ng-click="onClick()" ' + 'ng-disabled="ngDisabled" ' + 'ng-focus="onFocus()" ' + 'ng-model="ngModel" ' + 'ng-mousedown="onMousedown($event)" ' + '>' + '<option ng-repeat="option in options" value="{{option.value}}">{{option.label}}</option>' + '</select>' + '<div ' + 'class="mui-select__menu"' + 'ng-show="!useDefault && isOpen"> ' + '<div ' + 'ng-click="chooseOption(option)" ' + 'ng-repeat="option in options track by $index" ' + 'ng-class=\'{"mui--is-selected": $index === menuIndex}\'>{{option.label}}</div>' + '</div>' + '</div>',
|
||||
link: function link(scope, element, attrs, controller, transcludeFn) {
|
||||
var wrapperEl = element,
|
||||
menuEl = element.find('div'),
|
||||
|
@ -1648,25 +1648,6 @@ h4, h5, h6 {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mui-select > label {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
display: block;
|
||||
width: 100%;
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 15px;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mui-select:focus > label,
|
||||
.mui-select > select:focus ~ label {
|
||||
color: #2196F3;
|
||||
}
|
||||
|
||||
.mui-select__menu {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
|
File diff suppressed because one or more lines are too long
@ -250,11 +250,6 @@ var Select = function (_React$Component) {
|
||||
},
|
||||
this.props.children
|
||||
),
|
||||
_react2.default.createElement(
|
||||
'label',
|
||||
null,
|
||||
this.props.label
|
||||
),
|
||||
menuElem
|
||||
);
|
||||
}
|
||||
@ -269,7 +264,6 @@ var Select = function (_React$Component) {
|
||||
|
||||
|
||||
Select.propTypes = {
|
||||
label: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
defaultValue: PropTypes.string,
|
||||
|
@ -2,4 +2,3 @@
|
||||
@import "mixins/util";
|
||||
@import "mixins/buttons";
|
||||
@import "mixins/typography";
|
||||
@import "mixins/forms";
|
||||
|
@ -69,15 +69,6 @@ $xFormLabelLineHeight: floor($mui-label-font-size * 1.25);
|
||||
opacity: 1; // iOS fix for unreadable disabled content
|
||||
}
|
||||
}
|
||||
|
||||
> label {
|
||||
@include form-label();
|
||||
}
|
||||
}
|
||||
|
||||
.mui-select:focus > label,
|
||||
.mui-select > select:focus ~ label {
|
||||
color: $mui-input-border-color-focus;
|
||||
}
|
||||
|
||||
.mui-select__menu {
|
||||
|
@ -17,7 +17,22 @@ $xFormLabelLineHeight: floor($mui-label-font-size * 1.25);
|
||||
position: relative;
|
||||
|
||||
> label {
|
||||
@include form-label();
|
||||
// Positioning
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
// Display
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
// Other
|
||||
color: $mui-label-font-color;
|
||||
font-size: $mui-label-font-size;
|
||||
font-weight: 400;
|
||||
line-height: $xFormLabelLineHeight;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
> textarea {
|
||||
|
2
app/libs/mui/src/angular/select.js
vendored
2
app/libs/mui/src/angular/select.js
vendored
@ -19,7 +19,6 @@ angular.module(moduleName, [])
|
||||
restrict: 'AE',
|
||||
require: ['ngModel'],
|
||||
scope: {
|
||||
label: '@',
|
||||
name: '@',
|
||||
ngDisabled: '=',
|
||||
ngModel: '='
|
||||
@ -40,7 +39,6 @@ angular.module(moduleName, [])
|
||||
'>' +
|
||||
'<option ng-repeat="option in options" value="{{option.value}}">{{option.label}}</option>' +
|
||||
'</select>' +
|
||||
'<label>{{label}}</label>' +
|
||||
'<div ' +
|
||||
'class="mui-select__menu"' +
|
||||
'ng-show="!useDefault && isOpen"> ' +
|
||||
|
@ -51,7 +51,6 @@ class Select extends React.Component {
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
label: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
defaultValue: PropTypes.string,
|
||||
@ -235,7 +234,6 @@ class Select extends React.Component {
|
||||
>
|
||||
{this.props.children}
|
||||
</select>
|
||||
<label>{this.props.label}</label>
|
||||
{menuElem}
|
||||
</div>
|
||||
);
|
||||
|
@ -2,4 +2,3 @@
|
||||
@import "mixins/util";
|
||||
@import "mixins/buttons";
|
||||
@import "mixins/typography";
|
||||
@import "mixins/forms";
|
||||
|
@ -69,15 +69,6 @@ $xFormLabelLineHeight: floor($mui-label-font-size * 1.25);
|
||||
opacity: 1; // iOS fix for unreadable disabled content
|
||||
}
|
||||
}
|
||||
|
||||
> label {
|
||||
@include form-label();
|
||||
}
|
||||
}
|
||||
|
||||
.mui-select:focus > label,
|
||||
.mui-select > select:focus ~ label {
|
||||
color: $mui-input-border-color-focus;
|
||||
}
|
||||
|
||||
.mui-select__menu {
|
||||
|
@ -17,7 +17,22 @@ $xFormLabelLineHeight: floor($mui-label-font-size * 1.25);
|
||||
position: relative;
|
||||
|
||||
> label {
|
||||
@include form-label();
|
||||
// Positioning
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
// Display
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
// Other
|
||||
color: $mui-label-font-color;
|
||||
font-size: $mui-label-font-size;
|
||||
font-weight: 400;
|
||||
line-height: $xFormLabelLineHeight;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
> textarea {
|
||||
|
File diff suppressed because one or more lines are too long
13
custom.scss
Normal file
13
custom.scss
Normal file
@ -0,0 +1,13 @@
|
||||
@import "app/libs/mui/src/sass/mui/colors";
|
||||
|
||||
|
||||
$mui-body-bg-color: mui-color('grey', '100');
|
||||
$mui-accent-color: #bad649;
|
||||
$mui-btn-accent-font-color: #004c6d;
|
||||
$mui-accent-color-dark: mui-color('green', 'A100');
|
||||
$mui-accent-color-light: mui-color('green', 'A400');
|
||||
$mui-tab-font-color: rgba(255, 255, 255, 0.87);
|
||||
$mui-appbar-bg-color: #004c6d;
|
||||
|
||||
// import MUI SASS
|
||||
@import "app/libs/mui/src/sass/mui";
|
Loading…
Reference in New Issue
Block a user