microbit-web-bluetooth
Advanced tools
Comparing version 0.2.1-next.ca1cdfd.0 to 0.3.0
@@ -1,2 +0,2 @@ | ||
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};function t(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function r(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){e.done?i(e.value):new r(function(t){t(e.value)}).then(o,s)}u((n=n.apply(e,t||[])).next())})}function n(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var i,a=function(){function e(e,t){this.service=e,this.emitter=t}return e.prototype.getCharacteristic=function(e){return r(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.service.getCharacteristic(e)];case 1:return[2,t.sent()];case 2:return t.sent(),[2,void 0];case 3:return[2]}})})},e.prototype.getCharacteristicValue=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,this.getCharacteristic(e)];case 1:if(!(t=r.sent()))throw new Error("Unable to locate characteristic");return[4,t.readValue()];case 2:return[2,r.sent()]}})})},e.prototype.setCharacteristicValue=function(e,t){return r(this,void 0,void 0,function(){var r;return n(this,function(n){switch(n.label){case 0:return[4,this.getCharacteristic(e)];case 1:if(!(r=n.sent()))throw new Error("Unable to locate characteristic");return[2,r.writeValue(t)]}})})},e.prototype.handleListener=function(e,t,i){return r(this,void 0,void 0,function(){var r,a=this;return n(this,function(n){switch(n.label){case 0:return[4,this.getCharacteristic(t)];case 1:return(r=n.sent())?[4,r.startNotifications()]:[2];case 2:return n.sent(),this.emitter.on("newListener",function(t){t!==e||a.emitter.listenerCount(e)>0||r.addEventListener("characteristicvaluechanged",i)}),this.emitter.on("removeListener",function(t){t!==e||a.emitter.listenerCount(e)>0||r.removeEventListener("characteristicvaluechanged",i)}),[2]}})})},e}();!function(e){e.modelNumber="00002a24-0000-1000-8000-00805f9b34fb",e.serialNumber="00002a25-0000-1000-8000-00805f9b34fb",e.firmwareRevision="00002a26-0000-1000-8000-00805f9b34fb",e.hardwareRevision="00002a27-0000-1000-8000-00805f9b34fb",e.manufacturer="00002a29-0000-1000-8000-00805f9b34fb"}(i||(i={}));var o=function(){function e(e){this.helper=new a(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return n(this,function(r){return[2,new e(t)]})})},e.prototype.readDeviceInformation=function(){return r(this,void 0,void 0,function(){var e,t,r,a,o,s;return n(this,function(n){switch(n.label){case 0:return e={},[4,this.readStringCharacteristic(i.modelNumber)];case 1:return(t=n.sent())&&(e.modelNumber=t),[4,this.readStringCharacteristic(i.serialNumber)];case 2:return(r=n.sent())&&(e.serialNumber=r),[4,this.readStringCharacteristic(i.firmwareRevision)];case 3:return(a=n.sent())&&(e.firmwareRevision=a),[4,this.readStringCharacteristic(i.hardwareRevision)];case 4:return(o=n.sent())&&(e.hardwareRevision=o),[4,this.readStringCharacteristic(i.manufacturer)];case 5:return(s=n.sent())&&(e.manufacturer=s),[2,e]}})})},e.prototype.readStringCharacteristic=function(e){return r(this,void 0,void 0,function(){var t,r;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.helper.getCharacteristicValue(e)];case 1:return t=n.sent(),r=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),[2,String.fromCharCode.apply(null,Array.from(new Uint8Array(r)))];case 2:return n.sent(),[2,void 0];case 3:return[2]}})})},e.uuid="0000180a-0000-1000-8000-00805f9b34fb",e}();function s(){}function u(){u.init.call(this)}function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,a,o,u;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]):(a=e._events=new s,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(i=c(e))&&i>0&&o.length>i){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=o.length,u=h,"function"==typeof console.warn?console.warn(u):console.log(u)}}else o=a[t]=r,++e._eventsCount;return e}function f(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function l(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function d(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}s.prototype=Object.create(null),u.EventEmitter=u,u.usingDomains=!1,u.prototype.domain=void 0,u.prototype._events=void 0,u.prototype._maxListeners=void 0,u.defaultMaxListeners=10,u.init=function(){this.domain=null,u.usingDomains&&(void 0).active&&(void 0).Domain,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new s,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(e){var t,r,n,i,a,o,s,u="error"===e;if(o=this._events)u=u&&null==o.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=o[e]))return!1;var h="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=d(e,n),a=0;a<n;++a)i[a].call(r)}(r,h,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,a=d(e,i),o=0;o<i;++o)a[o].call(r,n)}(r,h,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var a=e.length,o=d(e,a),s=0;s<a;++s)o[s].call(r,n,i)}(r,h,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,a){if(t)e.call(r,n,i,a);else for(var o=e.length,s=d(e,o),u=0;u<o;++u)s[u].call(r,n,i,a)}(r,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),a=1;a<n;a++)i[a-1]=arguments[a];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,a=d(e,i),o=0;o<i;++o)a[o].apply(r,n)}(r,h,this,i)}return!0},u.prototype.addListener=function(e,t){return h(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return h(this,e,t,!0)},u.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,f(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,f(this,e,t)),this},u.prototype.removeListener=function(e,t){var r,n,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new s:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new s,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,o||t)}return this},u.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new s,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new s:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),a=0;a<i.length;++a)"removeListener"!==(n=i[a])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new s,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},u.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):l.call(e,t)},u.prototype.listenerCount=l,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var v,p,m=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.isEventListenerObject=function(e){return void 0!==e.handleEvent},t}return t(r,e),r.prototype.addEventListener=function(t,r){if(r){var n=this.isEventListenerObject(r)?r.handleEvent:r;e.prototype.addListener.call(this,t,n)}},r.prototype.removeEventListener=function(t,r){if(r){var n=this.isEventListenerObject(r)?r.handleEvent:r;e.prototype.removeListener.call(this,t,n)}},r.prototype.dispatchEvent=function(t,r){var n;return n="string"==typeof t?new CustomEvent(t,{detail:r}):t,e.prototype.emit.call(this,n.type,n)},r}(u);!function(e){e.buttonAState="e95dda90-251d-470a-a062-fa1922dfa9a8",e.buttonBState="e95dda91-251d-470a-a062-fa1922dfa9a8"}(v||(v={})),function(e){e[e.Release=0]="Release",e[e.ShortPress=1]="ShortPress",e[e.LongPress=2]="LongPress"}(p||(p={}));var g,y=function(e){function i(t){var r=e.call(this)||this;return r.helper=new a(t,r),r}return t(i,e),i.create=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,(t=new i(e)).init()];case 1:return r.sent(),[2,t]}})})},i.prototype.init=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("buttonastatechanged",v.buttonAState,this.buttonAStateChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("buttonbstatechanged",v.buttonBState,this.buttonBStateChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.readButtonAState=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(v.buttonAState)];case 1:return[2,e.sent().getUint8(0)]}})})},i.prototype.readButtonBState=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(v.buttonBState)];case 1:return[2,e.sent().getUint8(0)]}})})},i.prototype.buttonAStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonastatechanged",t.getUint8(0))},i.prototype.buttonBStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonbstatechanged",t.getUint8(0))},i.uuid="e95d9882-251d-470a-a062-fa1922dfa9a8",i}(m);!function(e){e.ledMatrixState="e95d7b77-251d-470a-a062-fa1922dfa9a8",e.ledText="e95d93ee-251d-470a-a062-fa1922dfa9a8",e.scrollingDelay="e95d0d2d-251d-470a-a062-fa1922dfa9a8"}(g||(g={}));var b,w=function(){function e(e){this.helper=new a(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return n(this,function(r){return[2,new e(t)]})})},e.prototype.writeText=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){return t=this.encodeString(e),[2,this.helper.setCharacteristicValue(g.ledText,t)]})})},e.prototype.getMatrixState=function(){return r(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(g.ledMatrixState)];case 1:return e=t.sent(),[2,this.viewToLedMatrix(e)]}})})},e.prototype.setMatrixState=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){return t=this.ledMatrixToView(e),[2,this.helper.setCharacteristicValue(g.ledMatrixState,t)]})})},e.prototype.getScrollingDelay=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(g.scrollingDelay)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},e.prototype.setScrollingDelay=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(g.scrollingDelay,t)]})})},e.prototype.encodeString=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return t},e.prototype.viewToLedMatrix=function(e){for(var t=[],r=0;r<5;r++)t[r]=this.byteToBoolArray(e.getUint8(r));return t},e.prototype.byteToBoolArray=function(e){for(var t=[!1,!1,!1,!1,!1],r=0;r<t.length;r++)t[r]=1==(1&e),e>>=1;return t.reverse()},e.prototype.ledMatrixToView=function(e){for(var t=new DataView(new ArrayBuffer(5)),r=0;r<5;r++)t.setUint8(r,this.boolArrayToByte(e[r]));return t},e.prototype.boolArrayToByte=function(e){return e.reduce(function(e,t){return e<<1|(t?1:0)},0)},e.uuid="e95dd91d-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.temperature="e95d9250-251d-470a-a062-fa1922dfa9a8",e.temperaturePeriod="e95d1b25-251d-470a-a062-fa1922dfa9a8"}(b||(b={}));var C,L=function(e){function i(t){var r=e.call(this)||this;return r.helper=new a(t,r),r}return t(i,e),i.create=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,(t=new i(e)).init()];case 1:return r.sent(),[2,t]}})})},i.prototype.init=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("temperaturechanged",b.temperature,this.temperatureChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},i.prototype.readTemperature=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(b.temperature)];case 1:return[2,e.sent().getInt8(0)]}})})},i.prototype.getTemperaturePeriod=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(b.temperaturePeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setTemperaturePeriod=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[4,this.helper.setCharacteristicValue(b.temperaturePeriod,t)];case 1:return[2,r.sent()]}})})},i.prototype.temperatureChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("temperaturechanged",t.getInt8(0))},i.uuid="e95d6100-251d-470a-a062-fa1922dfa9a8",i}(m);!function(e){e.accelerometerData="e95dca4b-251d-470a-a062-fa1922dfa9a8",e.accelerometerPeriod="e95dfb24-251d-470a-a062-fa1922dfa9a8"}(C||(C={}));var S,E,V=function(e){function i(t){var r=e.call(this)||this;return r.helper=new a(t,r),r}return t(i,e),i.create=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,(t=new i(e)).init()];case 1:return r.sent(),[2,t]}})})},i.prototype.init=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("accelerometerdatachanged",C.accelerometerData,this.accelerometerDataChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},i.prototype.readAccelerometerData=function(){return r(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(C.accelerometerData)];case 1:return e=t.sent(),[2,this.dataViewToAccelerometerData(e)]}})})},i.prototype.getAccelerometerPeriod=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(C.accelerometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setAccelerometerPeriod=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(C.accelerometerPeriod,t)]})})},i.prototype.accelerometerDataChangedHandler=function(e){var t=e.target.value,r=this.dataViewToAccelerometerData(t);this.dispatchEvent("accelerometerdatachanged",r)},i.prototype.dataViewToAccelerometerData=function(e){return{x:e.getInt16(0,!0)/1e3,y:e.getInt16(2,!0)/1e3,z:e.getInt16(4,!0)/1e3}},i.uuid="e95d0753-251d-470a-a062-fa1922dfa9a8",i}(m);!function(e){e.magnetometerData="e95dfb11-251d-470a-a062-fa1922dfa9a8",e.magnetometerPeriod="e95d386c-251d-470a-a062-fa1922dfa9a8",e.magnetometerBearing="e95d9715-251d-470a-a062-fa1922dfa9a8",e.magnetometerCalibration="e95db358-251d-470a-a062-fa1922dfa9a8"}(S||(S={})),function(e){e[e.unknown=0]="unknown",e[e.requested=1]="requested",e[e.completed=2]="completed",e[e.errored=3]="errored"}(E||(E={}));var A,_=function(e){function i(t){var r=e.call(this)||this;return r.helper=new a(t,r),r}return t(i,e),i.create=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,(t=new i(e)).init()];case 1:return r.sent(),[2,t]}})})},i.prototype.init=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("magnetometerdatachanged",S.magnetometerData,this.magnetometerDataChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("magnetometerbearingchanged",S.magnetometerBearing,this.magnetometerBearingChangedHandler.bind(this))];case 2:return e.sent(),[4,this.helper.handleListener("magnetometercalibrationchanged",S.magnetometerCalibration,this.magnetometerCalibrationChangedHandler.bind(this))];case 3:return e.sent(),[2]}})})},i.prototype.calibrate=function(){return r(this,void 0,void 0,function(){return n(this,function(e){return[2,this.helper.setCharacteristicValue(S.magnetometerCalibration,new Uint8Array([1]))]})})},i.prototype.readMagnetometerData=function(){return r(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(S.magnetometerData)];case 1:return e=t.sent(),[2,this.dataViewToMagnetometerData(e)]}})})},i.prototype.getMagnetometerBearing=function(){return r(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(S.magnetometerBearing)];case 1:return 2===(e=t.sent()).byteLength?[2,e.getUint16(0,!0)]:[2,void 0]}})})},i.prototype.getMagnetometerPeriod=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(S.magnetometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setMagnetometerPeriod=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(S.magnetometerPeriod,t)]})})},i.prototype.magnetometerDataChangedHandler=function(e){var t=e.target.value,r=this.dataViewToMagnetometerData(t);this.dispatchEvent("magnetometerdatachanged",r)},i.prototype.magnetometerBearingChangedHandler=function(e){var t=e.target.value;2===t.byteLength&&this.dispatchEvent("magnetometerbearingchanged",t.getUint16(0,!0))},i.prototype.magnetometerCalibrationChangedHandler=function(e){var t=e.target.value;1===t.byteLength&&this.dispatchEvent("magnetometercalibrationchanged",t.getUint8(0))},i.prototype.dataViewToMagnetometerData=function(e){return{x:e.getInt16(0,!0),y:e.getInt16(1,!0),z:e.getInt16(2,!0)}},i.uuid="e95df2d8-251d-470a-a062-fa1922dfa9a8",i}(m);!function(e){e.pinData="e95d8d00-251d-470a-a062-fa1922dfa9a8",e.pinAdConfiguration="e95d5899-251d-470a-a062-fa1922dfa9a8",e.pinIoConfiguration="e95db9fe-251d-470a-a062-fa1922dfa9a8",e.pwmControl="e95dd822-251d-470a-a062-fa1922dfa9a8"}(A||(A={}));var x,D=function(){function e(e){this.helper=new a(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return n(this,function(r){return[2,new e(t)]})})},e.uuid="e95d127b-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.tx="6e400002-b5a3-f393-e0a9-e50e24dcca9e",e.rx="6e400003-b5a3-f393-e0a9-e50e24dcca9e"}(x||(x={}));var B,U=function(e){function i(t){var r=e.call(this)||this;return r.helper=new a(t,r),r}return t(i,e),i.create=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,(t=new i(e)).init()];case 1:return r.sent(),[2,t]}})})},i.prototype.init=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("receive",x.tx,this.receiveHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("receiveString",x.tx,this.receiveStringHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.send=function(e){return r(this,void 0,void 0,function(){return n(this,function(t){return[2,this.helper.setCharacteristicValue(x.rx,e)]})})},i.prototype.sendString=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){return t=e.split("").map(function(e){return e.charCodeAt(0)}),[2,this.helper.setCharacteristicValue(x.rx,new Uint8Array(t).buffer)]})})},i.prototype.receiveHandler=function(e){var t=e.target.value,r=new Uint8Array(t.buffer);this.dispatchEvent("receive",r)},i.prototype.receiveStringHandler=function(e){var t=e.target.value,r=Array.prototype.slice.call(new Uint8Array(t.buffer)),n=String.fromCharCode.apply(null,r);this.dispatchEvent("receiveString",n)},i.uuid="6e400001-b5a3-f393-e0a9-e50e24dcca9e",i}(m);!function(e){e.microBitRequirements="e95db84c-251d-470a-a062-fa1922dfa9a8",e.microBitEvent="e95d9775-251d-470a-a062-fa1922dfa9a8",e.clientRequirements="e95d23c4-251d-470a-a062-fa1922dfa9a8",e.clientEvent="e95d5404-251d-470a-a062-fa1922dfa9a8"}(B||(B={}));var T,M=function(e){function i(t){var r=e.call(this)||this;return r.helper=new a(t,r),r}return t(i,e),i.create=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,(t=new i(e)).init()];case 1:return r.sent(),[2,t]}})})},i.prototype.init=function(){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("microbitevent",B.microBitEvent,this.eventHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("microbitrequirementschanged",B.microBitRequirements,this.microbitRequirementsChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.getMicrobitRequirements=function(){return r(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(B.microBitRequirements)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},i.prototype.setClientRequirements=function(e,t){return r(this,void 0,void 0,function(){var r;return n(this,function(n){switch(n.label){case 0:return(r=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),r.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(B.clientRequirements,r)];case 1:return[2,n.sent()]}})})},i.prototype.readMicrobitEvent=function(){return r(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(B.microBitEvent)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},i.prototype.writeClientEvent=function(e,t){return r(this,void 0,void 0,function(){var r;return n(this,function(n){switch(n.label){case 0:return(r=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),r.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(B.clientEvent,r)];case 1:return[2,n.sent()]}})})},i.prototype.microbitRequirementsChangedHandler=function(e){var t=e.target.value,r=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitrequirementschanged",r)},i.prototype.eventHandler=function(e){var t=e.target.value,r=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitevent",r)},i.prototype.viewToMicrobitEvent=function(e){return{type:e.getUint16(0,!0),value:e.getUint16(1,!0)}},i.uuid="e95d93af-251d-470a-a062-fa1922dfa9a8",i}(m);!function(e){e.dfuControl="e95d93b1-251d-470a-a062-fa1922dfa9a8"}(T||(T={}));var P=function(){function e(e){this.helper=new a(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return n(this,function(r){return[2,new e(t)]})})},e.uuid="e95d93b0-251d-470a-a062-fa1922dfa9a8",e}(),H=function(){function e(e){this.services=e}return e.prototype.createService=function(e){return r(this,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return(t=this.services.find(function(t){return t.uuid===e.uuid}))?[4,e.create(t)]:[2,void 0];case 1:return[2,r.sent()]}})})},e}(),R=function(e){return r(void 0,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,e.requestDevice({filters:[{namePrefix:"BBC micro:bit"}],optionalServices:[o.uuid,y.uuid,w.uuid,L.uuid,V.uuid,_.uuid,D.uuid,U.uuid,M.uuid,P.uuid]})];case 1:return[2,t.sent()]}})})},q=function(e){return r(void 0,void 0,void 0,function(){var t,r,i,a,s,u,c,h,f,l;return n(this,function(n){switch(n.label){case 0:return e&&e.gatt?e.gatt.connected?[3,2]:[4,e.gatt.connect()]:[2,{}];case 1:n.sent(),n.label=2;case 2:return[4,e.gatt.getPrimaryServices()];case 3:return t=n.sent(),[4,(r=new H(t)).createService(o)];case 4:return i=n.sent(),[4,r.createService(y)];case 5:return a=n.sent(),[4,r.createService(w)];case 6:return s=n.sent(),[4,r.createService(L)];case 7:return u=n.sent(),[4,r.createService(V)];case 8:return c=n.sent(),[4,r.createService(_)];case 9:return h=n.sent(),[4,r.createService(U)];case 10:return f=n.sent(),[4,r.createService(M)];case 11:return l=n.sent(),[2,{deviceInformationService:i,buttonService:a,ledService:s,temperatureService:u,accelerometerService:c,magnetometerService:h,uartService:f,eventService:l}]}})})};export{q as getServices,R as requestMicrobit}; | ||
var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};function t(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function n(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,u)}s((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var i,a=function(){function e(e){void 0===e&&(e=1),this.concurrent=e,this.queue=[],this.running=0}return e.prototype.pump=function(){return n(this,void 0,void 0,function(){var e,t,n;return r(this,function(r){switch(r.label){case 0:if(this.running>=this.concurrent)return[2];if(!(e=this.queue.shift()))return[2];this.running++,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.fn()];case 2:return t=r.sent(),e.resolve(t),[3,4];case 3:return n=r.sent(),e.reject(n),[3,4];case 4:return this.running--,[2,this.pump()]}})})},e.prototype.add=function(e){var t=this;return new Promise(function(n,r){return t.queue.push({fn:e,resolve:n,reject:r}),t.pump()})},e}(),o=function(){function e(e,t){this.service=e,this.emitter=t}return e.prototype.getCharacteristic=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return this.characteristics?[3,2]:(t=this,[4,this.service.getCharacteristics()]);case 1:t.characteristics=n.sent(),n.label=2;case 2:return[2,this.characteristics.find(function(t){return t.uuid===e})]}})})},e.prototype.getCharacteristicValue=function(t){return n(this,void 0,void 0,function(){var i,a=this;return r(this,function(o){switch(o.label){case 0:return[4,this.getCharacteristic(t)];case 1:if(!(i=o.sent()))throw new Error("Unable to locate characteristic");return[4,e.queue.add(function(){return n(a,void 0,void 0,function(){return r(this,function(e){return[2,i.readValue()]})})})];case 2:return[2,o.sent()]}})})},e.prototype.setCharacteristicValue=function(t,i){return n(this,void 0,void 0,function(){var a,o=this;return r(this,function(u){switch(u.label){case 0:return[4,this.getCharacteristic(t)];case 1:if(!(a=u.sent()))throw new Error("Unable to locate characteristic");return[4,e.queue.add(function(){return n(o,void 0,void 0,function(){return r(this,function(e){return[2,a.writeValue(i)]})})})];case 2:return u.sent(),[2]}})})},e.prototype.handleListener=function(t,i,a){return n(this,void 0,void 0,function(){var o,u=this;return r(this,function(s){switch(s.label){case 0:return[4,this.getCharacteristic(i)];case 1:return(o=s.sent())?[4,e.queue.add(function(){return n(u,void 0,void 0,function(){return r(this,function(e){return[2,o.startNotifications()]})})})]:[2];case 2:return s.sent(),this.emitter.on("newListener",function(i){if(!(i!==t||u.emitter.listenerCount(t)>0))return e.queue.add(function(){return n(u,void 0,void 0,function(){return r(this,function(e){return[2,o.addEventListener("characteristicvaluechanged",a)]})})})}),this.emitter.on("removeListener",function(i){if(!(i!==t||u.emitter.listenerCount(t)>0))return e.queue.add(function(){return n(u,void 0,void 0,function(){return r(this,function(e){return[2,o.removeEventListener("characteristicvaluechanged",a)]})})})}),[2]}})})},e.queue=new a,e}();!function(e){e.modelNumber="00002a24-0000-1000-8000-00805f9b34fb",e.serialNumber="00002a25-0000-1000-8000-00805f9b34fb",e.firmwareRevision="00002a26-0000-1000-8000-00805f9b34fb",e.hardwareRevision="00002a27-0000-1000-8000-00805f9b34fb",e.manufacturer="00002a29-0000-1000-8000-00805f9b34fb"}(i||(i={}));var u=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,new e(t)]})})},e.prototype.readDeviceInformation=function(){return n(this,void 0,void 0,function(){var e,t,n,a,o,u;return r(this,function(r){switch(r.label){case 0:return e={},[4,this.readStringCharacteristic(i.modelNumber)];case 1:return(t=r.sent())&&(e.modelNumber=t),[4,this.readStringCharacteristic(i.serialNumber)];case 2:return(n=r.sent())&&(e.serialNumber=n),[4,this.readStringCharacteristic(i.firmwareRevision)];case 3:return(a=r.sent())&&(e.firmwareRevision=a),[4,this.readStringCharacteristic(i.hardwareRevision)];case 4:return(o=r.sent())&&(e.hardwareRevision=o),[4,this.readStringCharacteristic(i.manufacturer)];case 5:return(u=r.sent())&&(e.manufacturer=u),[2,e]}})})},e.prototype.readStringCharacteristic=function(e){return n(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.helper.getCharacteristicValue(e)];case 1:return t=r.sent(),n=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),[2,String.fromCharCode.apply(null,Array.from(new Uint8Array(n)))];case 2:return r.sent(),[2,void 0];case 3:return[2]}})})},e.uuid="0000180a-0000-1000-8000-00805f9b34fb",e}();function s(){}function c(){c.init.call(this)}function h(e){return void 0===e._maxListeners?c.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,a,o,u;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new s,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=h(e))&&i>0&&o.length>i){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,u=c,"function"==typeof console.warn?console.warn(u):console.log(u)}}else o=a[t]=n,++e._eventsCount;return e}function d(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function l(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function v(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}s.prototype=Object.create(null),c.EventEmitter=c,c.usingDomains=!1,c.prototype.domain=void 0,c.prototype._events=void 0,c.prototype._maxListeners=void 0,c.defaultMaxListeners=10,c.init=function(){this.domain=null,c.usingDomains&&(void 0).active&&(void 0).Domain,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new s,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},c.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},c.prototype.getMaxListeners=function(){return h(this)},c.prototype.emit=function(e){var t,n,r,i,a,o,u,s="error"===e;if(o=this._events)s=s&&null==o.error;else if(!s)return!1;if(u=this.domain,s){if(t=arguments[1],!u){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=u,t.domainThrown=!1,u.emit("error",t),!1}if(!(n=o[e]))return!1;var h="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=v(e,r),a=0;a<r;++a)i[a].call(n)}(n,h,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=v(e,i),o=0;o<i;++o)a[o].call(n,r)}(n,h,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=v(e,a),u=0;u<a;++u)o[u].call(n,r,i)}(n,h,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,u=v(e,o),s=0;s<o;++s)u[s].call(n,r,i,a)}(n,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=v(e,i),o=0;o<i;++o)a[o].apply(n,r)}(n,h,this,i)}return!0},c.prototype.addListener=function(e,t){return f(this,e,t,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(e,t){return f(this,e,t,!0)},c.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,d(this,e,t)),this},c.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,d(this,e,t)),this},c.prototype.removeListener=function(e,t){var n,r,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new s:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new s,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,o||t)}return this},c.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new s,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new s:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),a=0;a<i.length;++a)"removeListener"!==(r=i[a])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new s,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},c.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},c.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):l.call(e,t)},c.prototype.listenerCount=l,c.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var p,m,g=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.isEventListenerObject=function(e){return void 0!==e.handleEvent},t}return t(n,e),n.prototype.addEventListener=function(t,n){if(n){var r=this.isEventListenerObject(n)?n.handleEvent:n;e.prototype.addListener.call(this,t,r)}},n.prototype.removeEventListener=function(t,n){if(n){var r=this.isEventListenerObject(n)?n.handleEvent:n;e.prototype.removeListener.call(this,t,r)}},n.prototype.dispatchEvent=function(t,n){var r;return r="string"==typeof t?new CustomEvent(t,{detail:n}):t,e.prototype.emit.call(this,r.type,r)},n}(c);!function(e){e.buttonAState="e95dda90-251d-470a-a062-fa1922dfa9a8",e.buttonBState="e95dda91-251d-470a-a062-fa1922dfa9a8"}(p||(p={})),function(e){e[e.Release=0]="Release",e[e.ShortPress=1]="ShortPress",e[e.LongPress=2]="LongPress"}(m||(m={}));var y,b=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("buttonastatechanged",p.buttonAState,this.buttonAStateChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("buttonbstatechanged",p.buttonBState,this.buttonBStateChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.readButtonAState=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(p.buttonAState)];case 1:return[2,e.sent().getUint8(0)]}})})},i.prototype.readButtonBState=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(p.buttonBState)];case 1:return[2,e.sent().getUint8(0)]}})})},i.prototype.buttonAStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonastatechanged",t.getUint8(0))},i.prototype.buttonBStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonbstatechanged",t.getUint8(0))},i.uuid="e95d9882-251d-470a-a062-fa1922dfa9a8",i}(g);!function(e){e.ledMatrixState="e95d7b77-251d-470a-a062-fa1922dfa9a8",e.ledText="e95d93ee-251d-470a-a062-fa1922dfa9a8",e.scrollingDelay="e95d0d2d-251d-470a-a062-fa1922dfa9a8"}(y||(y={}));var w,C=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,new e(t)]})})},e.prototype.writeText=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.encodeString(e),[2,this.helper.setCharacteristicValue(y.ledText,t)]})})},e.prototype.readMatrixState=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(y.ledMatrixState)];case 1:return e=t.sent(),[2,this.viewToLedMatrix(e)]}})})},e.prototype.writeMatrixState=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.ledMatrixToView(e),[2,this.helper.setCharacteristicValue(y.ledMatrixState,t)]})})},e.prototype.getScrollingDelay=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(y.scrollingDelay)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},e.prototype.setScrollingDelay=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(y.scrollingDelay,t)]})})},e.prototype.encodeString=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return t},e.prototype.viewToLedMatrix=function(e){for(var t=[],n=0;n<5;n++)t[n]=this.byteToBoolArray(e.getUint8(n));return t},e.prototype.byteToBoolArray=function(e){for(var t=[!1,!1,!1,!1,!1],n=0;n<t.length;n++)t[n]=1==(1&e),e>>=1;return t.reverse()},e.prototype.ledMatrixToView=function(e){for(var t=new DataView(new ArrayBuffer(5)),n=0;n<5;n++)t.setUint8(n,this.boolArrayToByte(e[n]));return t},e.prototype.boolArrayToByte=function(e){return e.reduce(function(e,t){return e<<1|(t?1:0)},0)},e.uuid="e95dd91d-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.temperature="e95d9250-251d-470a-a062-fa1922dfa9a8",e.temperaturePeriod="e95d1b25-251d-470a-a062-fa1922dfa9a8"}(w||(w={}));var L,E=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("temperaturechanged",w.temperature,this.temperatureChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},i.prototype.readTemperature=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(w.temperature)];case 1:return[2,e.sent().getInt8(0)]}})})},i.prototype.getTemperaturePeriod=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(w.temperaturePeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setTemperaturePeriod=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[4,this.helper.setCharacteristicValue(w.temperaturePeriod,t)];case 1:return[2,n.sent()]}})})},i.prototype.temperatureChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("temperaturechanged",t.getInt8(0))},i.uuid="e95d6100-251d-470a-a062-fa1922dfa9a8",i}(g);!function(e){e.accelerometerData="e95dca4b-251d-470a-a062-fa1922dfa9a8",e.accelerometerPeriod="e95dfb24-251d-470a-a062-fa1922dfa9a8"}(L||(L={}));var S,x,V=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("accelerometerdatachanged",L.accelerometerData,this.accelerometerDataChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},i.prototype.readAccelerometerData=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(L.accelerometerData)];case 1:return e=t.sent(),[2,this.dataViewToAccelerometerData(e)]}})})},i.prototype.getAccelerometerPeriod=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(L.accelerometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setAccelerometerPeriod=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(L.accelerometerPeriod,t)]})})},i.prototype.accelerometerDataChangedHandler=function(e){var t=e.target.value,n=this.dataViewToAccelerometerData(t);this.dispatchEvent("accelerometerdatachanged",n)},i.prototype.dataViewToAccelerometerData=function(e){return{x:e.getInt16(0,!0)/1e3,y:e.getInt16(2,!0)/1e3,z:e.getInt16(4,!0)/1e3}},i.uuid="e95d0753-251d-470a-a062-fa1922dfa9a8",i}(g);!function(e){e.magnetometerData="e95dfb11-251d-470a-a062-fa1922dfa9a8",e.magnetometerPeriod="e95d386c-251d-470a-a062-fa1922dfa9a8",e.magnetometerBearing="e95d9715-251d-470a-a062-fa1922dfa9a8",e.magnetometerCalibration="e95db358-251d-470a-a062-fa1922dfa9a8"}(S||(S={})),function(e){e[e.unknown=0]="unknown",e[e.requested=1]="requested",e[e.completed=2]="completed",e[e.errored=3]="errored"}(x||(x={}));var A,_=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("magnetometerdatachanged",S.magnetometerData,this.magnetometerDataChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("magnetometerbearingchanged",S.magnetometerBearing,this.magnetometerBearingChangedHandler.bind(this))];case 2:return e.sent(),[4,this.helper.handleListener("magnetometercalibrationchanged",S.magnetometerCalibration,this.magnetometerCalibrationChangedHandler.bind(this))];case 3:return e.sent(),[2]}})})},i.prototype.calibrate=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.helper.setCharacteristicValue(S.magnetometerCalibration,new Uint8Array([1]))]})})},i.prototype.readMagnetometerData=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(S.magnetometerData)];case 1:return e=t.sent(),[2,this.dataViewToMagnetometerData(e)]}})})},i.prototype.readMagnetometerBearing=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(S.magnetometerBearing)];case 1:return 2===(e=t.sent()).byteLength?[2,e.getUint16(0,!0)]:[2,void 0]}})})},i.prototype.getMagnetometerPeriod=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(S.magnetometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setMagnetometerPeriod=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(S.magnetometerPeriod,t)]})})},i.prototype.magnetometerDataChangedHandler=function(e){var t=e.target.value,n=this.dataViewToMagnetometerData(t);this.dispatchEvent("magnetometerdatachanged",n)},i.prototype.magnetometerBearingChangedHandler=function(e){var t=e.target.value;2===t.byteLength&&this.dispatchEvent("magnetometerbearingchanged",t.getUint16(0,!0))},i.prototype.magnetometerCalibrationChangedHandler=function(e){var t=e.target.value;1===t.byteLength&&this.dispatchEvent("magnetometercalibrationchanged",t.getUint8(0))},i.prototype.dataViewToMagnetometerData=function(e){return{x:e.getInt16(0,!0),y:e.getInt16(1,!0),z:e.getInt16(2,!0)}},i.uuid="e95df2d8-251d-470a-a062-fa1922dfa9a8",i}(g);!function(e){e.pinData="e95d8d00-251d-470a-a062-fa1922dfa9a8",e.pinAdConfiguration="e95d5899-251d-470a-a062-fa1922dfa9a8",e.pinIoConfiguration="e95db9fe-251d-470a-a062-fa1922dfa9a8",e.pwmControl="e95dd822-251d-470a-a062-fa1922dfa9a8"}(A||(A={}));var T,D=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,new e(t)]})})},e.uuid="e95d127b-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.tx="6e400002-b5a3-f393-e0a9-e50e24dcca9e",e.rx="6e400003-b5a3-f393-e0a9-e50e24dcca9e"}(T||(T={}));var B,U=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("receive",T.tx,this.receiveHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("receiveText",T.tx,this.receiveTextHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.send=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.helper.setCharacteristicValue(T.rx,e)]})})},i.prototype.sendText=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=e.split("").map(function(e){return e.charCodeAt(0)}),[2,this.helper.setCharacteristicValue(T.rx,new Uint8Array(t).buffer)]})})},i.prototype.receiveHandler=function(e){var t=e.target.value,n=new Uint8Array(t.buffer);this.dispatchEvent("receive",n)},i.prototype.receiveTextHandler=function(e){var t=e.target.value,n=Array.prototype.slice.call(new Uint8Array(t.buffer)),r=String.fromCharCode.apply(null,n);this.dispatchEvent("receiveText",r)},i.uuid="6e400001-b5a3-f393-e0a9-e50e24dcca9e",i}(g);!function(e){e.microBitRequirements="e95db84c-251d-470a-a062-fa1922dfa9a8",e.microBitEvent="e95d9775-251d-470a-a062-fa1922dfa9a8",e.clientRequirements="e95d23c4-251d-470a-a062-fa1922dfa9a8",e.clientEvent="e95d5404-251d-470a-a062-fa1922dfa9a8"}(B||(B={}));var M,P=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("microbitevent",B.microBitEvent,this.eventHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("microbitrequirementschanged",B.microBitRequirements,this.microbitRequirementsChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.getMicrobitRequirements=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(B.microBitRequirements)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},i.prototype.setClientRequirements=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return(n=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),n.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(B.clientRequirements,n)];case 1:return[2,r.sent()]}})})},i.prototype.readMicrobitEvent=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(B.microBitEvent)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},i.prototype.writeClientEvent=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return(n=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),n.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(B.clientEvent,n)];case 1:return[2,r.sent()]}})})},i.prototype.microbitRequirementsChangedHandler=function(e){var t=e.target.value,n=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitrequirementschanged",n)},i.prototype.eventHandler=function(e){var t=e.target.value,n=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitevent",n)},i.prototype.viewToMicrobitEvent=function(e){return{type:e.getUint16(0,!0),value:e.getUint16(1,!0)}},i.uuid="e95d93af-251d-470a-a062-fa1922dfa9a8",i}(g);!function(e){e.dfuControl="e95d93b1-251d-470a-a062-fa1922dfa9a8"}(M||(M={}));var q=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,new e(t)]})})},e.uuid="e95d93b0-251d-470a-a062-fa1922dfa9a8",e}(),H=function(){function e(e){this.services=e}return e.prototype.createService=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return(t=this.services.find(function(t){return t.uuid===e.uuid}))?[4,e.create(t)]:[2,void 0];case 1:return[2,n.sent()]}})})},e}(),R=function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,e.requestDevice({filters:[{namePrefix:"BBC micro:bit"}],optionalServices:[u.uuid,b.uuid,C.uuid,E.uuid,V.uuid,_.uuid,D.uuid,U.uuid,P.uuid,q.uuid]})];case 1:return[2,t.sent()]}})})},O=function(e){return n(void 0,void 0,void 0,function(){var t,n,i,a,o,s,c,h,f,d;return r(this,function(r){switch(r.label){case 0:return e&&e.gatt?e.gatt.connected?[3,2]:[4,e.gatt.connect()]:[2,{}];case 1:r.sent(),r.label=2;case 2:return[4,e.gatt.getPrimaryServices()];case 3:return t=r.sent(),[4,(n=new H(t)).createService(u)];case 4:return i=r.sent(),[4,n.createService(b)];case 5:return a=r.sent(),[4,n.createService(C)];case 6:return o=r.sent(),[4,n.createService(E)];case 7:return s=r.sent(),[4,n.createService(V)];case 8:return c=r.sent(),[4,n.createService(_)];case 9:return h=r.sent(),[4,n.createService(U)];case 10:return f=r.sent(),[4,n.createService(P)];case 11:return d=r.sent(),[2,{deviceInformationService:i,buttonService:a,ledService:o,temperatureService:s,accelerometerService:c,magnetometerService:h,uartService:f,eventService:d}]}})})};export{O as getServices,R as requestMicrobit}; | ||
//# sourceMappingURL=microbit.esm.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).microbit={})}(this,function(e){"use strict";var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,r)};function r(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){e.done?i(e.value):new r(function(t){t(e.value)}).then(o,s)}u((n=n.apply(e,t||[])).next())})}function i(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var a,o=function(){function e(e,t){this.service=e,this.emitter=t}return e.prototype.getCharacteristic=function(e){return n(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.service.getCharacteristic(e)];case 1:return[2,t.sent()];case 2:return t.sent(),[2,void 0];case 3:return[2]}})})},e.prototype.getCharacteristicValue=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return[4,this.getCharacteristic(e)];case 1:if(!(t=r.sent()))throw new Error("Unable to locate characteristic");return[4,t.readValue()];case 2:return[2,r.sent()]}})})},e.prototype.setCharacteristicValue=function(e,t){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return[4,this.getCharacteristic(e)];case 1:if(!(r=n.sent()))throw new Error("Unable to locate characteristic");return[2,r.writeValue(t)]}})})},e.prototype.handleListener=function(e,t,r){return n(this,void 0,void 0,function(){var n,a=this;return i(this,function(i){switch(i.label){case 0:return[4,this.getCharacteristic(t)];case 1:return(n=i.sent())?[4,n.startNotifications()]:[2];case 2:return i.sent(),this.emitter.on("newListener",function(t){t!==e||a.emitter.listenerCount(e)>0||n.addEventListener("characteristicvaluechanged",r)}),this.emitter.on("removeListener",function(t){t!==e||a.emitter.listenerCount(e)>0||n.removeEventListener("characteristicvaluechanged",r)}),[2]}})})},e}();!function(e){e.modelNumber="00002a24-0000-1000-8000-00805f9b34fb",e.serialNumber="00002a25-0000-1000-8000-00805f9b34fb",e.firmwareRevision="00002a26-0000-1000-8000-00805f9b34fb",e.hardwareRevision="00002a27-0000-1000-8000-00805f9b34fb",e.manufacturer="00002a29-0000-1000-8000-00805f9b34fb"}(a||(a={}));var s=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return i(this,function(r){return[2,new e(t)]})})},e.prototype.readDeviceInformation=function(){return n(this,void 0,void 0,function(){var e,t,r,n,o,s;return i(this,function(i){switch(i.label){case 0:return e={},[4,this.readStringCharacteristic(a.modelNumber)];case 1:return(t=i.sent())&&(e.modelNumber=t),[4,this.readStringCharacteristic(a.serialNumber)];case 2:return(r=i.sent())&&(e.serialNumber=r),[4,this.readStringCharacteristic(a.firmwareRevision)];case 3:return(n=i.sent())&&(e.firmwareRevision=n),[4,this.readStringCharacteristic(a.hardwareRevision)];case 4:return(o=i.sent())&&(e.hardwareRevision=o),[4,this.readStringCharacteristic(a.manufacturer)];case 5:return(s=i.sent())&&(e.manufacturer=s),[2,e]}})})},e.prototype.readStringCharacteristic=function(e){return n(this,void 0,void 0,function(){var t,r;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.helper.getCharacteristicValue(e)];case 1:return t=n.sent(),r=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),[2,String.fromCharCode.apply(null,Array.from(new Uint8Array(r)))];case 2:return n.sent(),[2,void 0];case 3:return[2]}})})},e.uuid="0000180a-0000-1000-8000-00805f9b34fb",e}();function u(){}function c(){c.init.call(this)}function h(e){return void 0===e._maxListeners?c.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var i,a,o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]):(a=e._events=new u,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(i=h(e))&&i>0&&o.length>i){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,s=c,"function"==typeof console.warn?console.warn(s):console.log(s)}}else o=a[t]=r,++e._eventsCount;return e}function d(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function l(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function v(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}u.prototype=Object.create(null),c.EventEmitter=c,c.usingDomains=!1,c.prototype.domain=void 0,c.prototype._events=void 0,c.prototype._maxListeners=void 0,c.defaultMaxListeners=10,c.init=function(){this.domain=null,c.usingDomains&&(void 0).active&&(void 0).Domain,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new u,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},c.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},c.prototype.getMaxListeners=function(){return h(this)},c.prototype.emit=function(e){var t,r,n,i,a,o,s,u="error"===e;if(o=this._events)u=u&&null==o.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=o[e]))return!1;var h="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=v(e,n),a=0;a<n;++a)i[a].call(r)}(r,h,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,a=v(e,i),o=0;o<i;++o)a[o].call(r,n)}(r,h,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var a=e.length,o=v(e,a),s=0;s<a;++s)o[s].call(r,n,i)}(r,h,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,a){if(t)e.call(r,n,i,a);else for(var o=e.length,s=v(e,o),u=0;u<o;++u)s[u].call(r,n,i,a)}(r,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),a=1;a<n;a++)i[a-1]=arguments[a];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,a=v(e,i),o=0;o<i;++o)a[o].apply(r,n)}(r,h,this,i)}return!0},c.prototype.addListener=function(e,t){return f(this,e,t,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(e,t){return f(this,e,t,!0)},c.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,d(this,e,t)),this},c.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,d(this,e,t)),this},c.prototype.removeListener=function(e,t){var r,n,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new u:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new u,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,o||t)}return this},c.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new u,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new u:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),a=0;a<i.length;++a)"removeListener"!==(n=i[a])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new u,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},c.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},c.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):l.call(e,t)},c.prototype.listenerCount=l,c.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var p,m,g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isEventListenerObject=function(e){return void 0!==e.handleEvent},t}return r(t,e),t.prototype.addEventListener=function(t,r){if(r){var n=this.isEventListenerObject(r)?r.handleEvent:r;e.prototype.addListener.call(this,t,n)}},t.prototype.removeEventListener=function(t,r){if(r){var n=this.isEventListenerObject(r)?r.handleEvent:r;e.prototype.removeListener.call(this,t,n)}},t.prototype.dispatchEvent=function(t,r){var n;return n="string"==typeof t?new CustomEvent(t,{detail:r}):t,e.prototype.emit.call(this,n.type,n)},t}(c);!function(e){e.buttonAState="e95dda90-251d-470a-a062-fa1922dfa9a8",e.buttonBState="e95dda91-251d-470a-a062-fa1922dfa9a8"}(p||(p={})),function(e){e[e.Release=0]="Release",e[e.ShortPress=1]="ShortPress",e[e.LongPress=2]="LongPress"}(m||(m={}));var y,b=function(e){function t(t){var r=e.call(this)||this;return r.helper=new o(t,r),r}return r(t,e),t.create=function(e){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return[4,(r=new t(e)).init()];case 1:return n.sent(),[2,r]}})})},t.prototype.init=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("buttonastatechanged",p.buttonAState,this.buttonAStateChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("buttonbstatechanged",p.buttonBState,this.buttonBStateChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},t.prototype.readButtonAState=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(p.buttonAState)];case 1:return[2,e.sent().getUint8(0)]}})})},t.prototype.readButtonBState=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(p.buttonBState)];case 1:return[2,e.sent().getUint8(0)]}})})},t.prototype.buttonAStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonastatechanged",t.getUint8(0))},t.prototype.buttonBStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonbstatechanged",t.getUint8(0))},t.uuid="e95d9882-251d-470a-a062-fa1922dfa9a8",t}(g);!function(e){e.ledMatrixState="e95d7b77-251d-470a-a062-fa1922dfa9a8",e.ledText="e95d93ee-251d-470a-a062-fa1922dfa9a8",e.scrollingDelay="e95d0d2d-251d-470a-a062-fa1922dfa9a8"}(y||(y={}));var w,C=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return i(this,function(r){return[2,new e(t)]})})},e.prototype.writeText=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){return t=this.encodeString(e),[2,this.helper.setCharacteristicValue(y.ledText,t)]})})},e.prototype.getMatrixState=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(y.ledMatrixState)];case 1:return e=t.sent(),[2,this.viewToLedMatrix(e)]}})})},e.prototype.setMatrixState=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){return t=this.ledMatrixToView(e),[2,this.helper.setCharacteristicValue(y.ledMatrixState,t)]})})},e.prototype.getScrollingDelay=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(y.scrollingDelay)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},e.prototype.setScrollingDelay=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(y.scrollingDelay,t)]})})},e.prototype.encodeString=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return t},e.prototype.viewToLedMatrix=function(e){for(var t=[],r=0;r<5;r++)t[r]=this.byteToBoolArray(e.getUint8(r));return t},e.prototype.byteToBoolArray=function(e){for(var t=[!1,!1,!1,!1,!1],r=0;r<t.length;r++)t[r]=1==(1&e),e>>=1;return t.reverse()},e.prototype.ledMatrixToView=function(e){for(var t=new DataView(new ArrayBuffer(5)),r=0;r<5;r++)t.setUint8(r,this.boolArrayToByte(e[r]));return t},e.prototype.boolArrayToByte=function(e){return e.reduce(function(e,t){return e<<1|(t?1:0)},0)},e.uuid="e95dd91d-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.temperature="e95d9250-251d-470a-a062-fa1922dfa9a8",e.temperaturePeriod="e95d1b25-251d-470a-a062-fa1922dfa9a8"}(w||(w={}));var L,S=function(e){function t(t){var r=e.call(this)||this;return r.helper=new o(t,r),r}return r(t,e),t.create=function(e){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return[4,(r=new t(e)).init()];case 1:return n.sent(),[2,r]}})})},t.prototype.init=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("temperaturechanged",w.temperature,this.temperatureChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},t.prototype.readTemperature=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(w.temperature)];case 1:return[2,e.sent().getInt8(0)]}})})},t.prototype.getTemperaturePeriod=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(w.temperaturePeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},t.prototype.setTemperaturePeriod=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[4,this.helper.setCharacteristicValue(w.temperaturePeriod,t)];case 1:return[2,r.sent()]}})})},t.prototype.temperatureChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("temperaturechanged",t.getInt8(0))},t.uuid="e95d6100-251d-470a-a062-fa1922dfa9a8",t}(g);!function(e){e.accelerometerData="e95dca4b-251d-470a-a062-fa1922dfa9a8",e.accelerometerPeriod="e95dfb24-251d-470a-a062-fa1922dfa9a8"}(L||(L={}));var E,V,_=function(e){function t(t){var r=e.call(this)||this;return r.helper=new o(t,r),r}return r(t,e),t.create=function(e){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return[4,(r=new t(e)).init()];case 1:return n.sent(),[2,r]}})})},t.prototype.init=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("accelerometerdatachanged",L.accelerometerData,this.accelerometerDataChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},t.prototype.readAccelerometerData=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(L.accelerometerData)];case 1:return e=t.sent(),[2,this.dataViewToAccelerometerData(e)]}})})},t.prototype.getAccelerometerPeriod=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(L.accelerometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},t.prototype.setAccelerometerPeriod=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(L.accelerometerPeriod,t)]})})},t.prototype.accelerometerDataChangedHandler=function(e){var t=e.target.value,r=this.dataViewToAccelerometerData(t);this.dispatchEvent("accelerometerdatachanged",r)},t.prototype.dataViewToAccelerometerData=function(e){return{x:e.getInt16(0,!0)/1e3,y:e.getInt16(2,!0)/1e3,z:e.getInt16(4,!0)/1e3}},t.uuid="e95d0753-251d-470a-a062-fa1922dfa9a8",t}(g);!function(e){e.magnetometerData="e95dfb11-251d-470a-a062-fa1922dfa9a8",e.magnetometerPeriod="e95d386c-251d-470a-a062-fa1922dfa9a8",e.magnetometerBearing="e95d9715-251d-470a-a062-fa1922dfa9a8",e.magnetometerCalibration="e95db358-251d-470a-a062-fa1922dfa9a8"}(E||(E={})),function(e){e[e.unknown=0]="unknown",e[e.requested=1]="requested",e[e.completed=2]="completed",e[e.errored=3]="errored"}(V||(V={}));var x,A=function(e){function t(t){var r=e.call(this)||this;return r.helper=new o(t,r),r}return r(t,e),t.create=function(e){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return[4,(r=new t(e)).init()];case 1:return n.sent(),[2,r]}})})},t.prototype.init=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("magnetometerdatachanged",E.magnetometerData,this.magnetometerDataChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("magnetometerbearingchanged",E.magnetometerBearing,this.magnetometerBearingChangedHandler.bind(this))];case 2:return e.sent(),[4,this.helper.handleListener("magnetometercalibrationchanged",E.magnetometerCalibration,this.magnetometerCalibrationChangedHandler.bind(this))];case 3:return e.sent(),[2]}})})},t.prototype.calibrate=function(){return n(this,void 0,void 0,function(){return i(this,function(e){return[2,this.helper.setCharacteristicValue(E.magnetometerCalibration,new Uint8Array([1]))]})})},t.prototype.readMagnetometerData=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(E.magnetometerData)];case 1:return e=t.sent(),[2,this.dataViewToMagnetometerData(e)]}})})},t.prototype.getMagnetometerBearing=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(E.magnetometerBearing)];case 1:return 2===(e=t.sent()).byteLength?[2,e.getUint16(0,!0)]:[2,void 0]}})})},t.prototype.getMagnetometerPeriod=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(E.magnetometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},t.prototype.setMagnetometerPeriod=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(E.magnetometerPeriod,t)]})})},t.prototype.magnetometerDataChangedHandler=function(e){var t=e.target.value,r=this.dataViewToMagnetometerData(t);this.dispatchEvent("magnetometerdatachanged",r)},t.prototype.magnetometerBearingChangedHandler=function(e){var t=e.target.value;2===t.byteLength&&this.dispatchEvent("magnetometerbearingchanged",t.getUint16(0,!0))},t.prototype.magnetometerCalibrationChangedHandler=function(e){var t=e.target.value;1===t.byteLength&&this.dispatchEvent("magnetometercalibrationchanged",t.getUint8(0))},t.prototype.dataViewToMagnetometerData=function(e){return{x:e.getInt16(0,!0),y:e.getInt16(1,!0),z:e.getInt16(2,!0)}},t.uuid="e95df2d8-251d-470a-a062-fa1922dfa9a8",t}(g);!function(e){e.pinData="e95d8d00-251d-470a-a062-fa1922dfa9a8",e.pinAdConfiguration="e95d5899-251d-470a-a062-fa1922dfa9a8",e.pinIoConfiguration="e95db9fe-251d-470a-a062-fa1922dfa9a8",e.pwmControl="e95dd822-251d-470a-a062-fa1922dfa9a8"}(x||(x={}));var D,B=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return i(this,function(r){return[2,new e(t)]})})},e.uuid="e95d127b-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.tx="6e400002-b5a3-f393-e0a9-e50e24dcca9e",e.rx="6e400003-b5a3-f393-e0a9-e50e24dcca9e"}(D||(D={}));var U,T=function(e){function t(t){var r=e.call(this)||this;return r.helper=new o(t,r),r}return r(t,e),t.create=function(e){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return[4,(r=new t(e)).init()];case 1:return n.sent(),[2,r]}})})},t.prototype.init=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("receive",D.tx,this.receiveHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("receiveString",D.tx,this.receiveStringHandler.bind(this))];case 2:return e.sent(),[2]}})})},t.prototype.send=function(e){return n(this,void 0,void 0,function(){return i(this,function(t){return[2,this.helper.setCharacteristicValue(D.rx,e)]})})},t.prototype.sendString=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){return t=e.split("").map(function(e){return e.charCodeAt(0)}),[2,this.helper.setCharacteristicValue(D.rx,new Uint8Array(t).buffer)]})})},t.prototype.receiveHandler=function(e){var t=e.target.value,r=new Uint8Array(t.buffer);this.dispatchEvent("receive",r)},t.prototype.receiveStringHandler=function(e){var t=e.target.value,r=Array.prototype.slice.call(new Uint8Array(t.buffer)),n=String.fromCharCode.apply(null,r);this.dispatchEvent("receiveString",n)},t.uuid="6e400001-b5a3-f393-e0a9-e50e24dcca9e",t}(g);!function(e){e.microBitRequirements="e95db84c-251d-470a-a062-fa1922dfa9a8",e.microBitEvent="e95d9775-251d-470a-a062-fa1922dfa9a8",e.clientRequirements="e95d23c4-251d-470a-a062-fa1922dfa9a8",e.clientEvent="e95d5404-251d-470a-a062-fa1922dfa9a8"}(U||(U={}));var M,P=function(e){function t(t){var r=e.call(this)||this;return r.helper=new o(t,r),r}return r(t,e),t.create=function(e){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return[4,(r=new t(e)).init()];case 1:return n.sent(),[2,r]}})})},t.prototype.init=function(){return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("microbitevent",U.microBitEvent,this.eventHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("microbitrequirementschanged",U.microBitRequirements,this.microbitRequirementsChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},t.prototype.getMicrobitRequirements=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(U.microBitRequirements)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},t.prototype.setClientRequirements=function(e,t){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return(r=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),r.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(U.clientRequirements,r)];case 1:return[2,n.sent()]}})})},t.prototype.readMicrobitEvent=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(U.microBitEvent)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},t.prototype.writeClientEvent=function(e,t){return n(this,void 0,void 0,function(){var r;return i(this,function(n){switch(n.label){case 0:return(r=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),r.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(U.clientEvent,r)];case 1:return[2,n.sent()]}})})},t.prototype.microbitRequirementsChangedHandler=function(e){var t=e.target.value,r=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitrequirementschanged",r)},t.prototype.eventHandler=function(e){var t=e.target.value,r=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitevent",r)},t.prototype.viewToMicrobitEvent=function(e){return{type:e.getUint16(0,!0),value:e.getUint16(1,!0)}},t.uuid="e95d93af-251d-470a-a062-fa1922dfa9a8",t}(g);!function(e){e.dfuControl="e95d93b1-251d-470a-a062-fa1922dfa9a8"}(M||(M={}));var H=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return i(this,function(r){return[2,new e(t)]})})},e.uuid="e95d93b0-251d-470a-a062-fa1922dfa9a8",e}(),R=function(){function e(e){this.services=e}return e.prototype.createService=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return(t=this.services.find(function(t){return t.uuid===e.uuid}))?[4,e.create(t)]:[2,void 0];case 1:return[2,r.sent()]}})})},e}();e.getServices=function(e){return n(void 0,void 0,void 0,function(){var t,r,n,a,o,u,c,h,f,d;return i(this,function(i){switch(i.label){case 0:return e&&e.gatt?e.gatt.connected?[3,2]:[4,e.gatt.connect()]:[2,{}];case 1:i.sent(),i.label=2;case 2:return[4,e.gatt.getPrimaryServices()];case 3:return t=i.sent(),[4,(r=new R(t)).createService(s)];case 4:return n=i.sent(),[4,r.createService(b)];case 5:return a=i.sent(),[4,r.createService(C)];case 6:return o=i.sent(),[4,r.createService(S)];case 7:return u=i.sent(),[4,r.createService(_)];case 8:return c=i.sent(),[4,r.createService(A)];case 9:return h=i.sent(),[4,r.createService(T)];case 10:return f=i.sent(),[4,r.createService(P)];case 11:return d=i.sent(),[2,{deviceInformationService:n,buttonService:a,ledService:o,temperatureService:u,accelerometerService:c,magnetometerService:h,uartService:f,eventService:d}]}})})},e.requestMicrobit=function(e){return n(void 0,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,e.requestDevice({filters:[{namePrefix:"BBC micro:bit"}],optionalServices:[s.uuid,b.uuid,C.uuid,S.uuid,_.uuid,A.uuid,B.uuid,T.uuid,P.uuid,H.uuid]})];case 1:return[2,t.sent()]}})})},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).microbit={})}(this,function(e){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,n)};function n(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function r(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,u)}s((r=r.apply(e,t||[])).next())})}function i(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var a,o=function(){function e(e){void 0===e&&(e=1),this.concurrent=e,this.queue=[],this.running=0}return e.prototype.pump=function(){return r(this,void 0,void 0,function(){var e,t,n;return i(this,function(r){switch(r.label){case 0:if(this.running>=this.concurrent)return[2];if(!(e=this.queue.shift()))return[2];this.running++,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.fn()];case 2:return t=r.sent(),e.resolve(t),[3,4];case 3:return n=r.sent(),e.reject(n),[3,4];case 4:return this.running--,[2,this.pump()]}})})},e.prototype.add=function(e){var t=this;return new Promise(function(n,r){return t.queue.push({fn:e,resolve:n,reject:r}),t.pump()})},e}(),u=function(){function e(e,t){this.service=e,this.emitter=t}return e.prototype.getCharacteristic=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return this.characteristics?[3,2]:(t=this,[4,this.service.getCharacteristics()]);case 1:t.characteristics=n.sent(),n.label=2;case 2:return[2,this.characteristics.find(function(t){return t.uuid===e})]}})})},e.prototype.getCharacteristicValue=function(t){return r(this,void 0,void 0,function(){var n,a=this;return i(this,function(o){switch(o.label){case 0:return[4,this.getCharacteristic(t)];case 1:if(!(n=o.sent()))throw new Error("Unable to locate characteristic");return[4,e.queue.add(function(){return r(a,void 0,void 0,function(){return i(this,function(e){return[2,n.readValue()]})})})];case 2:return[2,o.sent()]}})})},e.prototype.setCharacteristicValue=function(t,n){return r(this,void 0,void 0,function(){var a,o=this;return i(this,function(u){switch(u.label){case 0:return[4,this.getCharacteristic(t)];case 1:if(!(a=u.sent()))throw new Error("Unable to locate characteristic");return[4,e.queue.add(function(){return r(o,void 0,void 0,function(){return i(this,function(e){return[2,a.writeValue(n)]})})})];case 2:return u.sent(),[2]}})})},e.prototype.handleListener=function(t,n,a){return r(this,void 0,void 0,function(){var o,u=this;return i(this,function(s){switch(s.label){case 0:return[4,this.getCharacteristic(n)];case 1:return(o=s.sent())?[4,e.queue.add(function(){return r(u,void 0,void 0,function(){return i(this,function(e){return[2,o.startNotifications()]})})})]:[2];case 2:return s.sent(),this.emitter.on("newListener",function(n){if(!(n!==t||u.emitter.listenerCount(t)>0))return e.queue.add(function(){return r(u,void 0,void 0,function(){return i(this,function(e){return[2,o.addEventListener("characteristicvaluechanged",a)]})})})}),this.emitter.on("removeListener",function(n){if(!(n!==t||u.emitter.listenerCount(t)>0))return e.queue.add(function(){return r(u,void 0,void 0,function(){return i(this,function(e){return[2,o.removeEventListener("characteristicvaluechanged",a)]})})})}),[2]}})})},e.queue=new o,e}();!function(e){e.modelNumber="00002a24-0000-1000-8000-00805f9b34fb",e.serialNumber="00002a25-0000-1000-8000-00805f9b34fb",e.firmwareRevision="00002a26-0000-1000-8000-00805f9b34fb",e.hardwareRevision="00002a27-0000-1000-8000-00805f9b34fb",e.manufacturer="00002a29-0000-1000-8000-00805f9b34fb"}(a||(a={}));var s=function(){function e(e){this.helper=new u(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return i(this,function(n){return[2,new e(t)]})})},e.prototype.readDeviceInformation=function(){return r(this,void 0,void 0,function(){var e,t,n,r,o,u;return i(this,function(i){switch(i.label){case 0:return e={},[4,this.readStringCharacteristic(a.modelNumber)];case 1:return(t=i.sent())&&(e.modelNumber=t),[4,this.readStringCharacteristic(a.serialNumber)];case 2:return(n=i.sent())&&(e.serialNumber=n),[4,this.readStringCharacteristic(a.firmwareRevision)];case 3:return(r=i.sent())&&(e.firmwareRevision=r),[4,this.readStringCharacteristic(a.hardwareRevision)];case 4:return(o=i.sent())&&(e.hardwareRevision=o),[4,this.readStringCharacteristic(a.manufacturer)];case 5:return(u=i.sent())&&(e.manufacturer=u),[2,e]}})})},e.prototype.readStringCharacteristic=function(e){return r(this,void 0,void 0,function(){var t,n;return i(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.helper.getCharacteristicValue(e)];case 1:return t=r.sent(),n=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),[2,String.fromCharCode.apply(null,Array.from(new Uint8Array(n)))];case 2:return r.sent(),[2,void 0];case 3:return[2]}})})},e.uuid="0000180a-0000-1000-8000-00805f9b34fb",e}();function c(){}function h(){h.init.call(this)}function f(e){return void 0===e._maxListeners?h.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var i,a,o,u;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new c,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=f(e))&&i>0&&o.length>i){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=o.length,u=s,"function"==typeof console.warn?console.warn(u):console.log(u)}}else o=a[t]=n,++e._eventsCount;return e}function l(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function v(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function p(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}c.prototype=Object.create(null),h.EventEmitter=h,h.usingDomains=!1,h.prototype.domain=void 0,h.prototype._events=void 0,h.prototype._maxListeners=void 0,h.defaultMaxListeners=10,h.init=function(){this.domain=null,h.usingDomains&&(void 0).active&&(void 0).Domain,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new c,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},h.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},h.prototype.getMaxListeners=function(){return f(this)},h.prototype.emit=function(e){var t,n,r,i,a,o,u,s="error"===e;if(o=this._events)s=s&&null==o.error;else if(!s)return!1;if(u=this.domain,s){if(t=arguments[1],!u){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=u,t.domainThrown=!1,u.emit("error",t),!1}if(!(n=o[e]))return!1;var h="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=p(e,r),a=0;a<r;++a)i[a].call(n)}(n,h,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=p(e,i),o=0;o<i;++o)a[o].call(n,r)}(n,h,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=p(e,a),u=0;u<a;++u)o[u].call(n,r,i)}(n,h,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,u=p(e,o),s=0;s<o;++s)u[s].call(n,r,i,a)}(n,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=p(e,i),o=0;o<i;++o)a[o].apply(n,r)}(n,h,this,i)}return!0},h.prototype.addListener=function(e,t){return d(this,e,t,!1)},h.prototype.on=h.prototype.addListener,h.prototype.prependListener=function(e,t){return d(this,e,t,!0)},h.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,l(this,e,t)),this},h.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,l(this,e,t)),this},h.prototype.removeListener=function(e,t){var n,r,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new c:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new c,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,o||t)}return this},h.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new c,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new c:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),a=0;a<i.length;++a)"removeListener"!==(r=i[a])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new c,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},h.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},h.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},h.prototype.listenerCount=v,h.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var m,g,y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isEventListenerObject=function(e){return void 0!==e.handleEvent},t}return n(t,e),t.prototype.addEventListener=function(t,n){if(n){var r=this.isEventListenerObject(n)?n.handleEvent:n;e.prototype.addListener.call(this,t,r)}},t.prototype.removeEventListener=function(t,n){if(n){var r=this.isEventListenerObject(n)?n.handleEvent:n;e.prototype.removeListener.call(this,t,r)}},t.prototype.dispatchEvent=function(t,n){var r;return r="string"==typeof t?new CustomEvent(t,{detail:n}):t,e.prototype.emit.call(this,r.type,r)},t}(h);!function(e){e.buttonAState="e95dda90-251d-470a-a062-fa1922dfa9a8",e.buttonBState="e95dda91-251d-470a-a062-fa1922dfa9a8"}(m||(m={})),function(e){e[e.Release=0]="Release",e[e.ShortPress=1]="ShortPress",e[e.LongPress=2]="LongPress"}(g||(g={}));var b,w=function(e){function t(t){var n=e.call(this)||this;return n.helper=new u(t,n),n}return n(t,e),t.create=function(e){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return[4,(n=new t(e)).init()];case 1:return r.sent(),[2,n]}})})},t.prototype.init=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("buttonastatechanged",m.buttonAState,this.buttonAStateChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("buttonbstatechanged",m.buttonBState,this.buttonBStateChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},t.prototype.readButtonAState=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(m.buttonAState)];case 1:return[2,e.sent().getUint8(0)]}})})},t.prototype.readButtonBState=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(m.buttonBState)];case 1:return[2,e.sent().getUint8(0)]}})})},t.prototype.buttonAStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonastatechanged",t.getUint8(0))},t.prototype.buttonBStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonbstatechanged",t.getUint8(0))},t.uuid="e95d9882-251d-470a-a062-fa1922dfa9a8",t}(y);!function(e){e.ledMatrixState="e95d7b77-251d-470a-a062-fa1922dfa9a8",e.ledText="e95d93ee-251d-470a-a062-fa1922dfa9a8",e.scrollingDelay="e95d0d2d-251d-470a-a062-fa1922dfa9a8"}(b||(b={}));var C,L=function(){function e(e){this.helper=new u(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return i(this,function(n){return[2,new e(t)]})})},e.prototype.writeText=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){return t=this.encodeString(e),[2,this.helper.setCharacteristicValue(b.ledText,t)]})})},e.prototype.readMatrixState=function(){return r(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(b.ledMatrixState)];case 1:return e=t.sent(),[2,this.viewToLedMatrix(e)]}})})},e.prototype.writeMatrixState=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){return t=this.ledMatrixToView(e),[2,this.helper.setCharacteristicValue(b.ledMatrixState,t)]})})},e.prototype.getScrollingDelay=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(b.scrollingDelay)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},e.prototype.setScrollingDelay=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(b.scrollingDelay,t)]})})},e.prototype.encodeString=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return t},e.prototype.viewToLedMatrix=function(e){for(var t=[],n=0;n<5;n++)t[n]=this.byteToBoolArray(e.getUint8(n));return t},e.prototype.byteToBoolArray=function(e){for(var t=[!1,!1,!1,!1,!1],n=0;n<t.length;n++)t[n]=1==(1&e),e>>=1;return t.reverse()},e.prototype.ledMatrixToView=function(e){for(var t=new DataView(new ArrayBuffer(5)),n=0;n<5;n++)t.setUint8(n,this.boolArrayToByte(e[n]));return t},e.prototype.boolArrayToByte=function(e){return e.reduce(function(e,t){return e<<1|(t?1:0)},0)},e.uuid="e95dd91d-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.temperature="e95d9250-251d-470a-a062-fa1922dfa9a8",e.temperaturePeriod="e95d1b25-251d-470a-a062-fa1922dfa9a8"}(C||(C={}));var E,S=function(e){function t(t){var n=e.call(this)||this;return n.helper=new u(t,n),n}return n(t,e),t.create=function(e){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return[4,(n=new t(e)).init()];case 1:return r.sent(),[2,n]}})})},t.prototype.init=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("temperaturechanged",C.temperature,this.temperatureChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},t.prototype.readTemperature=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(C.temperature)];case 1:return[2,e.sent().getInt8(0)]}})})},t.prototype.getTemperaturePeriod=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(C.temperaturePeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},t.prototype.setTemperaturePeriod=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[4,this.helper.setCharacteristicValue(C.temperaturePeriod,t)];case 1:return[2,n.sent()]}})})},t.prototype.temperatureChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("temperaturechanged",t.getInt8(0))},t.uuid="e95d6100-251d-470a-a062-fa1922dfa9a8",t}(y);!function(e){e.accelerometerData="e95dca4b-251d-470a-a062-fa1922dfa9a8",e.accelerometerPeriod="e95dfb24-251d-470a-a062-fa1922dfa9a8"}(E||(E={}));var x,V,_=function(e){function t(t){var n=e.call(this)||this;return n.helper=new u(t,n),n}return n(t,e),t.create=function(e){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return[4,(n=new t(e)).init()];case 1:return r.sent(),[2,n]}})})},t.prototype.init=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("accelerometerdatachanged",E.accelerometerData,this.accelerometerDataChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},t.prototype.readAccelerometerData=function(){return r(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(E.accelerometerData)];case 1:return e=t.sent(),[2,this.dataViewToAccelerometerData(e)]}})})},t.prototype.getAccelerometerPeriod=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(E.accelerometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},t.prototype.setAccelerometerPeriod=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(E.accelerometerPeriod,t)]})})},t.prototype.accelerometerDataChangedHandler=function(e){var t=e.target.value,n=this.dataViewToAccelerometerData(t);this.dispatchEvent("accelerometerdatachanged",n)},t.prototype.dataViewToAccelerometerData=function(e){return{x:e.getInt16(0,!0)/1e3,y:e.getInt16(2,!0)/1e3,z:e.getInt16(4,!0)/1e3}},t.uuid="e95d0753-251d-470a-a062-fa1922dfa9a8",t}(y);!function(e){e.magnetometerData="e95dfb11-251d-470a-a062-fa1922dfa9a8",e.magnetometerPeriod="e95d386c-251d-470a-a062-fa1922dfa9a8",e.magnetometerBearing="e95d9715-251d-470a-a062-fa1922dfa9a8",e.magnetometerCalibration="e95db358-251d-470a-a062-fa1922dfa9a8"}(x||(x={})),function(e){e[e.unknown=0]="unknown",e[e.requested=1]="requested",e[e.completed=2]="completed",e[e.errored=3]="errored"}(V||(V={}));var A,T=function(e){function t(t){var n=e.call(this)||this;return n.helper=new u(t,n),n}return n(t,e),t.create=function(e){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return[4,(n=new t(e)).init()];case 1:return r.sent(),[2,n]}})})},t.prototype.init=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("magnetometerdatachanged",x.magnetometerData,this.magnetometerDataChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("magnetometerbearingchanged",x.magnetometerBearing,this.magnetometerBearingChangedHandler.bind(this))];case 2:return e.sent(),[4,this.helper.handleListener("magnetometercalibrationchanged",x.magnetometerCalibration,this.magnetometerCalibrationChangedHandler.bind(this))];case 3:return e.sent(),[2]}})})},t.prototype.calibrate=function(){return r(this,void 0,void 0,function(){return i(this,function(e){return[2,this.helper.setCharacteristicValue(x.magnetometerCalibration,new Uint8Array([1]))]})})},t.prototype.readMagnetometerData=function(){return r(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(x.magnetometerData)];case 1:return e=t.sent(),[2,this.dataViewToMagnetometerData(e)]}})})},t.prototype.readMagnetometerBearing=function(){return r(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(x.magnetometerBearing)];case 1:return 2===(e=t.sent()).byteLength?[2,e.getUint16(0,!0)]:[2,void 0]}})})},t.prototype.getMagnetometerPeriod=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(x.magnetometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},t.prototype.setMagnetometerPeriod=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(x.magnetometerPeriod,t)]})})},t.prototype.magnetometerDataChangedHandler=function(e){var t=e.target.value,n=this.dataViewToMagnetometerData(t);this.dispatchEvent("magnetometerdatachanged",n)},t.prototype.magnetometerBearingChangedHandler=function(e){var t=e.target.value;2===t.byteLength&&this.dispatchEvent("magnetometerbearingchanged",t.getUint16(0,!0))},t.prototype.magnetometerCalibrationChangedHandler=function(e){var t=e.target.value;1===t.byteLength&&this.dispatchEvent("magnetometercalibrationchanged",t.getUint8(0))},t.prototype.dataViewToMagnetometerData=function(e){return{x:e.getInt16(0,!0),y:e.getInt16(1,!0),z:e.getInt16(2,!0)}},t.uuid="e95df2d8-251d-470a-a062-fa1922dfa9a8",t}(y);!function(e){e.pinData="e95d8d00-251d-470a-a062-fa1922dfa9a8",e.pinAdConfiguration="e95d5899-251d-470a-a062-fa1922dfa9a8",e.pinIoConfiguration="e95db9fe-251d-470a-a062-fa1922dfa9a8",e.pwmControl="e95dd822-251d-470a-a062-fa1922dfa9a8"}(A||(A={}));var D,B=function(){function e(e){this.helper=new u(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return i(this,function(n){return[2,new e(t)]})})},e.uuid="e95d127b-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.tx="6e400002-b5a3-f393-e0a9-e50e24dcca9e",e.rx="6e400003-b5a3-f393-e0a9-e50e24dcca9e"}(D||(D={}));var U,M=function(e){function t(t){var n=e.call(this)||this;return n.helper=new u(t,n),n}return n(t,e),t.create=function(e){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return[4,(n=new t(e)).init()];case 1:return r.sent(),[2,n]}})})},t.prototype.init=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("receive",D.tx,this.receiveHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("receiveText",D.tx,this.receiveTextHandler.bind(this))];case 2:return e.sent(),[2]}})})},t.prototype.send=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){return[2,this.helper.setCharacteristicValue(D.rx,e)]})})},t.prototype.sendText=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){return t=e.split("").map(function(e){return e.charCodeAt(0)}),[2,this.helper.setCharacteristicValue(D.rx,new Uint8Array(t).buffer)]})})},t.prototype.receiveHandler=function(e){var t=e.target.value,n=new Uint8Array(t.buffer);this.dispatchEvent("receive",n)},t.prototype.receiveTextHandler=function(e){var t=e.target.value,n=Array.prototype.slice.call(new Uint8Array(t.buffer)),r=String.fromCharCode.apply(null,n);this.dispatchEvent("receiveText",r)},t.uuid="6e400001-b5a3-f393-e0a9-e50e24dcca9e",t}(y);!function(e){e.microBitRequirements="e95db84c-251d-470a-a062-fa1922dfa9a8",e.microBitEvent="e95d9775-251d-470a-a062-fa1922dfa9a8",e.clientRequirements="e95d23c4-251d-470a-a062-fa1922dfa9a8",e.clientEvent="e95d5404-251d-470a-a062-fa1922dfa9a8"}(U||(U={}));var P,q=function(e){function t(t){var n=e.call(this)||this;return n.helper=new u(t,n),n}return n(t,e),t.create=function(e){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return[4,(n=new t(e)).init()];case 1:return r.sent(),[2,n]}})})},t.prototype.init=function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("microbitevent",U.microBitEvent,this.eventHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("microbitrequirementschanged",U.microBitRequirements,this.microbitRequirementsChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},t.prototype.getMicrobitRequirements=function(){return r(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(U.microBitRequirements)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},t.prototype.setClientRequirements=function(e,t){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return(n=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),n.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(U.clientRequirements,n)];case 1:return[2,r.sent()]}})})},t.prototype.readMicrobitEvent=function(){return r(this,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(U.microBitEvent)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},t.prototype.writeClientEvent=function(e,t){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:return(n=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),n.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(U.clientEvent,n)];case 1:return[2,r.sent()]}})})},t.prototype.microbitRequirementsChangedHandler=function(e){var t=e.target.value,n=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitrequirementschanged",n)},t.prototype.eventHandler=function(e){var t=e.target.value,n=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitevent",n)},t.prototype.viewToMicrobitEvent=function(e){return{type:e.getUint16(0,!0),value:e.getUint16(1,!0)}},t.uuid="e95d93af-251d-470a-a062-fa1922dfa9a8",t}(y);!function(e){e.dfuControl="e95d93b1-251d-470a-a062-fa1922dfa9a8"}(P||(P={}));var H=function(){function e(e){this.helper=new u(e)}return e.create=function(t){return r(this,void 0,void 0,function(){return i(this,function(n){return[2,new e(t)]})})},e.uuid="e95d93b0-251d-470a-a062-fa1922dfa9a8",e}(),R=function(){function e(e){this.services=e}return e.prototype.createService=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return(t=this.services.find(function(t){return t.uuid===e.uuid}))?[4,e.create(t)]:[2,void 0];case 1:return[2,n.sent()]}})})},e}();e.getServices=function(e){return r(void 0,void 0,void 0,function(){var t,n,r,a,o,u,c,h,f,d;return i(this,function(i){switch(i.label){case 0:return e&&e.gatt?e.gatt.connected?[3,2]:[4,e.gatt.connect()]:[2,{}];case 1:i.sent(),i.label=2;case 2:return[4,e.gatt.getPrimaryServices()];case 3:return t=i.sent(),[4,(n=new R(t)).createService(s)];case 4:return r=i.sent(),[4,n.createService(w)];case 5:return a=i.sent(),[4,n.createService(L)];case 6:return o=i.sent(),[4,n.createService(S)];case 7:return u=i.sent(),[4,n.createService(_)];case 8:return c=i.sent(),[4,n.createService(T)];case 9:return h=i.sent(),[4,n.createService(M)];case 10:return f=i.sent(),[4,n.createService(q)];case 11:return d=i.sent(),[2,{deviceInformationService:r,buttonService:a,ledService:o,temperatureService:u,accelerometerService:c,magnetometerService:h,uartService:f,eventService:d}]}})})},e.requestMicrobit=function(e){return r(void 0,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,e.requestDevice({filters:[{namePrefix:"BBC micro:bit"}],optionalServices:[s.uuid,w.uuid,L.uuid,S.uuid,_.uuid,T.uuid,B.uuid,M.uuid,q.uuid,H.uuid]})];case 1:return[2,t.sent()]}})})},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=microbit.umd.js.map |
var typedoc = typedoc || {}; | ||
typedoc.search = typedoc.search || {}; | ||
typedoc.search.data = {"kinds":{"4":"Enumeration","16":"Enumeration member","64":"Function","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":256,"name":"ServiceEventHandler","url":"interfaces/serviceeventhandler.html","classes":"tsd-kind-interface"},{"id":1,"kind":1024,"name":"characteristic","url":"interfaces/serviceeventhandler.html#characteristic","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ServiceEventHandler"},{"id":2,"kind":1024,"name":"handler","url":"interfaces/serviceeventhandler.html#handler","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ServiceEventHandler"},{"id":3,"kind":65536,"name":"__type","url":"interfaces/serviceeventhandler.html#handler.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"ServiceEventHandler.handler"},{"id":4,"kind":128,"name":"ServiceHelper","url":"classes/servicehelper.html","classes":"tsd-kind-class"},{"id":5,"kind":512,"name":"constructor","url":"classes/servicehelper.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"ServiceHelper"},{"id":6,"kind":2048,"name":"getCharacteristicValue","url":"classes/servicehelper.html#getcharacteristicvalue","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ServiceHelper"},{"id":7,"kind":2048,"name":"setCharacteristicValue","url":"classes/servicehelper.html#setcharacteristicvalue","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ServiceHelper"},{"id":8,"kind":2048,"name":"handleListener","url":"classes/servicehelper.html#handlelistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ServiceHelper"},{"id":9,"kind":256,"name":"DeviceInformation","url":"interfaces/deviceinformation.html","classes":"tsd-kind-interface"},{"id":10,"kind":1024,"name":"modelNumber","url":"interfaces/deviceinformation.html#modelnumber","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":11,"kind":1024,"name":"serialNumber","url":"interfaces/deviceinformation.html#serialnumber","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":12,"kind":1024,"name":"firmwareRevision","url":"interfaces/deviceinformation.html#firmwarerevision","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":13,"kind":1024,"name":"hardwareRevision","url":"interfaces/deviceinformation.html#hardwarerevision","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":14,"kind":1024,"name":"manufacturer","url":"interfaces/deviceinformation.html#manufacturer","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":15,"kind":128,"name":"DeviceInformationService","url":"classes/deviceinformationservice.html","classes":"tsd-kind-class"},{"id":16,"kind":512,"name":"constructor","url":"classes/deviceinformationservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"DeviceInformationService"},{"id":17,"kind":2048,"name":"readDeviceInformation","url":"classes/deviceinformationservice.html#readdeviceinformation","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DeviceInformationService"},{"id":18,"kind":4,"name":"ButtonState","url":"enums/buttonstate.html","classes":"tsd-kind-enum"},{"id":19,"kind":16,"name":"Release","url":"enums/buttonstate.html#release","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"ButtonState"},{"id":20,"kind":16,"name":"ShortPress","url":"enums/buttonstate.html#shortpress","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"ButtonState"},{"id":21,"kind":16,"name":"LongPress","url":"enums/buttonstate.html#longpress","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"ButtonState"},{"id":22,"kind":256,"name":"ButtonEvents","url":"interfaces/buttonevents.html","classes":"tsd-kind-interface"},{"id":23,"kind":1024,"name":"newListener","url":"interfaces/buttonevents.html#newlistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ButtonEvents"},{"id":24,"kind":1024,"name":"removeListener","url":"interfaces/buttonevents.html#removelistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ButtonEvents"},{"id":25,"kind":1024,"name":"buttonastatechanged","url":"interfaces/buttonevents.html#buttonastatechanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ButtonEvents"},{"id":26,"kind":1024,"name":"buttonbstatechanged","url":"interfaces/buttonevents.html#buttonbstatechanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ButtonEvents"},{"id":27,"kind":128,"name":"ButtonService","url":"classes/buttonservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":28,"kind":512,"name":"constructor","url":"classes/buttonservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"ButtonService"},{"id":29,"kind":2048,"name":"readButtonAState","url":"classes/buttonservice.html#readbuttonastate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ButtonService"},{"id":30,"kind":2048,"name":"readButtonBState","url":"classes/buttonservice.html#readbuttonbstate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ButtonService"},{"id":31,"kind":2048,"name":"addEventListener","url":"classes/buttonservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":32,"kind":2048,"name":"removeEventListener","url":"classes/buttonservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":33,"kind":2048,"name":"dispatchEvent","url":"classes/buttonservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":34,"kind":2048,"name":"addListener","url":"classes/buttonservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":35,"kind":2048,"name":"on","url":"classes/buttonservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":36,"kind":2048,"name":"once","url":"classes/buttonservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":37,"kind":2048,"name":"prependListener","url":"classes/buttonservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":38,"kind":2048,"name":"prependOnceListener","url":"classes/buttonservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":39,"kind":2048,"name":"removeListener","url":"classes/buttonservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":40,"kind":2048,"name":"removeAllListeners","url":"classes/buttonservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":41,"kind":2048,"name":"listeners","url":"classes/buttonservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":42,"kind":2048,"name":"emit","url":"classes/buttonservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":43,"kind":2048,"name":"eventNames","url":"classes/buttonservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":44,"kind":2048,"name":"listenerCount","url":"classes/buttonservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":45,"kind":2048,"name":"setMaxListeners","url":"classes/buttonservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ButtonService"},{"id":46,"kind":2048,"name":"getMaxListeners","url":"classes/buttonservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ButtonService"},{"id":47,"kind":128,"name":"LedService","url":"classes/ledservice.html","classes":"tsd-kind-class"},{"id":48,"kind":512,"name":"constructor","url":"classes/ledservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"LedService"},{"id":49,"kind":2048,"name":"writeText","url":"classes/ledservice.html#writetext","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":50,"kind":2048,"name":"getMatrixState","url":"classes/ledservice.html#getmatrixstate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":51,"kind":2048,"name":"setMatrixState","url":"classes/ledservice.html#setmatrixstate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":52,"kind":2048,"name":"getScrollingDelay","url":"classes/ledservice.html#getscrollingdelay","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":53,"kind":2048,"name":"setScrollingDelay","url":"classes/ledservice.html#setscrollingdelay","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":54,"kind":4194304,"name":"LedMatrix","url":"globals.html#ledmatrix","classes":"tsd-kind-type-alias"},{"id":55,"kind":256,"name":"TemperatureEvents","url":"interfaces/temperatureevents.html","classes":"tsd-kind-interface"},{"id":56,"kind":1024,"name":"newListener","url":"interfaces/temperatureevents.html#newlistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TemperatureEvents"},{"id":57,"kind":1024,"name":"removeListener","url":"interfaces/temperatureevents.html#removelistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TemperatureEvents"},{"id":58,"kind":1024,"name":"temperaturechanged","url":"interfaces/temperatureevents.html#temperaturechanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TemperatureEvents"},{"id":59,"kind":128,"name":"TemperatureService","url":"classes/temperatureservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":60,"kind":512,"name":"constructor","url":"classes/temperatureservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"TemperatureService"},{"id":61,"kind":2048,"name":"readTemperature","url":"classes/temperatureservice.html#readtemperature","classes":"tsd-kind-method tsd-parent-kind-class","parent":"TemperatureService"},{"id":62,"kind":2048,"name":"getTemperaturePeriod","url":"classes/temperatureservice.html#gettemperatureperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"TemperatureService"},{"id":63,"kind":2048,"name":"setTemperaturePeriod","url":"classes/temperatureservice.html#settemperatureperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"TemperatureService"},{"id":64,"kind":2048,"name":"addEventListener","url":"classes/temperatureservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":65,"kind":2048,"name":"removeEventListener","url":"classes/temperatureservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":66,"kind":2048,"name":"dispatchEvent","url":"classes/temperatureservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":67,"kind":2048,"name":"addListener","url":"classes/temperatureservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":68,"kind":2048,"name":"on","url":"classes/temperatureservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":69,"kind":2048,"name":"once","url":"classes/temperatureservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":70,"kind":2048,"name":"prependListener","url":"classes/temperatureservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":71,"kind":2048,"name":"prependOnceListener","url":"classes/temperatureservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":72,"kind":2048,"name":"removeListener","url":"classes/temperatureservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":73,"kind":2048,"name":"removeAllListeners","url":"classes/temperatureservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":74,"kind":2048,"name":"listeners","url":"classes/temperatureservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":75,"kind":2048,"name":"emit","url":"classes/temperatureservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":76,"kind":2048,"name":"eventNames","url":"classes/temperatureservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":77,"kind":2048,"name":"listenerCount","url":"classes/temperatureservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":78,"kind":2048,"name":"setMaxListeners","url":"classes/temperatureservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TemperatureService"},{"id":79,"kind":2048,"name":"getMaxListeners","url":"classes/temperatureservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TemperatureService"},{"id":80,"kind":256,"name":"AccelerometerData","url":"interfaces/accelerometerdata.html","classes":"tsd-kind-interface"},{"id":81,"kind":1024,"name":"x","url":"interfaces/accelerometerdata.html#x","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerData"},{"id":82,"kind":1024,"name":"y","url":"interfaces/accelerometerdata.html#y","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerData"},{"id":83,"kind":1024,"name":"z","url":"interfaces/accelerometerdata.html#z","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerData"},{"id":84,"kind":256,"name":"AccelerometerEvents","url":"interfaces/accelerometerevents.html","classes":"tsd-kind-interface"},{"id":85,"kind":1024,"name":"newListener","url":"interfaces/accelerometerevents.html#newlistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerEvents"},{"id":86,"kind":1024,"name":"removeListener","url":"interfaces/accelerometerevents.html#removelistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerEvents"},{"id":87,"kind":1024,"name":"accelerometerdatachanged","url":"interfaces/accelerometerevents.html#accelerometerdatachanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerEvents"},{"id":88,"kind":128,"name":"AccelerometerService","url":"classes/accelerometerservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":89,"kind":512,"name":"constructor","url":"classes/accelerometerservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"AccelerometerService"},{"id":90,"kind":2048,"name":"readAccelerometerData","url":"classes/accelerometerservice.html#readaccelerometerdata","classes":"tsd-kind-method tsd-parent-kind-class","parent":"AccelerometerService"},{"id":91,"kind":2048,"name":"getAccelerometerPeriod","url":"classes/accelerometerservice.html#getaccelerometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"AccelerometerService"},{"id":92,"kind":2048,"name":"setAccelerometerPeriod","url":"classes/accelerometerservice.html#setaccelerometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"AccelerometerService"},{"id":93,"kind":2048,"name":"addEventListener","url":"classes/accelerometerservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":94,"kind":2048,"name":"removeEventListener","url":"classes/accelerometerservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":95,"kind":2048,"name":"dispatchEvent","url":"classes/accelerometerservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":96,"kind":2048,"name":"addListener","url":"classes/accelerometerservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":97,"kind":2048,"name":"on","url":"classes/accelerometerservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":98,"kind":2048,"name":"once","url":"classes/accelerometerservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":99,"kind":2048,"name":"prependListener","url":"classes/accelerometerservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":100,"kind":2048,"name":"prependOnceListener","url":"classes/accelerometerservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":101,"kind":2048,"name":"removeListener","url":"classes/accelerometerservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":102,"kind":2048,"name":"removeAllListeners","url":"classes/accelerometerservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":103,"kind":2048,"name":"listeners","url":"classes/accelerometerservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":104,"kind":2048,"name":"emit","url":"classes/accelerometerservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":105,"kind":2048,"name":"eventNames","url":"classes/accelerometerservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":106,"kind":2048,"name":"listenerCount","url":"classes/accelerometerservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":107,"kind":2048,"name":"setMaxListeners","url":"classes/accelerometerservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"AccelerometerService"},{"id":108,"kind":2048,"name":"getMaxListeners","url":"classes/accelerometerservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"AccelerometerService"},{"id":109,"kind":4194304,"name":"AccelerometerPeriod","url":"globals.html#accelerometerperiod","classes":"tsd-kind-type-alias"},{"id":110,"kind":256,"name":"MagnetometerData","url":"interfaces/magnetometerdata.html","classes":"tsd-kind-interface"},{"id":111,"kind":1024,"name":"x","url":"interfaces/magnetometerdata.html#x","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerData"},{"id":112,"kind":1024,"name":"y","url":"interfaces/magnetometerdata.html#y","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerData"},{"id":113,"kind":1024,"name":"z","url":"interfaces/magnetometerdata.html#z","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerData"},{"id":114,"kind":4,"name":"MagnetometerCalibration","url":"enums/magnetometercalibration.html","classes":"tsd-kind-enum"},{"id":115,"kind":16,"name":"unknown","url":"enums/magnetometercalibration.html#unknown","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":116,"kind":16,"name":"requested","url":"enums/magnetometercalibration.html#requested","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":117,"kind":16,"name":"completed","url":"enums/magnetometercalibration.html#completed","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":118,"kind":16,"name":"errored","url":"enums/magnetometercalibration.html#errored","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":119,"kind":256,"name":"MagnetometerEvents","url":"interfaces/magnetometerevents.html","classes":"tsd-kind-interface"},{"id":120,"kind":1024,"name":"newListener","url":"interfaces/magnetometerevents.html#newlistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":121,"kind":1024,"name":"removeListener","url":"interfaces/magnetometerevents.html#removelistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":122,"kind":1024,"name":"magnetometerdatachanged","url":"interfaces/magnetometerevents.html#magnetometerdatachanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":123,"kind":1024,"name":"magnetometerbearingchanged","url":"interfaces/magnetometerevents.html#magnetometerbearingchanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":124,"kind":1024,"name":"magnetometercalibrationchanged","url":"interfaces/magnetometerevents.html#magnetometercalibrationchanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":125,"kind":128,"name":"MagnetometerService","url":"classes/magnetometerservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":126,"kind":512,"name":"constructor","url":"classes/magnetometerservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"MagnetometerService"},{"id":127,"kind":2048,"name":"calibrate","url":"classes/magnetometerservice.html#calibrate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":128,"kind":2048,"name":"readMagnetometerData","url":"classes/magnetometerservice.html#readmagnetometerdata","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":129,"kind":2048,"name":"getMagnetometerBearing","url":"classes/magnetometerservice.html#getmagnetometerbearing","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":130,"kind":2048,"name":"getMagnetometerPeriod","url":"classes/magnetometerservice.html#getmagnetometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":131,"kind":2048,"name":"setMagnetometerPeriod","url":"classes/magnetometerservice.html#setmagnetometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":132,"kind":2048,"name":"addEventListener","url":"classes/magnetometerservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":133,"kind":2048,"name":"removeEventListener","url":"classes/magnetometerservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":134,"kind":2048,"name":"dispatchEvent","url":"classes/magnetometerservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":135,"kind":2048,"name":"addListener","url":"classes/magnetometerservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":136,"kind":2048,"name":"on","url":"classes/magnetometerservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":137,"kind":2048,"name":"once","url":"classes/magnetometerservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":138,"kind":2048,"name":"prependListener","url":"classes/magnetometerservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":139,"kind":2048,"name":"prependOnceListener","url":"classes/magnetometerservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":140,"kind":2048,"name":"removeListener","url":"classes/magnetometerservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":141,"kind":2048,"name":"removeAllListeners","url":"classes/magnetometerservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":142,"kind":2048,"name":"listeners","url":"classes/magnetometerservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":143,"kind":2048,"name":"emit","url":"classes/magnetometerservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":144,"kind":2048,"name":"eventNames","url":"classes/magnetometerservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":145,"kind":2048,"name":"listenerCount","url":"classes/magnetometerservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":146,"kind":2048,"name":"setMaxListeners","url":"classes/magnetometerservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MagnetometerService"},{"id":147,"kind":2048,"name":"getMaxListeners","url":"classes/magnetometerservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MagnetometerService"},{"id":148,"kind":4194304,"name":"MagnetometerPeriod","url":"globals.html#magnetometerperiod","classes":"tsd-kind-type-alias"},{"id":149,"kind":128,"name":"IoPinService","url":"classes/iopinservice.html","classes":"tsd-kind-class"},{"id":150,"kind":1024,"name":"helper","url":"classes/iopinservice.html#helper","classes":"tsd-kind-property tsd-parent-kind-class","parent":"IoPinService"},{"id":151,"kind":512,"name":"constructor","url":"classes/iopinservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"IoPinService"},{"id":152,"kind":256,"name":"UartEvents","url":"interfaces/uartevents.html","classes":"tsd-kind-interface"},{"id":153,"kind":1024,"name":"newListener","url":"interfaces/uartevents.html#newlistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"UartEvents"},{"id":154,"kind":1024,"name":"removeListener","url":"interfaces/uartevents.html#removelistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"UartEvents"},{"id":155,"kind":1024,"name":"receive","url":"interfaces/uartevents.html#receive","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"UartEvents"},{"id":156,"kind":1024,"name":"receiveString","url":"interfaces/uartevents.html#receivestring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"UartEvents"},{"id":157,"kind":128,"name":"UartService","url":"classes/uartservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":158,"kind":512,"name":"constructor","url":"classes/uartservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"UartService"},{"id":159,"kind":2048,"name":"send","url":"classes/uartservice.html#send","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UartService"},{"id":160,"kind":2048,"name":"sendString","url":"classes/uartservice.html#sendstring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UartService"},{"id":161,"kind":2048,"name":"addEventListener","url":"classes/uartservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":162,"kind":2048,"name":"removeEventListener","url":"classes/uartservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":163,"kind":2048,"name":"dispatchEvent","url":"classes/uartservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":164,"kind":2048,"name":"addListener","url":"classes/uartservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":165,"kind":2048,"name":"on","url":"classes/uartservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":166,"kind":2048,"name":"once","url":"classes/uartservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":167,"kind":2048,"name":"prependListener","url":"classes/uartservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":168,"kind":2048,"name":"prependOnceListener","url":"classes/uartservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":169,"kind":2048,"name":"removeListener","url":"classes/uartservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":170,"kind":2048,"name":"removeAllListeners","url":"classes/uartservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":171,"kind":2048,"name":"listeners","url":"classes/uartservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":172,"kind":2048,"name":"emit","url":"classes/uartservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":173,"kind":2048,"name":"eventNames","url":"classes/uartservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":174,"kind":2048,"name":"listenerCount","url":"classes/uartservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":175,"kind":2048,"name":"setMaxListeners","url":"classes/uartservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"UartService"},{"id":176,"kind":2048,"name":"getMaxListeners","url":"classes/uartservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"UartService"},{"id":177,"kind":256,"name":"MicrobitEvent","url":"interfaces/microbitevent.html","classes":"tsd-kind-interface"},{"id":178,"kind":1024,"name":"type","url":"interfaces/microbitevent.html#type","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvent"},{"id":179,"kind":1024,"name":"value","url":"interfaces/microbitevent.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvent"},{"id":180,"kind":256,"name":"MicrobitEvents","url":"interfaces/microbitevents.html","classes":"tsd-kind-interface"},{"id":181,"kind":1024,"name":"newListener","url":"interfaces/microbitevents.html#newlistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvents"},{"id":182,"kind":1024,"name":"removeListener","url":"interfaces/microbitevents.html#removelistener","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvents"},{"id":183,"kind":1024,"name":"microbitrequirementschanged","url":"interfaces/microbitevents.html#microbitrequirementschanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvents"},{"id":184,"kind":1024,"name":"microbitevent","url":"interfaces/microbitevents.html#microbitevent","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvents"},{"id":185,"kind":128,"name":"EventService","url":"classes/eventservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":186,"kind":512,"name":"constructor","url":"classes/eventservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"EventService"},{"id":187,"kind":2048,"name":"getMicrobitRequirements","url":"classes/eventservice.html#getmicrobitrequirements","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":188,"kind":2048,"name":"setClientRequirements","url":"classes/eventservice.html#setclientrequirements","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":189,"kind":2048,"name":"readMicrobitEvent","url":"classes/eventservice.html#readmicrobitevent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":190,"kind":2048,"name":"writeClientEvent","url":"classes/eventservice.html#writeclientevent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":191,"kind":2048,"name":"addEventListener","url":"classes/eventservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":192,"kind":2048,"name":"removeEventListener","url":"classes/eventservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":193,"kind":2048,"name":"dispatchEvent","url":"classes/eventservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":194,"kind":2048,"name":"addListener","url":"classes/eventservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":195,"kind":2048,"name":"on","url":"classes/eventservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":196,"kind":2048,"name":"once","url":"classes/eventservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":197,"kind":2048,"name":"prependListener","url":"classes/eventservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":198,"kind":2048,"name":"prependOnceListener","url":"classes/eventservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":199,"kind":2048,"name":"removeListener","url":"classes/eventservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":200,"kind":2048,"name":"removeAllListeners","url":"classes/eventservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":201,"kind":2048,"name":"listeners","url":"classes/eventservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":202,"kind":2048,"name":"emit","url":"classes/eventservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":203,"kind":2048,"name":"eventNames","url":"classes/eventservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":204,"kind":2048,"name":"listenerCount","url":"classes/eventservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":205,"kind":2048,"name":"setMaxListeners","url":"classes/eventservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"EventService"},{"id":206,"kind":2048,"name":"getMaxListeners","url":"classes/eventservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"EventService"},{"id":207,"kind":128,"name":"DfuControlService","url":"classes/dfucontrolservice.html","classes":"tsd-kind-class"},{"id":208,"kind":1024,"name":"helper","url":"classes/dfucontrolservice.html#helper","classes":"tsd-kind-property tsd-parent-kind-class","parent":"DfuControlService"},{"id":209,"kind":512,"name":"constructor","url":"classes/dfucontrolservice.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"DfuControlService"},{"id":210,"kind":256,"name":"Services","url":"interfaces/services.html","classes":"tsd-kind-interface"},{"id":211,"kind":1024,"name":"deviceInformationService","url":"interfaces/services.html#deviceinformationservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":212,"kind":1024,"name":"buttonService","url":"interfaces/services.html#buttonservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":213,"kind":1024,"name":"ledService","url":"interfaces/services.html#ledservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":214,"kind":1024,"name":"temperatureService","url":"interfaces/services.html#temperatureservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":215,"kind":1024,"name":"accelerometerService","url":"interfaces/services.html#accelerometerservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":216,"kind":1024,"name":"magnetometerService","url":"interfaces/services.html#magnetometerservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":217,"kind":1024,"name":"uartService","url":"interfaces/services.html#uartservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":218,"kind":1024,"name":"eventService","url":"interfaces/services.html#eventservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":219,"kind":256,"name":"Service","url":"interfaces/service.html","classes":"tsd-kind-interface tsd-is-not-exported"},{"id":220,"kind":1024,"name":"uuid","url":"interfaces/service.html#uuid","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-not-exported","parent":"Service"},{"id":221,"kind":2048,"name":"create","url":"interfaces/service.html#create","classes":"tsd-kind-method tsd-parent-kind-interface tsd-is-not-exported","parent":"Service"},{"id":222,"kind":128,"name":"ServiceBuilder","url":"classes/servicebuilder.html","classes":"tsd-kind-class tsd-is-not-exported"},{"id":223,"kind":512,"name":"constructor","url":"classes/servicebuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-not-exported","parent":"ServiceBuilder"},{"id":224,"kind":2048,"name":"createService","url":"classes/servicebuilder.html#createservice","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-not-exported","parent":"ServiceBuilder"},{"id":225,"kind":64,"name":"requestMicrobit","url":"globals.html#requestmicrobit","classes":"tsd-kind-function"},{"id":226,"kind":64,"name":"getServices","url":"globals.html#getservices","classes":"tsd-kind-function"}]}; | ||
typedoc.search.data = {"kinds":{"4":"Enumeration","16":"Enumeration member","64":"Function","128":"Class","256":"Interface","1024":"Property","2048":"Method","4194304":"Type alias"},"rows":[{"id":0,"kind":256,"name":"DeviceInformation","url":"interfaces/deviceinformation.html","classes":"tsd-kind-interface"},{"id":1,"kind":1024,"name":"modelNumber","url":"interfaces/deviceinformation.html#modelnumber","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":2,"kind":1024,"name":"serialNumber","url":"interfaces/deviceinformation.html#serialnumber","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":3,"kind":1024,"name":"firmwareRevision","url":"interfaces/deviceinformation.html#firmwarerevision","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":4,"kind":1024,"name":"hardwareRevision","url":"interfaces/deviceinformation.html#hardwarerevision","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":5,"kind":1024,"name":"manufacturer","url":"interfaces/deviceinformation.html#manufacturer","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DeviceInformation"},{"id":6,"kind":128,"name":"DeviceInformationService","url":"classes/deviceinformationservice.html","classes":"tsd-kind-class"},{"id":7,"kind":2048,"name":"readDeviceInformation","url":"classes/deviceinformationservice.html#readdeviceinformation","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DeviceInformationService"},{"id":8,"kind":4,"name":"ButtonState","url":"enums/buttonstate.html","classes":"tsd-kind-enum"},{"id":9,"kind":16,"name":"Release","url":"enums/buttonstate.html#release","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"ButtonState"},{"id":10,"kind":16,"name":"ShortPress","url":"enums/buttonstate.html#shortpress","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"ButtonState"},{"id":11,"kind":16,"name":"LongPress","url":"enums/buttonstate.html#longpress","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"ButtonState"},{"id":12,"kind":256,"name":"ButtonEvents","url":"interfaces/buttonevents.html","classes":"tsd-kind-interface"},{"id":13,"kind":1024,"name":"buttonastatechanged","url":"interfaces/buttonevents.html#buttonastatechanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ButtonEvents"},{"id":14,"kind":1024,"name":"buttonbstatechanged","url":"interfaces/buttonevents.html#buttonbstatechanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ButtonEvents"},{"id":15,"kind":128,"name":"ButtonService","url":"classes/buttonservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":16,"kind":2048,"name":"readButtonAState","url":"classes/buttonservice.html#readbuttonastate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ButtonService"},{"id":17,"kind":2048,"name":"readButtonBState","url":"classes/buttonservice.html#readbuttonbstate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ButtonService"},{"id":18,"kind":2048,"name":"addEventListener","url":"classes/buttonservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":19,"kind":2048,"name":"removeEventListener","url":"classes/buttonservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":20,"kind":2048,"name":"dispatchEvent","url":"classes/buttonservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":21,"kind":2048,"name":"addListener","url":"classes/buttonservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":22,"kind":2048,"name":"on","url":"classes/buttonservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":23,"kind":2048,"name":"once","url":"classes/buttonservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":24,"kind":2048,"name":"prependListener","url":"classes/buttonservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":25,"kind":2048,"name":"prependOnceListener","url":"classes/buttonservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":26,"kind":2048,"name":"removeListener","url":"classes/buttonservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":27,"kind":2048,"name":"removeAllListeners","url":"classes/buttonservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":28,"kind":2048,"name":"listeners","url":"classes/buttonservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":29,"kind":2048,"name":"emit","url":"classes/buttonservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":30,"kind":2048,"name":"eventNames","url":"classes/buttonservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":31,"kind":2048,"name":"listenerCount","url":"classes/buttonservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"ButtonService"},{"id":32,"kind":2048,"name":"setMaxListeners","url":"classes/buttonservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ButtonService"},{"id":33,"kind":2048,"name":"getMaxListeners","url":"classes/buttonservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ButtonService"},{"id":34,"kind":128,"name":"LedService","url":"classes/ledservice.html","classes":"tsd-kind-class"},{"id":35,"kind":2048,"name":"writeText","url":"classes/ledservice.html#writetext","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":36,"kind":2048,"name":"readMatrixState","url":"classes/ledservice.html#readmatrixstate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":37,"kind":2048,"name":"writeMatrixState","url":"classes/ledservice.html#writematrixstate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":38,"kind":2048,"name":"getScrollingDelay","url":"classes/ledservice.html#getscrollingdelay","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":39,"kind":2048,"name":"setScrollingDelay","url":"classes/ledservice.html#setscrollingdelay","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LedService"},{"id":40,"kind":4194304,"name":"LedMatrix","url":"globals.html#ledmatrix","classes":"tsd-kind-type-alias"},{"id":41,"kind":256,"name":"TemperatureEvents","url":"interfaces/temperatureevents.html","classes":"tsd-kind-interface"},{"id":42,"kind":1024,"name":"temperaturechanged","url":"interfaces/temperatureevents.html#temperaturechanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TemperatureEvents"},{"id":43,"kind":128,"name":"TemperatureService","url":"classes/temperatureservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":44,"kind":2048,"name":"readTemperature","url":"classes/temperatureservice.html#readtemperature","classes":"tsd-kind-method tsd-parent-kind-class","parent":"TemperatureService"},{"id":45,"kind":2048,"name":"getTemperaturePeriod","url":"classes/temperatureservice.html#gettemperatureperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"TemperatureService"},{"id":46,"kind":2048,"name":"setTemperaturePeriod","url":"classes/temperatureservice.html#settemperatureperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"TemperatureService"},{"id":47,"kind":2048,"name":"addEventListener","url":"classes/temperatureservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":48,"kind":2048,"name":"removeEventListener","url":"classes/temperatureservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":49,"kind":2048,"name":"dispatchEvent","url":"classes/temperatureservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":50,"kind":2048,"name":"addListener","url":"classes/temperatureservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":51,"kind":2048,"name":"on","url":"classes/temperatureservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":52,"kind":2048,"name":"once","url":"classes/temperatureservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":53,"kind":2048,"name":"prependListener","url":"classes/temperatureservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":54,"kind":2048,"name":"prependOnceListener","url":"classes/temperatureservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":55,"kind":2048,"name":"removeListener","url":"classes/temperatureservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":56,"kind":2048,"name":"removeAllListeners","url":"classes/temperatureservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":57,"kind":2048,"name":"listeners","url":"classes/temperatureservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":58,"kind":2048,"name":"emit","url":"classes/temperatureservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":59,"kind":2048,"name":"eventNames","url":"classes/temperatureservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":60,"kind":2048,"name":"listenerCount","url":"classes/temperatureservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"TemperatureService"},{"id":61,"kind":2048,"name":"setMaxListeners","url":"classes/temperatureservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TemperatureService"},{"id":62,"kind":2048,"name":"getMaxListeners","url":"classes/temperatureservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TemperatureService"},{"id":63,"kind":256,"name":"AccelerometerData","url":"interfaces/accelerometerdata.html","classes":"tsd-kind-interface"},{"id":64,"kind":1024,"name":"x","url":"interfaces/accelerometerdata.html#x","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerData"},{"id":65,"kind":1024,"name":"y","url":"interfaces/accelerometerdata.html#y","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerData"},{"id":66,"kind":1024,"name":"z","url":"interfaces/accelerometerdata.html#z","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerData"},{"id":67,"kind":256,"name":"AccelerometerEvents","url":"interfaces/accelerometerevents.html","classes":"tsd-kind-interface"},{"id":68,"kind":1024,"name":"accelerometerdatachanged","url":"interfaces/accelerometerevents.html#accelerometerdatachanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AccelerometerEvents"},{"id":69,"kind":128,"name":"AccelerometerService","url":"classes/accelerometerservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":70,"kind":2048,"name":"readAccelerometerData","url":"classes/accelerometerservice.html#readaccelerometerdata","classes":"tsd-kind-method tsd-parent-kind-class","parent":"AccelerometerService"},{"id":71,"kind":2048,"name":"getAccelerometerPeriod","url":"classes/accelerometerservice.html#getaccelerometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"AccelerometerService"},{"id":72,"kind":2048,"name":"setAccelerometerPeriod","url":"classes/accelerometerservice.html#setaccelerometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"AccelerometerService"},{"id":73,"kind":2048,"name":"addEventListener","url":"classes/accelerometerservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":74,"kind":2048,"name":"removeEventListener","url":"classes/accelerometerservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":75,"kind":2048,"name":"dispatchEvent","url":"classes/accelerometerservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":76,"kind":2048,"name":"addListener","url":"classes/accelerometerservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":77,"kind":2048,"name":"on","url":"classes/accelerometerservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":78,"kind":2048,"name":"once","url":"classes/accelerometerservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":79,"kind":2048,"name":"prependListener","url":"classes/accelerometerservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":80,"kind":2048,"name":"prependOnceListener","url":"classes/accelerometerservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":81,"kind":2048,"name":"removeListener","url":"classes/accelerometerservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":82,"kind":2048,"name":"removeAllListeners","url":"classes/accelerometerservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":83,"kind":2048,"name":"listeners","url":"classes/accelerometerservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":84,"kind":2048,"name":"emit","url":"classes/accelerometerservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":85,"kind":2048,"name":"eventNames","url":"classes/accelerometerservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":86,"kind":2048,"name":"listenerCount","url":"classes/accelerometerservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"AccelerometerService"},{"id":87,"kind":2048,"name":"setMaxListeners","url":"classes/accelerometerservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"AccelerometerService"},{"id":88,"kind":2048,"name":"getMaxListeners","url":"classes/accelerometerservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"AccelerometerService"},{"id":89,"kind":4194304,"name":"AccelerometerPeriod","url":"globals.html#accelerometerperiod","classes":"tsd-kind-type-alias"},{"id":90,"kind":256,"name":"MagnetometerData","url":"interfaces/magnetometerdata.html","classes":"tsd-kind-interface"},{"id":91,"kind":1024,"name":"x","url":"interfaces/magnetometerdata.html#x","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerData"},{"id":92,"kind":1024,"name":"y","url":"interfaces/magnetometerdata.html#y","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerData"},{"id":93,"kind":1024,"name":"z","url":"interfaces/magnetometerdata.html#z","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerData"},{"id":94,"kind":4,"name":"MagnetometerCalibration","url":"enums/magnetometercalibration.html","classes":"tsd-kind-enum"},{"id":95,"kind":16,"name":"unknown","url":"enums/magnetometercalibration.html#unknown","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":96,"kind":16,"name":"requested","url":"enums/magnetometercalibration.html#requested","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":97,"kind":16,"name":"completed","url":"enums/magnetometercalibration.html#completed","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":98,"kind":16,"name":"errored","url":"enums/magnetometercalibration.html#errored","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"MagnetometerCalibration"},{"id":99,"kind":256,"name":"MagnetometerEvents","url":"interfaces/magnetometerevents.html","classes":"tsd-kind-interface"},{"id":100,"kind":1024,"name":"magnetometerdatachanged","url":"interfaces/magnetometerevents.html#magnetometerdatachanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":101,"kind":1024,"name":"magnetometerbearingchanged","url":"interfaces/magnetometerevents.html#magnetometerbearingchanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":102,"kind":1024,"name":"magnetometercalibrationchanged","url":"interfaces/magnetometerevents.html#magnetometercalibrationchanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MagnetometerEvents"},{"id":103,"kind":128,"name":"MagnetometerService","url":"classes/magnetometerservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":104,"kind":2048,"name":"calibrate","url":"classes/magnetometerservice.html#calibrate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":105,"kind":2048,"name":"readMagnetometerData","url":"classes/magnetometerservice.html#readmagnetometerdata","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":106,"kind":2048,"name":"readMagnetometerBearing","url":"classes/magnetometerservice.html#readmagnetometerbearing","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":107,"kind":2048,"name":"getMagnetometerPeriod","url":"classes/magnetometerservice.html#getmagnetometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":108,"kind":2048,"name":"setMagnetometerPeriod","url":"classes/magnetometerservice.html#setmagnetometerperiod","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MagnetometerService"},{"id":109,"kind":2048,"name":"addEventListener","url":"classes/magnetometerservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":110,"kind":2048,"name":"removeEventListener","url":"classes/magnetometerservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":111,"kind":2048,"name":"dispatchEvent","url":"classes/magnetometerservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":112,"kind":2048,"name":"addListener","url":"classes/magnetometerservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":113,"kind":2048,"name":"on","url":"classes/magnetometerservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":114,"kind":2048,"name":"once","url":"classes/magnetometerservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":115,"kind":2048,"name":"prependListener","url":"classes/magnetometerservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":116,"kind":2048,"name":"prependOnceListener","url":"classes/magnetometerservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":117,"kind":2048,"name":"removeListener","url":"classes/magnetometerservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":118,"kind":2048,"name":"removeAllListeners","url":"classes/magnetometerservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":119,"kind":2048,"name":"listeners","url":"classes/magnetometerservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":120,"kind":2048,"name":"emit","url":"classes/magnetometerservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":121,"kind":2048,"name":"eventNames","url":"classes/magnetometerservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":122,"kind":2048,"name":"listenerCount","url":"classes/magnetometerservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"MagnetometerService"},{"id":123,"kind":2048,"name":"setMaxListeners","url":"classes/magnetometerservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MagnetometerService"},{"id":124,"kind":2048,"name":"getMaxListeners","url":"classes/magnetometerservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MagnetometerService"},{"id":125,"kind":4194304,"name":"MagnetometerPeriod","url":"globals.html#magnetometerperiod","classes":"tsd-kind-type-alias"},{"id":126,"kind":256,"name":"UartEvents","url":"interfaces/uartevents.html","classes":"tsd-kind-interface"},{"id":127,"kind":1024,"name":"receive","url":"interfaces/uartevents.html#receive","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"UartEvents"},{"id":128,"kind":1024,"name":"receiveText","url":"interfaces/uartevents.html#receivetext","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"UartEvents"},{"id":129,"kind":128,"name":"UartService","url":"classes/uartservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":130,"kind":2048,"name":"send","url":"classes/uartservice.html#send","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UartService"},{"id":131,"kind":2048,"name":"sendText","url":"classes/uartservice.html#sendtext","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UartService"},{"id":132,"kind":2048,"name":"addEventListener","url":"classes/uartservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":133,"kind":2048,"name":"removeEventListener","url":"classes/uartservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":134,"kind":2048,"name":"dispatchEvent","url":"classes/uartservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":135,"kind":2048,"name":"addListener","url":"classes/uartservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":136,"kind":2048,"name":"on","url":"classes/uartservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":137,"kind":2048,"name":"once","url":"classes/uartservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":138,"kind":2048,"name":"prependListener","url":"classes/uartservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":139,"kind":2048,"name":"prependOnceListener","url":"classes/uartservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":140,"kind":2048,"name":"removeListener","url":"classes/uartservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":141,"kind":2048,"name":"removeAllListeners","url":"classes/uartservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":142,"kind":2048,"name":"listeners","url":"classes/uartservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":143,"kind":2048,"name":"emit","url":"classes/uartservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":144,"kind":2048,"name":"eventNames","url":"classes/uartservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":145,"kind":2048,"name":"listenerCount","url":"classes/uartservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"UartService"},{"id":146,"kind":2048,"name":"setMaxListeners","url":"classes/uartservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"UartService"},{"id":147,"kind":2048,"name":"getMaxListeners","url":"classes/uartservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"UartService"},{"id":148,"kind":256,"name":"MicrobitEvent","url":"interfaces/microbitevent.html","classes":"tsd-kind-interface"},{"id":149,"kind":1024,"name":"type","url":"interfaces/microbitevent.html#type","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvent"},{"id":150,"kind":1024,"name":"value","url":"interfaces/microbitevent.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvent"},{"id":151,"kind":256,"name":"MicrobitEvents","url":"interfaces/microbitevents.html","classes":"tsd-kind-interface"},{"id":152,"kind":1024,"name":"microbitrequirementschanged","url":"interfaces/microbitevents.html#microbitrequirementschanged","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvents"},{"id":153,"kind":1024,"name":"microbitevent","url":"interfaces/microbitevents.html#microbitevent","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MicrobitEvents"},{"id":154,"kind":128,"name":"EventService","url":"classes/eventservice.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":155,"kind":2048,"name":"getMicrobitRequirements","url":"classes/eventservice.html#getmicrobitrequirements","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":156,"kind":2048,"name":"setClientRequirements","url":"classes/eventservice.html#setclientrequirements","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":157,"kind":2048,"name":"readMicrobitEvent","url":"classes/eventservice.html#readmicrobitevent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":158,"kind":2048,"name":"writeClientEvent","url":"classes/eventservice.html#writeclientevent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"EventService"},{"id":159,"kind":2048,"name":"addEventListener","url":"classes/eventservice.html#addeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":160,"kind":2048,"name":"removeEventListener","url":"classes/eventservice.html#removeeventlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":161,"kind":2048,"name":"dispatchEvent","url":"classes/eventservice.html#dispatchevent","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":162,"kind":2048,"name":"addListener","url":"classes/eventservice.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":163,"kind":2048,"name":"on","url":"classes/eventservice.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":164,"kind":2048,"name":"once","url":"classes/eventservice.html#once","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":165,"kind":2048,"name":"prependListener","url":"classes/eventservice.html#prependlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":166,"kind":2048,"name":"prependOnceListener","url":"classes/eventservice.html#prependoncelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":167,"kind":2048,"name":"removeListener","url":"classes/eventservice.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":168,"kind":2048,"name":"removeAllListeners","url":"classes/eventservice.html#removealllisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":169,"kind":2048,"name":"listeners","url":"classes/eventservice.html#listeners","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":170,"kind":2048,"name":"emit","url":"classes/eventservice.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":171,"kind":2048,"name":"eventNames","url":"classes/eventservice.html#eventnames","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":172,"kind":2048,"name":"listenerCount","url":"classes/eventservice.html#listenercount","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"EventService"},{"id":173,"kind":2048,"name":"setMaxListeners","url":"classes/eventservice.html#setmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"EventService"},{"id":174,"kind":2048,"name":"getMaxListeners","url":"classes/eventservice.html#getmaxlisteners","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"EventService"},{"id":175,"kind":256,"name":"Services","url":"interfaces/services.html","classes":"tsd-kind-interface"},{"id":176,"kind":1024,"name":"deviceInformationService","url":"interfaces/services.html#deviceinformationservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":177,"kind":1024,"name":"buttonService","url":"interfaces/services.html#buttonservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":178,"kind":1024,"name":"ledService","url":"interfaces/services.html#ledservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":179,"kind":1024,"name":"temperatureService","url":"interfaces/services.html#temperatureservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":180,"kind":1024,"name":"accelerometerService","url":"interfaces/services.html#accelerometerservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":181,"kind":1024,"name":"magnetometerService","url":"interfaces/services.html#magnetometerservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":182,"kind":1024,"name":"uartService","url":"interfaces/services.html#uartservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":183,"kind":1024,"name":"eventService","url":"interfaces/services.html#eventservice","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Services"},{"id":184,"kind":64,"name":"requestMicrobit","url":"globals.html#requestmicrobit","classes":"tsd-kind-function"},{"id":185,"kind":64,"name":"getServices","url":"globals.html#getservices","classes":"tsd-kind-function"}]}; |
{ | ||
"name": "microbit-web-bluetooth", | ||
"version": "0.2.1-next.ca1cdfd.0", | ||
"version": "0.3.0", | ||
"description": "Web Bluetooth library for micro:bit", | ||
@@ -45,5 +45,5 @@ "homepage": "https://github.com/thegecko/microbit-web-bluetooth", | ||
"dependencies": { | ||
"@types/web-bluetooth": "0.0.4", | ||
"@types/node": "8.10.40" | ||
"@types/node": "8.10.40", | ||
"@types/web-bluetooth": "~0.0.4" | ||
} | ||
} |
# micro:bit Web Bluetooth | ||
[![Circle CI](https://circleci.com/gh/thegecko/microbit-web-bluetooth.svg?style=shield&circle-token=a6f81fc05746394a595d8fe2b7c02eaf3120794b)](https://circleci.com/gh/thegecko/microbit-web-bluetooth/) | ||
[![npm](https://img.shields.io/npm/dm/microbit-web-bluetooth.svg)](https://www.npmjs.com/package/microbit-web-bluetooth) | ||
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html) | ||
@@ -5,0 +6,0 @@ |
@@ -48,2 +48,5 @@ /* | ||
/** | ||
* @hidden | ||
*/ | ||
interface Service { | ||
@@ -54,2 +57,5 @@ uuid: BluetoothCharacteristicUUID; | ||
/** | ||
* @hidden | ||
*/ | ||
class ServiceBuilder { | ||
@@ -56,0 +62,0 @@ |
@@ -27,3 +27,7 @@ /* | ||
import { EventEmitter } from "events"; | ||
import { PromiseQueue } from "./promise-queue"; | ||
/** | ||
* @hidden | ||
*/ | ||
export interface ServiceEventHandler { | ||
@@ -34,12 +38,20 @@ characteristic: BluetoothCharacteristicUUID; | ||
/** | ||
* @hidden | ||
*/ | ||
export class ServiceHelper { | ||
private static queue = new PromiseQueue(); | ||
private characteristics?: BluetoothRemoteGATTCharacteristic[]; | ||
constructor(private service: BluetoothRemoteGATTService, private emitter?: EventEmitter) { | ||
} | ||
private async getCharacteristic(characteristic: BluetoothCharacteristicUUID): Promise<BluetoothRemoteGATTCharacteristic | undefined> { | ||
try { | ||
return await this.service.getCharacteristic(characteristic); | ||
} catch (e) { | ||
return undefined; | ||
private async getCharacteristic(uuid: BluetoothCharacteristicUUID): Promise<BluetoothRemoteGATTCharacteristic | undefined> { | ||
if (!this.characteristics) { | ||
this.characteristics = await this.service.getCharacteristics(); | ||
} | ||
return this.characteristics.find(characteristic => characteristic.uuid === uuid); | ||
} | ||
@@ -54,3 +66,3 @@ | ||
return await characteristic.readValue(); | ||
return await ServiceHelper.queue.add(async () => characteristic.readValue()); | ||
} | ||
@@ -65,3 +77,3 @@ | ||
return characteristic.writeValue(value); | ||
await ServiceHelper.queue.add(async () => characteristic.writeValue(value)); | ||
} | ||
@@ -76,3 +88,3 @@ | ||
await characteristic.startNotifications(); | ||
await ServiceHelper.queue.add(async () => characteristic.startNotifications()); | ||
@@ -84,3 +96,3 @@ this.emitter!.on("newListener", (emitterEvent: string) => { | ||
characteristic.addEventListener("characteristicvaluechanged", handler); | ||
return ServiceHelper.queue.add(async () => characteristic.addEventListener("characteristicvaluechanged", handler)); | ||
}); | ||
@@ -93,5 +105,5 @@ | ||
characteristic.removeEventListener("characteristicvaluechanged", handler); | ||
return ServiceHelper.queue.add(async () => characteristic.removeEventListener("characteristicvaluechanged", handler)); | ||
}); | ||
} | ||
} |
@@ -37,16 +37,46 @@ /* | ||
/** | ||
* Data received from the accelerometer | ||
*/ | ||
export interface AccelerometerData { | ||
/** | ||
* Force in direction X | ||
*/ | ||
x: number; | ||
/** | ||
* Force in direction Y | ||
*/ | ||
y: number; | ||
/** | ||
* Force in direction Z | ||
*/ | ||
z: number; | ||
} | ||
/** | ||
* The sample period to read accelerometer data (milliseconds) | ||
*/ | ||
export type AccelerometerPeriod = 1 | 2 | 5 | 10 | 20 | 80 | 160 | 640; | ||
/** | ||
* Events raised by the accelerometer service | ||
*/ | ||
export interface AccelerometerEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof AccelerometerEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof AccelerometerEvents; | ||
/** | ||
* Accelerometer data changed event | ||
*/ | ||
accelerometerdatachanged: AccelerometerData; | ||
} | ||
/** | ||
* Accelerometer Service | ||
*/ | ||
export class AccelerometerService extends (EventDispatcher as new() => TypedDispatcher<AccelerometerEvents>) { | ||
@@ -70,2 +100,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -80,2 +113,5 @@ super(); | ||
/** | ||
* Read acceleromter data | ||
*/ | ||
public async readAccelerometerData(): Promise<AccelerometerData> { | ||
@@ -86,2 +122,5 @@ const view = await this.helper.getCharacteristicValue(AccelerometerCharacteristic.accelerometerData); | ||
/** | ||
* Get accelerometer sample period | ||
*/ | ||
public async getAccelerometerPeriod(): Promise<AccelerometerPeriod> { | ||
@@ -92,2 +131,6 @@ const value = await this.helper.getCharacteristicValue(AccelerometerCharacteristic.accelerometerPeriod); | ||
/** | ||
* Set accelerometer sample period | ||
* @param frequency The frequency interval to use | ||
*/ | ||
public async setAccelerometerPeriod(frequency: AccelerometerPeriod): Promise<void> { | ||
@@ -94,0 +137,0 @@ const view = new DataView(new ArrayBuffer(2)); |
@@ -37,15 +37,45 @@ /* | ||
/** | ||
* Button state enum | ||
*/ | ||
export enum ButtonState { | ||
/** | ||
* Button released | ||
*/ | ||
Release = 0, | ||
/** | ||
* Button pressed - short | ||
*/ | ||
ShortPress = 1, | ||
/** | ||
* Button pressed - long | ||
*/ | ||
LongPress = 2 | ||
} | ||
/** | ||
* Events raised by the button service | ||
*/ | ||
export interface ButtonEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof ButtonEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof ButtonEvents; | ||
/** | ||
* Button A state changed event | ||
*/ | ||
buttonastatechanged: ButtonState; | ||
/** | ||
* Button B state changed event | ||
*/ | ||
buttonbstatechanged: ButtonState; | ||
} | ||
/** | ||
* Button Service | ||
*/ | ||
export class ButtonService extends (EventDispatcher as new() => TypedDispatcher<ButtonEvents>) { | ||
@@ -69,2 +99,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -80,2 +113,5 @@ super(); | ||
/** | ||
* Read state of button A | ||
*/ | ||
public async readButtonAState(): Promise<ButtonState> { | ||
@@ -86,2 +122,5 @@ const value = await this.helper.getCharacteristicValue(ButtonCharacteristic.buttonAState); | ||
/** | ||
* Read state of button B | ||
*/ | ||
public async readButtonBState(): Promise<ButtonState> { | ||
@@ -88,0 +127,0 @@ const value = await this.helper.getCharacteristicValue(ButtonCharacteristic.buttonBState); |
@@ -39,10 +39,31 @@ /* | ||
/** | ||
* Device information structure | ||
*/ | ||
export interface DeviceInformation { | ||
/** | ||
* Model Number | ||
*/ | ||
modelNumber?: string; | ||
/** | ||
* Serial Number | ||
*/ | ||
serialNumber?: string; | ||
/** | ||
* Firmware Revision | ||
*/ | ||
firmwareRevision?: string; | ||
/** | ||
* Hardware Revision | ||
*/ | ||
hardwareRevision?: string; | ||
/** | ||
* Manufacturer Name | ||
*/ | ||
manufacturer?: string; | ||
} | ||
/** | ||
* Device Information Service | ||
*/ | ||
export class DeviceInformationService { | ||
@@ -64,2 +85,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -69,2 +93,5 @@ this.helper = new ServiceHelper(service); | ||
/** | ||
* Read device information | ||
*/ | ||
public async readDeviceInformation(): Promise<DeviceInformation> { | ||
@@ -71,0 +98,0 @@ const info: DeviceInformation = {}; |
@@ -35,2 +35,5 @@ /* | ||
/** | ||
* @hidden | ||
*/ | ||
export class DfuControlService { | ||
@@ -50,4 +53,10 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
public helper: ServiceHelper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -54,0 +63,0 @@ this.helper = new ServiceHelper(service); |
@@ -39,14 +39,41 @@ /* | ||
/** | ||
* micro:bit event | ||
*/ | ||
export interface MicrobitEvent { | ||
/** | ||
* The type of event | ||
*/ | ||
type: number; | ||
/** | ||
* The value for the event | ||
*/ | ||
value: number; | ||
} | ||
/** | ||
* Events raised by the event service | ||
*/ | ||
export interface MicrobitEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof MicrobitEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof MicrobitEvents; | ||
/** | ||
* micro:bit requirements changed event | ||
*/ | ||
microbitrequirementschanged: MicrobitEvent; | ||
/** | ||
* micro:bit event event | ||
*/ | ||
microbitevent: MicrobitEvent; | ||
} | ||
/** | ||
* Event Service | ||
*/ | ||
export class EventService extends (EventDispatcher as new() => TypedDispatcher<MicrobitEvents>) { | ||
@@ -70,2 +97,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -81,2 +111,5 @@ super(); | ||
/** | ||
* Get micro:bit event requirements | ||
*/ | ||
public async getMicrobitRequirements(): Promise<MicrobitEvent> { | ||
@@ -87,2 +120,7 @@ const value = await this.helper.getCharacteristicValue(EventCharacteristic.microBitRequirements); | ||
/** | ||
* Set client event requirements | ||
* @param type The type of event to set | ||
* @param value The value to set | ||
*/ | ||
public async setClientRequirements(type: number, value: number): Promise<void> { | ||
@@ -95,2 +133,5 @@ const view = new DataView(new ArrayBuffer(4)); | ||
/** | ||
* Read micro:bit event | ||
*/ | ||
public async readMicrobitEvent(): Promise<MicrobitEvent> { | ||
@@ -101,2 +142,7 @@ const value = await this.helper.getCharacteristicValue(EventCharacteristic.microBitEvent); | ||
/** | ||
* Write client event | ||
* @param type The event type | ||
* @param value The event value | ||
*/ | ||
public async writeClientEvent(type: number, value: number): Promise<void> { | ||
@@ -103,0 +149,0 @@ const view = new DataView(new ArrayBuffer(4)); |
@@ -38,2 +38,5 @@ /* | ||
/** | ||
* @hidden | ||
*/ | ||
export class IoPinService { | ||
@@ -53,4 +56,10 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
public helper: ServiceHelper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -57,0 +66,0 @@ this.helper = new ServiceHelper(service); |
@@ -37,2 +37,5 @@ /* | ||
/** | ||
* LED matrix structure | ||
*/ | ||
export type LedMatrix = [ | ||
@@ -46,2 +49,5 @@ [boolean, boolean, boolean, boolean, boolean], | ||
/** | ||
* LED Service | ||
*/ | ||
export class LedService { | ||
@@ -63,2 +69,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -68,2 +77,6 @@ this.helper = new ServiceHelper(service); | ||
/** | ||
* Write text to the LED matrix | ||
* @param text Te text to display | ||
*/ | ||
public async writeText(text: string): Promise<void> { | ||
@@ -74,3 +87,6 @@ const encoded = this.encodeString(text); | ||
public async getMatrixState(): Promise<LedMatrix> { | ||
/** | ||
* Read matrix state | ||
*/ | ||
public async readMatrixState(): Promise<LedMatrix> { | ||
const view = await this.helper.getCharacteristicValue(LedCharacteristic.ledMatrixState); | ||
@@ -80,3 +96,7 @@ return this.viewToLedMatrix(view); | ||
public async setMatrixState(state: LedMatrix): Promise<void> { | ||
/** | ||
* Write matrix state | ||
* @param state The matrix data to set | ||
*/ | ||
public async writeMatrixState(state: LedMatrix): Promise<void> { | ||
const view = this.ledMatrixToView(state); | ||
@@ -86,2 +106,5 @@ return this.helper.setCharacteristicValue(LedCharacteristic.ledMatrixState, view); | ||
/** | ||
* Get scrolling delay | ||
*/ | ||
public async getScrollingDelay(): Promise<number> { | ||
@@ -92,2 +115,6 @@ const value = await this.helper.getCharacteristicValue(LedCharacteristic.scrollingDelay); | ||
/** | ||
* Set scrolling delay | ||
* @param delay The delay to set (milliseconds) | ||
*/ | ||
public async setScrollingDelay(delay: number): Promise<void> { | ||
@@ -94,0 +121,0 @@ const view = new DataView(new ArrayBuffer(2)); |
@@ -39,25 +39,76 @@ /* | ||
/** | ||
* Data received from the magnetometer | ||
*/ | ||
export interface MagnetometerData { | ||
/** | ||
* Force in direction X | ||
*/ | ||
x: number; | ||
/** | ||
* Force in direction Y | ||
*/ | ||
y: number; | ||
/** | ||
* Force in direction Z | ||
*/ | ||
z: number; | ||
} | ||
/** | ||
* Magnetometer calibation state | ||
*/ | ||
export enum MagnetometerCalibration { | ||
/** | ||
* Unknown state | ||
*/ | ||
unknown = 0, | ||
/** | ||
* Calibration has been requestes | ||
*/ | ||
requested = 1, | ||
/** | ||
* Calibration completed | ||
*/ | ||
completed = 2, | ||
/** | ||
* Calibration had an error | ||
*/ | ||
errored = 3 | ||
} | ||
/** | ||
* The sample period to read magnetometer data (milliseconds) | ||
*/ | ||
export type MagnetometerPeriod = 1 | 2 | 5 | 10 | 20 | 80 | 160 | 640; | ||
/** | ||
* Events raised by the magnetometer service | ||
*/ | ||
export interface MagnetometerEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof MagnetometerEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof MagnetometerEvents; | ||
/** | ||
* Magnetometer data changed event | ||
*/ | ||
magnetometerdatachanged: MagnetometerData; | ||
/** | ||
* Magnetometer bearing changed event | ||
*/ | ||
magnetometerbearingchanged: number; | ||
/** | ||
* Magnetometer calibration changed event | ||
*/ | ||
magnetometercalibrationchanged: MagnetometerCalibration; | ||
} | ||
/** | ||
* Magnetometer Service | ||
*/ | ||
export class MagnetometerService extends (EventDispatcher as new() => TypedDispatcher<MagnetometerEvents>) { | ||
@@ -81,2 +132,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -93,2 +147,5 @@ super(); | ||
/** | ||
* Request magnetometer calibration | ||
*/ | ||
public async calibrate() { | ||
@@ -98,2 +155,5 @@ return this.helper.setCharacteristicValue(MagnetometerCharacteristic.magnetometerCalibration, new Uint8Array([1])); | ||
/** | ||
* Read magnetometer data | ||
*/ | ||
public async readMagnetometerData(): Promise<MagnetometerData> { | ||
@@ -104,3 +164,6 @@ const view = await this.helper.getCharacteristicValue(MagnetometerCharacteristic.magnetometerData); | ||
public async getMagnetometerBearing(): Promise<number | undefined> { | ||
/** | ||
* Read magnetometer bearing | ||
*/ | ||
public async readMagnetometerBearing(): Promise<number | undefined> { | ||
const view = await this.helper.getCharacteristicValue(MagnetometerCharacteristic.magnetometerBearing); | ||
@@ -113,2 +176,5 @@ if (view.byteLength === 2) { | ||
/** | ||
* Get magnetometer sample period | ||
*/ | ||
public async getMagnetometerPeriod(): Promise<MagnetometerPeriod> { | ||
@@ -119,2 +185,6 @@ const value = await this.helper.getCharacteristicValue(MagnetometerCharacteristic.magnetometerPeriod); | ||
/** | ||
* Set magnetometer sample period | ||
* @param frequency The frequency interval to use | ||
*/ | ||
public async setMagnetometerPeriod(frequency: MagnetometerPeriod): Promise<void> { | ||
@@ -121,0 +191,0 @@ const view = new DataView(new ArrayBuffer(2)); |
@@ -37,8 +37,23 @@ /* | ||
/** | ||
* Events raised by the temperature service | ||
*/ | ||
export interface TemperatureEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof TemperatureEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof TemperatureEvents; | ||
/** | ||
* Temperature changed event | ||
*/ | ||
temperaturechanged: number; | ||
} | ||
/** | ||
* Temperature Service | ||
*/ | ||
export class TemperatureService extends (EventDispatcher as new() => TypedDispatcher<TemperatureEvents>) { | ||
@@ -62,2 +77,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -72,2 +90,5 @@ super(); | ||
/** | ||
* Read temperature | ||
*/ | ||
public async readTemperature(): Promise<number> { | ||
@@ -78,2 +99,5 @@ const value = await this.helper.getCharacteristicValue(TemperatureCharacteristic.temperature); | ||
/** | ||
* Get temperature sample period | ||
*/ | ||
public async getTemperaturePeriod(): Promise<number> { | ||
@@ -84,2 +108,6 @@ const value = await this.helper.getCharacteristicValue(TemperatureCharacteristic.temperaturePeriod); | ||
/** | ||
* Set temperature sample period | ||
* @param frequency The frequency to use (milliseconds) | ||
*/ | ||
public async setTemperaturePeriod(frequency: number): Promise<void> { | ||
@@ -86,0 +114,0 @@ const view = new DataView(new ArrayBuffer(2)); |
@@ -37,9 +37,27 @@ /* | ||
/** | ||
* Events raised by the UART service | ||
*/ | ||
export interface UartEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof UartEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof UartEvents; | ||
/** | ||
* Serial data received event | ||
*/ | ||
receive: Uint8Array; | ||
receiveString: string; | ||
/** | ||
* Serial received text event | ||
*/ | ||
receiveText: string; | ||
} | ||
/** | ||
* UART Service | ||
*/ | ||
export class UartService extends (EventDispatcher as new() => TypedDispatcher<UartEvents>) { | ||
@@ -63,2 +81,5 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService) { | ||
@@ -71,5 +92,9 @@ super(); | ||
await this.helper.handleListener("receive", UartCharacteristic.tx, this.receiveHandler.bind(this)); | ||
await this.helper.handleListener("receiveString", UartCharacteristic.tx, this.receiveStringHandler.bind(this)); | ||
await this.helper.handleListener("receiveText", UartCharacteristic.tx, this.receiveTextHandler.bind(this)); | ||
} | ||
/** | ||
* Send serial data | ||
* @param value The buffer to send | ||
*/ | ||
public async send(value: BufferSource): Promise<void> { | ||
@@ -79,3 +104,7 @@ return this.helper.setCharacteristicValue(UartCharacteristic.rx, value); | ||
public async sendString(value: string): Promise<void> { | ||
/** | ||
* Send serial text | ||
* @param value The text to send | ||
*/ | ||
public async sendText(value: string): Promise<void> { | ||
const arrayData = value.split("").map((e: string) => e.charCodeAt(0)); | ||
@@ -91,8 +120,8 @@ return this.helper.setCharacteristicValue(UartCharacteristic.rx, new Uint8Array(arrayData).buffer); | ||
private receiveStringHandler(event: Event) { | ||
private receiveTextHandler(event: Event) { | ||
const view = (event.target as BluetoothRemoteGATTCharacteristic).value!; | ||
const numberArray = Array.prototype.slice.call(new Uint8Array(view.buffer)); | ||
const value = String.fromCharCode.apply(null, numberArray); | ||
this.dispatchEvent("receiveString", value); | ||
this.dispatchEvent("receiveText", value); | ||
} | ||
} |
{ | ||
"name": "micro:bit Web Bluetooth API Documentation", | ||
"readme": "./README.md", | ||
"readme": "./documentation.md", | ||
"theme": "./docs-theme", | ||
@@ -5,0 +5,0 @@ "module": "commonjs", |
/// <reference types="web-bluetooth" /> | ||
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
/** | ||
* @hidden | ||
*/ | ||
export interface ServiceEventHandler { | ||
@@ -8,5 +11,10 @@ characteristic: BluetoothCharacteristicUUID; | ||
} | ||
/** | ||
* @hidden | ||
*/ | ||
export declare class ServiceHelper { | ||
private service; | ||
private emitter?; | ||
private static queue; | ||
private characteristics?; | ||
constructor(service: BluetoothRemoteGATTService, emitter?: EventEmitter | undefined); | ||
@@ -13,0 +21,0 @@ private getCharacteristic; |
@@ -10,14 +10,44 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* Data received from the accelerometer | ||
*/ | ||
export interface AccelerometerData { | ||
/** | ||
* Force in direction X | ||
*/ | ||
x: number; | ||
/** | ||
* Force in direction Y | ||
*/ | ||
y: number; | ||
/** | ||
* Force in direction Z | ||
*/ | ||
z: number; | ||
} | ||
/** | ||
* The sample period to read accelerometer data (milliseconds) | ||
*/ | ||
export declare type AccelerometerPeriod = 1 | 2 | 5 | 10 | 20 | 80 | 160 | 640; | ||
/** | ||
* Events raised by the accelerometer service | ||
*/ | ||
export interface AccelerometerEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof AccelerometerEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof AccelerometerEvents; | ||
/** | ||
* Accelerometer data changed event | ||
*/ | ||
accelerometerdatachanged: AccelerometerData; | ||
} | ||
declare const AccelerometerService_base: new () => TypedDispatcher<AccelerometerEvents>; | ||
/** | ||
* Accelerometer Service | ||
*/ | ||
export declare class AccelerometerService extends AccelerometerService_base { | ||
@@ -33,6 +63,19 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
private init; | ||
/** | ||
* Read acceleromter data | ||
*/ | ||
readAccelerometerData(): Promise<AccelerometerData>; | ||
/** | ||
* Get accelerometer sample period | ||
*/ | ||
getAccelerometerPeriod(): Promise<AccelerometerPeriod>; | ||
/** | ||
* Set accelerometer sample period | ||
* @param frequency The frequency interval to use | ||
*/ | ||
setAccelerometerPeriod(frequency: AccelerometerPeriod): Promise<void>; | ||
@@ -39,0 +82,0 @@ private accelerometerDataChangedHandler; |
@@ -10,14 +10,44 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* Button state enum | ||
*/ | ||
export declare enum ButtonState { | ||
/** | ||
* Button released | ||
*/ | ||
Release = 0, | ||
/** | ||
* Button pressed - short | ||
*/ | ||
ShortPress = 1, | ||
/** | ||
* Button pressed - long | ||
*/ | ||
LongPress = 2 | ||
} | ||
/** | ||
* Events raised by the button service | ||
*/ | ||
export interface ButtonEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof ButtonEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof ButtonEvents; | ||
/** | ||
* Button A state changed event | ||
*/ | ||
buttonastatechanged: ButtonState; | ||
/** | ||
* Button B state changed event | ||
*/ | ||
buttonbstatechanged: ButtonState; | ||
} | ||
declare const ButtonService_base: new () => TypedDispatcher<ButtonEvents>; | ||
/** | ||
* Button Service | ||
*/ | ||
export declare class ButtonService extends ButtonService_base { | ||
@@ -33,5 +63,14 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
private init; | ||
/** | ||
* Read state of button A | ||
*/ | ||
readButtonAState(): Promise<ButtonState>; | ||
/** | ||
* Read state of button B | ||
*/ | ||
readButtonBState(): Promise<ButtonState>; | ||
@@ -38,0 +77,0 @@ private buttonAStateChangedHandler; |
@@ -12,9 +12,30 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* Device information structure | ||
*/ | ||
export interface DeviceInformation { | ||
/** | ||
* Model Number | ||
*/ | ||
modelNumber?: string; | ||
/** | ||
* Serial Number | ||
*/ | ||
serialNumber?: string; | ||
/** | ||
* Firmware Revision | ||
*/ | ||
firmwareRevision?: string; | ||
/** | ||
* Hardware Revision | ||
*/ | ||
hardwareRevision?: string; | ||
/** | ||
* Manufacturer Name | ||
*/ | ||
manufacturer?: string; | ||
} | ||
/** | ||
* Device Information Service | ||
*/ | ||
export declare class DeviceInformationService { | ||
@@ -30,5 +51,11 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
/** | ||
* Read device information | ||
*/ | ||
readDeviceInformation(): Promise<DeviceInformation>; | ||
private readStringCharacteristic; | ||
} |
@@ -9,2 +9,5 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* @hidden | ||
*/ | ||
export declare class DfuControlService { | ||
@@ -19,4 +22,10 @@ /** | ||
static create(service: BluetoothRemoteGATTService): Promise<DfuControlService>; | ||
/** | ||
* @hidden | ||
*/ | ||
helper: ServiceHelper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
} |
@@ -12,13 +12,40 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* micro:bit event | ||
*/ | ||
export interface MicrobitEvent { | ||
/** | ||
* The type of event | ||
*/ | ||
type: number; | ||
/** | ||
* The value for the event | ||
*/ | ||
value: number; | ||
} | ||
/** | ||
* Events raised by the event service | ||
*/ | ||
export interface MicrobitEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof MicrobitEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof MicrobitEvents; | ||
/** | ||
* micro:bit requirements changed event | ||
*/ | ||
microbitrequirementschanged: MicrobitEvent; | ||
/** | ||
* micro:bit event event | ||
*/ | ||
microbitevent: MicrobitEvent; | ||
} | ||
declare const EventService_base: new () => TypedDispatcher<MicrobitEvents>; | ||
/** | ||
* Event Service | ||
*/ | ||
export declare class EventService extends EventService_base { | ||
@@ -34,7 +61,26 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
private init; | ||
/** | ||
* Get micro:bit event requirements | ||
*/ | ||
getMicrobitRequirements(): Promise<MicrobitEvent>; | ||
/** | ||
* Set client event requirements | ||
* @param type The type of event to set | ||
* @param value The value to set | ||
*/ | ||
setClientRequirements(type: number, value: number): Promise<void>; | ||
/** | ||
* Read micro:bit event | ||
*/ | ||
readMicrobitEvent(): Promise<MicrobitEvent>; | ||
/** | ||
* Write client event | ||
* @param type The event type | ||
* @param value The event value | ||
*/ | ||
writeClientEvent(type: number, value: number): Promise<void>; | ||
@@ -41,0 +87,0 @@ private microbitRequirementsChangedHandler; |
@@ -12,2 +12,5 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* @hidden | ||
*/ | ||
export declare class IoPinService { | ||
@@ -22,4 +25,10 @@ /** | ||
static create(service: BluetoothRemoteGATTService): Promise<IoPinService>; | ||
/** | ||
* @hidden | ||
*/ | ||
helper: ServiceHelper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
} |
@@ -10,3 +10,9 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* LED matrix structure | ||
*/ | ||
export declare type LedMatrix = [[boolean, boolean, boolean, boolean, boolean], [boolean, boolean, boolean, boolean, boolean], [boolean, boolean, boolean, boolean, boolean], [boolean, boolean, boolean, boolean, boolean], [boolean, boolean, boolean, boolean, boolean]]; | ||
/** | ||
* LED Service | ||
*/ | ||
export declare class LedService { | ||
@@ -22,7 +28,28 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
/** | ||
* Write text to the LED matrix | ||
* @param text Te text to display | ||
*/ | ||
writeText(text: string): Promise<void>; | ||
getMatrixState(): Promise<LedMatrix>; | ||
setMatrixState(state: LedMatrix): Promise<void>; | ||
/** | ||
* Read matrix state | ||
*/ | ||
readMatrixState(): Promise<LedMatrix>; | ||
/** | ||
* Write matrix state | ||
* @param state The matrix data to set | ||
*/ | ||
writeMatrixState(state: LedMatrix): Promise<void>; | ||
/** | ||
* Get scrolling delay | ||
*/ | ||
getScrollingDelay(): Promise<number>; | ||
/** | ||
* Set scrolling delay | ||
* @param delay The delay to set (milliseconds) | ||
*/ | ||
setScrollingDelay(delay: number): Promise<void>; | ||
@@ -29,0 +56,0 @@ private encodeString; |
@@ -12,22 +12,73 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* Data received from the magnetometer | ||
*/ | ||
export interface MagnetometerData { | ||
/** | ||
* Force in direction X | ||
*/ | ||
x: number; | ||
/** | ||
* Force in direction Y | ||
*/ | ||
y: number; | ||
/** | ||
* Force in direction Z | ||
*/ | ||
z: number; | ||
} | ||
/** | ||
* Magnetometer calibation state | ||
*/ | ||
export declare enum MagnetometerCalibration { | ||
/** | ||
* Unknown state | ||
*/ | ||
unknown = 0, | ||
/** | ||
* Calibration has been requestes | ||
*/ | ||
requested = 1, | ||
/** | ||
* Calibration completed | ||
*/ | ||
completed = 2, | ||
/** | ||
* Calibration had an error | ||
*/ | ||
errored = 3 | ||
} | ||
/** | ||
* The sample period to read magnetometer data (milliseconds) | ||
*/ | ||
export declare type MagnetometerPeriod = 1 | 2 | 5 | 10 | 20 | 80 | 160 | 640; | ||
/** | ||
* Events raised by the magnetometer service | ||
*/ | ||
export interface MagnetometerEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof MagnetometerEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof MagnetometerEvents; | ||
/** | ||
* Magnetometer data changed event | ||
*/ | ||
magnetometerdatachanged: MagnetometerData; | ||
/** | ||
* Magnetometer bearing changed event | ||
*/ | ||
magnetometerbearingchanged: number; | ||
/** | ||
* Magnetometer calibration changed event | ||
*/ | ||
magnetometercalibrationchanged: MagnetometerCalibration; | ||
} | ||
declare const MagnetometerService_base: new () => TypedDispatcher<MagnetometerEvents>; | ||
/** | ||
* Magnetometer Service | ||
*/ | ||
export declare class MagnetometerService extends MagnetometerService_base { | ||
@@ -43,8 +94,27 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
private init; | ||
/** | ||
* Request magnetometer calibration | ||
*/ | ||
calibrate(): Promise<void>; | ||
/** | ||
* Read magnetometer data | ||
*/ | ||
readMagnetometerData(): Promise<MagnetometerData>; | ||
getMagnetometerBearing(): Promise<number | undefined>; | ||
/** | ||
* Read magnetometer bearing | ||
*/ | ||
readMagnetometerBearing(): Promise<number | undefined>; | ||
/** | ||
* Get magnetometer sample period | ||
*/ | ||
getMagnetometerPeriod(): Promise<MagnetometerPeriod>; | ||
/** | ||
* Set magnetometer sample period | ||
* @param frequency The frequency interval to use | ||
*/ | ||
setMagnetometerPeriod(frequency: MagnetometerPeriod): Promise<void>; | ||
@@ -51,0 +121,0 @@ private magnetometerDataChangedHandler; |
@@ -10,8 +10,23 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* Events raised by the temperature service | ||
*/ | ||
export interface TemperatureEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof TemperatureEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof TemperatureEvents; | ||
/** | ||
* Temperature changed event | ||
*/ | ||
temperaturechanged: number; | ||
} | ||
declare const TemperatureService_base: new () => TypedDispatcher<TemperatureEvents>; | ||
/** | ||
* Temperature Service | ||
*/ | ||
export declare class TemperatureService extends TemperatureService_base { | ||
@@ -27,6 +42,19 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
private init; | ||
/** | ||
* Read temperature | ||
*/ | ||
readTemperature(): Promise<number>; | ||
/** | ||
* Get temperature sample period | ||
*/ | ||
getTemperaturePeriod(): Promise<number>; | ||
/** | ||
* Set temperature sample period | ||
* @param frequency The frequency to use (milliseconds) | ||
*/ | ||
setTemperaturePeriod(frequency: number): Promise<void>; | ||
@@ -33,0 +61,0 @@ private temperatureChangedHandler; |
@@ -10,9 +10,27 @@ /// <reference types="web-bluetooth" /> | ||
} | ||
/** | ||
* Events raised by the UART service | ||
*/ | ||
export interface UartEvents { | ||
/** | ||
* @hidden | ||
*/ | ||
newListener: keyof UartEvents; | ||
/** | ||
* @hidden | ||
*/ | ||
removeListener: keyof UartEvents; | ||
/** | ||
* Serial data received event | ||
*/ | ||
receive: Uint8Array; | ||
receiveString: string; | ||
/** | ||
* Serial received text event | ||
*/ | ||
receiveText: string; | ||
} | ||
declare const UartService_base: new () => TypedDispatcher<UartEvents>; | ||
/** | ||
* UART Service | ||
*/ | ||
export declare class UartService extends UartService_base { | ||
@@ -28,9 +46,20 @@ /** | ||
private helper; | ||
/** | ||
* @hidden | ||
*/ | ||
constructor(service: BluetoothRemoteGATTService); | ||
private init; | ||
/** | ||
* Send serial data | ||
* @param value The buffer to send | ||
*/ | ||
send(value: BufferSource): Promise<void>; | ||
sendString(value: string): Promise<void>; | ||
/** | ||
* Send serial text | ||
* @param value The text to send | ||
*/ | ||
sendText(value: string): Promise<void>; | ||
private receiveHandler; | ||
private receiveStringHandler; | ||
private receiveTextHandler; | ||
} | ||
export {}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3842
80
1214816
70
+ Added@types/web-bluetooth@0.0.20(transitive)
- Removed@types/web-bluetooth@0.0.4(transitive)
Updated@types/web-bluetooth@~0.0.4