/** * Created by martin on 2016-05-20. */ var DEVICEBASE = function(p) { this.controller = p.controller || null; this.settings = p.settings || {}; this.data = {}; this.standards = { button: { service: 'FFE0', data: 'FFE1' // Bit 2: side key, Bit 1- right key, Bit 0 –left key }, heartRate: { service: '180d', measurement: '2a37' } }; this.custom = {}; this.capabilities = []; this.deviceID = null; this.inherits = function(a, b) { var c = function() {}; c.prototype = b.prototype; a.superClass_ = b.prototype; a.prototype = new c; a.prototype.constructor = a; }; this.register = function(c) { c.registerPage(this); }; this.bytesToString = function(buffer) { return String.fromCharCode.apply(null, new Uint8Array(buffer)); }; // ASCII only this.stringToBytes = function(string) { var array = new Uint8Array(string.length); for (var i = 0, l = string.length; i < l; i++) { array[i] = string.charCodeAt(i); } return array.buffer; }; this.register(this.controller); };