mirror of
https://gitlab.silvrtree.co.uk/martind2000/censis-archive.git
synced 2025-02-10 20:09:17 +00:00
”2016-06-09”
This commit is contained in:
parent
1f362f4fbe
commit
3b08c6bfe7
@ -118,6 +118,10 @@
|
||||
src="js/device/CC2650/cc2650_humidity.js"></script>
|
||||
<!-- endbuild -->
|
||||
|
||||
<script type="text/javascript"
|
||||
src="js/device/fmc/TSL.js"></script>
|
||||
|
||||
|
||||
<!-- build:js -->
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
<!-- endbuild -->
|
||||
|
205
sensortoy/sensortoy/app/js/device/fmc/TSL.js
Normal file
205
sensortoy/sensortoy/app/js/device/fmc/TSL.js
Normal file
@ -0,0 +1,205 @@
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-05-20
|
||||
* Time: 10:13
|
||||
*
|
||||
*/
|
||||
/* global CAPABILITY, inheritsFrom, capabilityManager */
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var TSL = function(p) {
|
||||
'use strict';
|
||||
this.name = 'TSL';
|
||||
this.deviceID = p.deviceID || null;
|
||||
this.target = p.target || null;
|
||||
|
||||
// F000BB00-0451-4000-B000-A01D48F70D07
|
||||
|
||||
this.capabilityID = 'F000BB00-0451-4000-B000-A01D48F70D07';
|
||||
this.serviceDef = {
|
||||
service: 'F000BB00-0451-4000-B000-A01D48F70D07',
|
||||
enable: 'F000BB01-0451-4000-B000-A01D48F70D07',
|
||||
control: 'F000BB02-0451-4000-B000-A01D48F70D07',
|
||||
period: 'F000BB03-0451-4000-B000-A01D48F70D07',
|
||||
location: 'F000BB04-0451-4000-B000-A01D48F70D07',
|
||||
historySize: 'F000BB05-0451-4000-B000-A01D48F70D07',
|
||||
history: 'F000BB06-0451-4000-B000-A01D48F70D07',
|
||||
historyAck: 'F000BB07-0451-4000-B000-A01D48F70D07',
|
||||
temp: 'F000BB08-0451-4000-B000-A01D48F70D07',
|
||||
tempMaximum: 'F000BB09-0451-4000-B000-A01D48F70D07',
|
||||
tempMinimum: 'F000BB0A-0451-4000-B000-A01D48F70D07',
|
||||
preValue: 'F000BB0B-0451-4000-B000-A01D48F70D07',
|
||||
presMaximum: 'F000BB0C-0451-4000-B000-A01D48F70D07',
|
||||
presMinimum: 'F000BB0D-0451-4000-B000-A01D48F70D07',
|
||||
humidityValue: 'F000BB0E-0451-4000-B000-A01D48F70D07',
|
||||
humidityMax: 'F000BB0F-0451-4000-B000-A01D48F70D07',
|
||||
humidityMin: 'F000BB10-0451-4000-B000-A01D48F70D07',
|
||||
accelerationMax: 'F000BB11-0451-4000-B000-A01D48F70D07',
|
||||
velocityMax: 'F000BB12-0451-4000-B000-A01D48F70D07',
|
||||
loggerId: 'F000BB13-0451-4000-B000-A01D48F70D07',
|
||||
shockBandwidth: 'F000BB14-0451-4000-B000-A01D48F70D07',
|
||||
shockThreshold: 'F000BB15-0451-4000-B000-A01D48F70D07',
|
||||
config: 'F0002902-0451-4000-B000-A01D48F70D07'
|
||||
|
||||
};
|
||||
|
||||
this.$result = {temp: null, tempMax: null, tempMin: null};
|
||||
this.data = [];
|
||||
this.setFrame();
|
||||
|
||||
this.arrayToHex = function(a) {
|
||||
return a.map(function(i) {
|
||||
return ('00' + i.toString(16)).slice(-2) + ',';
|
||||
});
|
||||
};
|
||||
|
||||
this.convertToTemp = function(raw) {
|
||||
return ((raw[1] << 8) + (raw[0])) / 100;
|
||||
};
|
||||
|
||||
/*
|
||||
this.$result.temp = $('#' + tslTemp);
|
||||
this.$result.tempMax = $('#' + tslTempMax);
|
||||
this.$result.tempMin = $('#' + tslTempMin);
|
||||
*/
|
||||
|
||||
|
||||
this.onReadTempState = function(d) {
|
||||
var raw = new Uint8Array(d);
|
||||
var temp = this.convertToTemp(raw);
|
||||
console.log('Temp State:', temp);
|
||||
this.$result.temp.text(temp.toFixed(2) + '°C');
|
||||
|
||||
};
|
||||
|
||||
this.onReadTempMax = function(d) {
|
||||
var raw = new Uint8Array(d);
|
||||
var temp = this.convertToTemp(raw);
|
||||
console.log('Temp Max:', temp);
|
||||
this.$result.tempMax.text(temp.toFixed(2) + '°C');
|
||||
};
|
||||
|
||||
this.onReadTempMin = function(d) {
|
||||
var raw = new Uint8Array(d);
|
||||
var temp = this.convertToTemp(raw);
|
||||
console.log('Temp Min:', temp);
|
||||
this.$result.tempMin.text(temp.toFixed(2) + '°C');
|
||||
};
|
||||
|
||||
this.readHistory = function() {
|
||||
console.log('readTempState');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.history,
|
||||
this.onReadTempState.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.readTempState = function() {
|
||||
console.log('readTempState');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.temp,
|
||||
this.onReadTempState.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.readTempMax = function() {
|
||||
console.log('readTempMax');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.tempMaximum,
|
||||
this.onReadTempMax.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.readTempMin = function() {
|
||||
console.log('readTempMax');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.tempMinimum,
|
||||
this.onReadTempMin.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.startService = function() {
|
||||
|
||||
if (this.deviceID !== null) {
|
||||
|
||||
console.log('Starting TSL Service on ', this.deviceID);
|
||||
console.log(this.serviceDef);
|
||||
this.insertFrame();
|
||||
|
||||
|
||||
this.readTempState();
|
||||
this.readTempMax();
|
||||
this.readTempMin();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.onTslData = function(data) {
|
||||
|
||||
var raw = new Uint16Array(data);
|
||||
|
||||
console.log(raw);
|
||||
|
||||
};
|
||||
|
||||
this.animateGraph = function() {
|
||||
return -1;
|
||||
};
|
||||
|
||||
this.insertFrame = function() {
|
||||
|
||||
var self = this;
|
||||
|
||||
// Call the parent displayForm first...
|
||||
this.superClass_.insertFrame.call(self);
|
||||
|
||||
var tslTemp = this.frameID + '-t';
|
||||
var tslTempMax = this.frameID + '-tmax';
|
||||
var tslTempMin = this.frameID + '-tmin';
|
||||
|
||||
var row = $('<div />', {class: 'mui-row'});
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(
|
||||
row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-9 mui--text-dark', id: tslTemp}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
row = $('<div />', {class: 'mui-row'});
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'TMax:'}).appendTo(
|
||||
row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: tslTempMax}).appendTo(row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'TMin:'}).appendTo(
|
||||
row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: tslTempMin}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
this.$result.temp = $('#' + tslTemp);
|
||||
this.$result.tempMax = $('#' + tslTempMax);
|
||||
this.$result.tempMin = $('#' + tslTempMin);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inheritsFrom(TSL, CAPABILITY);
|
||||
capabilityManager.register({id: 'F000BB00-0451-4000-B000-A01D48F70D07', module: TSL});
|
61
sensortoy/sensortoy/app/js/standards/deviceInformation.js
Normal file
61
sensortoy/sensortoy/app/js/standards/deviceInformation.js
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-05-20
|
||||
* Time: 10:13
|
||||
*
|
||||
*/
|
||||
/* global CAPABILITY, inheritsFrom, capabilityManager */
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var DEVICEINFO = function() {
|
||||
this.name = 'Device Information';
|
||||
this.capabilityID = '180A';
|
||||
this.serviceDef = {
|
||||
service: '180A', manufacturer_name_string: '2A29', model_number_string: '2A24'
|
||||
};
|
||||
|
||||
this.onBatteryLevelChange = function(data) {
|
||||
console.log(data);
|
||||
var a = new Uint8Array(data);
|
||||
this.state = a[0];
|
||||
console.log('onBatteryLevelChange', this.state);
|
||||
};
|
||||
this.readBatteryState = function() {
|
||||
console.log('readBatteryState');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.level,
|
||||
this.onReadBatteryLevel.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.onReadBatteryLevel = function(data) {
|
||||
console.log(data);
|
||||
var a = new Uint8Array(data);
|
||||
this.state = a[0];
|
||||
console.log('onReadBatteryLevel', this.state);
|
||||
};
|
||||
|
||||
this.startService = function() {
|
||||
'use strict';
|
||||
if (this.deviceID !== null) {
|
||||
console.log('Starting Battery Service on ', this.deviceID);
|
||||
console.log(this.serviceDef);
|
||||
|
||||
this.insertFrame();
|
||||
|
||||
ble.startNotification(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.level,
|
||||
this.onBatteryLevelChange.bind(this),
|
||||
this.onError);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inheritsFrom(BATTERY, CAPABILITY);
|
||||
capabilityManager.register({id: '180F', module: BATTERY});
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -118,6 +118,10 @@
|
||||
src="js/device/CC2650/cc2650_humidity.js"></script>
|
||||
<!-- endbuild -->
|
||||
|
||||
<script type="text/javascript"
|
||||
src="js/device/fmc/TSL.js"></script>
|
||||
|
||||
|
||||
<!-- build:js -->
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
<!-- endbuild -->
|
||||
|
@ -338,7 +338,7 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
elm.append($('<div />', { class: 'mui-col-xs-8 mui--text-title mui-ellipsis-2', text: title}));
|
||||
|
||||
elm.append($('<div />', {class: 'mui-col-xs-4 mui--text-right'}).append(button));
|
||||
// elm.append($('<div />', {class: 'mui-col-xs-4 mui--text-right'}).append(button));
|
||||
|
||||
frame.append(elm);
|
||||
|
||||
|
@ -0,0 +1,205 @@
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-05-20
|
||||
* Time: 10:13
|
||||
*
|
||||
*/
|
||||
/* global CAPABILITY, inheritsFrom, capabilityManager */
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var TSL = function(p) {
|
||||
'use strict';
|
||||
this.name = 'TSL';
|
||||
this.deviceID = p.deviceID || null;
|
||||
this.target = p.target || null;
|
||||
|
||||
// F000BB00-0451-4000-B000-A01D48F70D07
|
||||
|
||||
this.capabilityID = 'F000BB00-0451-4000-B000-A01D48F70D07';
|
||||
this.serviceDef = {
|
||||
service: 'F000BB00-0451-4000-B000-A01D48F70D07',
|
||||
enable: 'F000BB01-0451-4000-B000-A01D48F70D07',
|
||||
control: 'F000BB02-0451-4000-B000-A01D48F70D07',
|
||||
period: 'F000BB03-0451-4000-B000-A01D48F70D07',
|
||||
location: 'F000BB04-0451-4000-B000-A01D48F70D07',
|
||||
historySize: 'F000BB05-0451-4000-B000-A01D48F70D07',
|
||||
history: 'F000BB06-0451-4000-B000-A01D48F70D07',
|
||||
historyAck: 'F000BB07-0451-4000-B000-A01D48F70D07',
|
||||
temp: 'F000BB08-0451-4000-B000-A01D48F70D07',
|
||||
tempMaximum: 'F000BB09-0451-4000-B000-A01D48F70D07',
|
||||
tempMinimum: 'F000BB0A-0451-4000-B000-A01D48F70D07',
|
||||
preValue: 'F000BB0B-0451-4000-B000-A01D48F70D07',
|
||||
presMaximum: 'F000BB0C-0451-4000-B000-A01D48F70D07',
|
||||
presMinimum: 'F000BB0D-0451-4000-B000-A01D48F70D07',
|
||||
humidityValue: 'F000BB0E-0451-4000-B000-A01D48F70D07',
|
||||
humidityMax: 'F000BB0F-0451-4000-B000-A01D48F70D07',
|
||||
humidityMin: 'F000BB10-0451-4000-B000-A01D48F70D07',
|
||||
accelerationMax: 'F000BB11-0451-4000-B000-A01D48F70D07',
|
||||
velocityMax: 'F000BB12-0451-4000-B000-A01D48F70D07',
|
||||
loggerId: 'F000BB13-0451-4000-B000-A01D48F70D07',
|
||||
shockBandwidth: 'F000BB14-0451-4000-B000-A01D48F70D07',
|
||||
shockThreshold: 'F000BB15-0451-4000-B000-A01D48F70D07',
|
||||
config: 'F0002902-0451-4000-B000-A01D48F70D07'
|
||||
|
||||
};
|
||||
|
||||
this.$result = {temp: null, tempMax: null, tempMin: null};
|
||||
this.data = [];
|
||||
this.setFrame();
|
||||
|
||||
this.arrayToHex = function(a) {
|
||||
return a.map(function(i) {
|
||||
return ('00' + i.toString(16)).slice(-2) + ',';
|
||||
});
|
||||
};
|
||||
|
||||
this.convertToTemp = function(raw) {
|
||||
return ((raw[1] << 8) + (raw[0])) / 100;
|
||||
};
|
||||
|
||||
/*
|
||||
this.$result.temp = $('#' + tslTemp);
|
||||
this.$result.tempMax = $('#' + tslTempMax);
|
||||
this.$result.tempMin = $('#' + tslTempMin);
|
||||
*/
|
||||
|
||||
|
||||
this.onReadTempState = function(d) {
|
||||
var raw = new Uint8Array(d);
|
||||
var temp = this.convertToTemp(raw);
|
||||
console.log('Temp State:', temp);
|
||||
this.$result.temp.text(temp.toFixed(2) + '°C');
|
||||
|
||||
};
|
||||
|
||||
this.onReadTempMax = function(d) {
|
||||
var raw = new Uint8Array(d);
|
||||
var temp = this.convertToTemp(raw);
|
||||
console.log('Temp Max:', temp);
|
||||
this.$result.tempMax.text(temp.toFixed(2) + '°C');
|
||||
};
|
||||
|
||||
this.onReadTempMin = function(d) {
|
||||
var raw = new Uint8Array(d);
|
||||
var temp = this.convertToTemp(raw);
|
||||
console.log('Temp Min:', temp);
|
||||
this.$result.tempMin.text(temp.toFixed(2) + '°C');
|
||||
};
|
||||
|
||||
this.readHistory = function() {
|
||||
console.log('readTempState');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.history,
|
||||
this.onReadTempState.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.readTempState = function() {
|
||||
console.log('readTempState');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.temp,
|
||||
this.onReadTempState.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.readTempMax = function() {
|
||||
console.log('readTempMax');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.tempMaximum,
|
||||
this.onReadTempMax.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.readTempMin = function() {
|
||||
console.log('readTempMax');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.tempMinimum,
|
||||
this.onReadTempMin.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.startService = function() {
|
||||
|
||||
if (this.deviceID !== null) {
|
||||
|
||||
console.log('Starting TSL Service on ', this.deviceID);
|
||||
console.log(this.serviceDef);
|
||||
this.insertFrame();
|
||||
|
||||
|
||||
this.readTempState();
|
||||
this.readTempMax();
|
||||
this.readTempMin();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.onTslData = function(data) {
|
||||
|
||||
var raw = new Uint16Array(data);
|
||||
|
||||
console.log(raw);
|
||||
|
||||
};
|
||||
|
||||
this.animateGraph = function() {
|
||||
return -1;
|
||||
};
|
||||
|
||||
this.insertFrame = function() {
|
||||
|
||||
var self = this;
|
||||
|
||||
// Call the parent displayForm first...
|
||||
this.superClass_.insertFrame.call(self);
|
||||
|
||||
var tslTemp = this.frameID + '-t';
|
||||
var tslTempMax = this.frameID + '-tmax';
|
||||
var tslTempMin = this.frameID + '-tmin';
|
||||
|
||||
var row = $('<div />', {class: 'mui-row'});
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(
|
||||
row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-9 mui--text-dark', id: tslTemp}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
row = $('<div />', {class: 'mui-row'});
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'TMax:'}).appendTo(
|
||||
row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: tslTempMax}).appendTo(row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'TMin:'}).appendTo(
|
||||
row);
|
||||
|
||||
$('<div />',
|
||||
{class: 'mui-col-xs-3 mui--text-dark', id: tslTempMin}).appendTo(row);
|
||||
|
||||
this.$id.append(row);
|
||||
|
||||
this.$result.temp = $('#' + tslTemp);
|
||||
this.$result.tempMax = $('#' + tslTempMax);
|
||||
this.$result.tempMin = $('#' + tslTempMin);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inheritsFrom(TSL, CAPABILITY);
|
||||
capabilityManager.register({id: 'F000BB00-0451-4000-B000-A01D48F70D07', module: TSL});
|
@ -0,0 +1,61 @@
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-05-20
|
||||
* Time: 10:13
|
||||
*
|
||||
*/
|
||||
/* global CAPABILITY, inheritsFrom, capabilityManager */
|
||||
/* global ble */
|
||||
/* jshint browser: true , devel: true*/
|
||||
|
||||
var DEVICEINFO = function() {
|
||||
this.name = 'Device Information';
|
||||
this.capabilityID = '180A';
|
||||
this.serviceDef = {
|
||||
service: '180A', manufacturer_name_string: '2A29', model_number_string: '2A24'
|
||||
};
|
||||
|
||||
this.onBatteryLevelChange = function(data) {
|
||||
console.log(data);
|
||||
var a = new Uint8Array(data);
|
||||
this.state = a[0];
|
||||
console.log('onBatteryLevelChange', this.state);
|
||||
};
|
||||
this.readBatteryState = function() {
|
||||
console.log('readBatteryState');
|
||||
ble.read(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.level,
|
||||
this.onReadBatteryLevel.bind(this),
|
||||
this.onError);
|
||||
};
|
||||
|
||||
this.onReadBatteryLevel = function(data) {
|
||||
console.log(data);
|
||||
var a = new Uint8Array(data);
|
||||
this.state = a[0];
|
||||
console.log('onReadBatteryLevel', this.state);
|
||||
};
|
||||
|
||||
this.startService = function() {
|
||||
'use strict';
|
||||
if (this.deviceID !== null) {
|
||||
console.log('Starting Battery Service on ', this.deviceID);
|
||||
console.log(this.serviceDef);
|
||||
|
||||
this.insertFrame();
|
||||
|
||||
ble.startNotification(this.deviceID,
|
||||
this.serviceDef.service,
|
||||
this.serviceDef.level,
|
||||
this.onBatteryLevelChange.bind(this),
|
||||
this.onError);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inheritsFrom(BATTERY, CAPABILITY);
|
||||
capabilityManager.register({id: '180F', module: BATTERY});
|
@ -20,8 +20,7 @@ var SOController = (function() {
|
||||
var iosConfig = {
|
||||
badge: true, sound: true, alert: true
|
||||
};
|
||||
|
||||
|
||||
|
||||
var calendarData;
|
||||
var extendTimer;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user