@sfourdrinier/react-native-ble-plx
Version:
React Native Bluetooth Low Energy library
1 lines • 28.5 kB
JavaScript
'use strict';var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.BleManager=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _Device=require("./Device");var _Service=require("./Service");var _Characteristic=require("./Characteristic");var _Descriptor=require("./Descriptor");var _TypeDefinition=require("./TypeDefinition");var _BleModule=require("./BleModule");var _BleError=require("./BleError");var _Utils=require("./Utils");var _reactNative=require("react-native");var enableDisableDeprecatedMessage='react-native-ble-plx: The enable and disable feature is no longer supported. In Android SDK 31+ there were major changes in permissions, which may cause problems with these functions, and in SDK 33+ they were completely removed.';var BleManager=exports.BleManager=function(){function BleManager(){var _this=this;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};(0,_classCallCheck2.default)(this,BleManager);if(BleManager.sharedInstance!==null){return BleManager.sharedInstance;}this._eventEmitter=new _BleModule.EventEmitter(_BleModule.BleModule);this._uniqueId=0;this._activePromises={};this._activeSubscriptions={};var restoreStateFunction=options.restoreStateFunction;if(restoreStateFunction!=null&&options.restoreStateIdentifier!=null){this._activeSubscriptions[this._nextUniqueID()]=this._eventEmitter.addListener(_BleModule.BleModule.RestoreStateEvent,function(nativeRestoredState){if(nativeRestoredState==null){restoreStateFunction(null);return;}restoreStateFunction({connectedPeripherals:nativeRestoredState.connectedPeripherals.map(function(nativeDevice){return new _Device.Device(nativeDevice,_this);})});});}this._errorCodesToMessagesMapping=options.errorCodesToMessagesMapping?options.errorCodesToMessagesMapping:_BleError.BleErrorCodeMessage;_BleModule.BleModule.createClient(options.restoreStateIdentifier||null);BleManager.sharedInstance=this;}return(0,_createClass2.default)(BleManager,[{key:"_destroyPromises",value:function _destroyPromises(){var destroyedError=new _BleError.BleError({errorCode:_BleError.BleErrorCode.BluetoothManagerDestroyed,attErrorCode:null,iosErrorCode:null,androidErrorCode:null,reason:null},this._errorCodesToMessagesMapping);for(var _id in this._activePromises){this._activePromises[_id](destroyedError);}}},{key:"_destroySubscriptions",value:function _destroySubscriptions(){for(var _id2 in this._activeSubscriptions){this._activeSubscriptions[_id2].remove();}}},{key:"destroy",value:(function(){var _destroy=(0,_asyncToGenerator2.default)(function*(){var response=yield this._callPromise(_BleModule.BleModule.destroyClient());if(this._scanEventSubscription!=null){this._scanEventSubscription.remove();this._scanEventSubscription=null;}this._destroySubscriptions();if(BleManager.sharedInstance){BleManager.sharedInstance=null;}this._destroyPromises();return response;});function destroy(){return _destroy.apply(this,arguments);}return destroy;}())},{key:"_nextUniqueID",value:function _nextUniqueID(){this._uniqueId+=1;return this._uniqueId.toString();}},{key:"_callPromise",value:(function(){var _callPromise2=(0,_asyncToGenerator2.default)(function*(promise){var _this2=this;var id=this._nextUniqueID();try{var destroyPromise=new Promise(function(resolve,reject){_this2._activePromises[id]=reject;});var value=yield Promise.race([destroyPromise,promise]);delete this._activePromises[id];return value;}catch(error){delete this._activePromises[id];throw(0,_BleError.parseBleError)(error.message,this._errorCodesToMessagesMapping);}});function _callPromise(_x){return _callPromise2.apply(this,arguments);}return _callPromise;}())},{key:"setLogLevel",value:function setLogLevel(logLevel){return this._callPromise(_BleModule.BleModule.setLogLevel(logLevel));}},{key:"logLevel",value:function logLevel(){return this._callPromise(_BleModule.BleModule.logLevel());}},{key:"cancelTransaction",value:function cancelTransaction(transactionId){return this._callPromise(_BleModule.BleModule.cancelTransaction(transactionId));}},{key:"enable",value:function(){var _enable=(0,_asyncToGenerator2.default)(function*(transactionId){if(!transactionId){transactionId=this._nextUniqueID();}yield this._callPromise(_BleModule.BleModule.enable(transactionId));return this;});function enable(_x2){return _enable.apply(this,arguments);}return enable;}()},{key:"disable",value:(function(){var _disable=(0,_asyncToGenerator2.default)(function*(transactionId){console.warn(enableDisableDeprecatedMessage);if(!transactionId){transactionId=this._nextUniqueID();}yield this._callPromise(_BleModule.BleModule.disable(transactionId));return this;});function disable(_x3){return _disable.apply(this,arguments);}return disable;}())},{key:"state",value:function state(){return this._callPromise(_BleModule.BleModule.state());}},{key:"onStateChange",value:function onStateChange(listener){var _this3=this;var emitCurrentState=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var subscription=this._eventEmitter.addListener(_BleModule.BleModule.StateChangeEvent,listener);var id=this._nextUniqueID();var wrappedSubscription;if(emitCurrentState){var cancelled=false;this._callPromise(this.state()).then(function(currentState){if(!cancelled){listener(currentState);}});wrappedSubscription={remove:function remove(){if(_this3._activeSubscriptions[id]!=null){cancelled=true;delete _this3._activeSubscriptions[id];subscription.remove();}}};}else{wrappedSubscription={remove:function remove(){if(_this3._activeSubscriptions[id]!=null){delete _this3._activeSubscriptions[id];subscription.remove();}}};}this._activeSubscriptions[id]=wrappedSubscription;return wrappedSubscription;}},{key:"startDeviceScan",value:function(){var _startDeviceScan=(0,_asyncToGenerator2.default)(function*(UUIDs,options,listener){var _this4=this;var scanListener=function scanListener(_ref){var _ref2=(0,_slicedToArray2.default)(_ref,2),error=_ref2[0],nativeDevice=_ref2[1];listener(error?(0,_BleError.parseBleError)(error,_this4._errorCodesToMessagesMapping):null,nativeDevice?new _Device.Device(nativeDevice,_this4):null);};this._scanEventSubscription=this._eventEmitter.addListener(_BleModule.BleModule.ScanEvent,scanListener);return this._callPromise(_BleModule.BleModule.startDeviceScan(UUIDs,options));});function startDeviceScan(_x4,_x5,_x6){return _startDeviceScan.apply(this,arguments);}return startDeviceScan;}()},{key:"stopDeviceScan",value:function stopDeviceScan(){if(this._scanEventSubscription!=null){this._scanEventSubscription.remove();this._scanEventSubscription=null;}return this._callPromise(_BleModule.BleModule.stopDeviceScan());}},{key:"requestConnectionPriorityForDevice",value:(function(){var _requestConnectionPriorityForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,connectionPriority,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDevice=yield this._callPromise(_BleModule.BleModule.requestConnectionPriorityForDevice(deviceIdentifier,connectionPriority,transactionId));return new _Device.Device(nativeDevice,this);});function requestConnectionPriorityForDevice(_x7,_x8,_x9){return _requestConnectionPriorityForDevice.apply(this,arguments);}return requestConnectionPriorityForDevice;}())},{key:"readRSSIForDevice",value:(function(){var _readRSSIForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDevice=yield this._callPromise(_BleModule.BleModule.readRSSIForDevice(deviceIdentifier,transactionId));return new _Device.Device(nativeDevice,this);});function readRSSIForDevice(_x0,_x1){return _readRSSIForDevice.apply(this,arguments);}return readRSSIForDevice;}())},{key:"requestMTUForDevice",value:(function(){var _requestMTUForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,mtu,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDevice=yield this._callPromise(_BleModule.BleModule.requestMTUForDevice(deviceIdentifier,mtu,transactionId));return new _Device.Device(nativeDevice,this);});function requestMTUForDevice(_x10,_x11,_x12){return _requestMTUForDevice.apply(this,arguments);}return requestMTUForDevice;}())},{key:"devices",value:function(){var _devices=(0,_asyncToGenerator2.default)(function*(deviceIdentifiers){var _this5=this;var nativeDevices=yield this._callPromise(_BleModule.BleModule.devices(deviceIdentifiers));return nativeDevices.map(function(nativeDevice){return new _Device.Device(nativeDevice,_this5);});});function devices(_x13){return _devices.apply(this,arguments);}return devices;}()},{key:"connectedDevices",value:(function(){var _connectedDevices=(0,_asyncToGenerator2.default)(function*(serviceUUIDs){var _this6=this;var nativeDevices=yield this._callPromise(_BleModule.BleModule.connectedDevices(serviceUUIDs));return nativeDevices.map(function(nativeDevice){return new _Device.Device(nativeDevice,_this6);});});function connectedDevices(_x14){return _connectedDevices.apply(this,arguments);}return connectedDevices;}())},{key:"connectToDevice",value:function(){var _connectToDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,options){if(_reactNative.Platform.OS==='android'&&(yield this.isDeviceConnected(deviceIdentifier))){yield this.cancelDeviceConnection(deviceIdentifier);}var nativeDevice=yield this._callPromise(_BleModule.BleModule.connectToDevice(deviceIdentifier,options));return new _Device.Device(nativeDevice,this);});function connectToDevice(_x15,_x16){return _connectToDevice.apply(this,arguments);}return connectToDevice;}()},{key:"cancelDeviceConnection",value:(function(){var _cancelDeviceConnection=(0,_asyncToGenerator2.default)(function*(deviceIdentifier){var nativeDevice=yield this._callPromise(_BleModule.BleModule.cancelDeviceConnection(deviceIdentifier));return new _Device.Device(nativeDevice,this);});function cancelDeviceConnection(_x17){return _cancelDeviceConnection.apply(this,arguments);}return cancelDeviceConnection;}())},{key:"onDeviceDisconnected",value:function onDeviceDisconnected(deviceIdentifier,listener){var _this7=this;var disconnectionListener=function disconnectionListener(_ref3){var _ref4=(0,_slicedToArray2.default)(_ref3,2),error=_ref4[0],nativeDevice=_ref4[1];if(deviceIdentifier!==nativeDevice.id){return;}listener(error?(0,_BleError.parseBleError)(error,_this7._errorCodesToMessagesMapping):null,new _Device.Device(nativeDevice,_this7));};var subscription=this._eventEmitter.addListener(_BleModule.BleModule.DisconnectionEvent,disconnectionListener);var id=this._nextUniqueID();var wrappedSubscription={remove:function remove(){if(_this7._activeSubscriptions[id]!=null){delete _this7._activeSubscriptions[id];subscription.remove();}}};this._activeSubscriptions[id]=wrappedSubscription;return wrappedSubscription;}},{key:"isDeviceConnected",value:function isDeviceConnected(deviceIdentifier){return this._callPromise(_BleModule.BleModule.isDeviceConnected(deviceIdentifier));}},{key:"discoverAllServicesAndCharacteristicsForDevice",value:function(){var _discoverAllServicesAndCharacteristicsForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDevice=yield this._callPromise(_BleModule.BleModule.discoverAllServicesAndCharacteristicsForDevice(deviceIdentifier,transactionId));var services=yield this._callPromise(_BleModule.BleModule.servicesForDevice(deviceIdentifier));var serviceUUIDs=(services||[]).map(function(service){return service.uuid;});var device=Object.assign({},nativeDevice,{serviceUUIDs:serviceUUIDs});return new _Device.Device(device,this);});function discoverAllServicesAndCharacteristicsForDevice(_x18,_x19){return _discoverAllServicesAndCharacteristicsForDevice.apply(this,arguments);}return discoverAllServicesAndCharacteristicsForDevice;}()},{key:"servicesForDevice",value:function(){var _servicesForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier){var _this8=this;var services=yield this._callPromise(_BleModule.BleModule.servicesForDevice(deviceIdentifier));return services.map(function(nativeService){return new _Service.Service(nativeService,_this8);});});function servicesForDevice(_x20){return _servicesForDevice.apply(this,arguments);}return servicesForDevice;}()},{key:"characteristicsForDevice",value:function characteristicsForDevice(deviceIdentifier,serviceUUID){return this._handleCharacteristics(_BleModule.BleModule.characteristicsForDevice(deviceIdentifier,serviceUUID));}},{key:"_characteristicsForService",value:function _characteristicsForService(serviceIdentifier){return this._handleCharacteristics(_BleModule.BleModule.characteristicsForService(serviceIdentifier));}},{key:"_handleCharacteristics",value:(function(){var _handleCharacteristics2=(0,_asyncToGenerator2.default)(function*(characteristicsPromise){var _this9=this;var characteristics=yield this._callPromise(characteristicsPromise);return characteristics.map(function(nativeCharacteristic){return new _Characteristic.Characteristic(nativeCharacteristic,_this9);});});function _handleCharacteristics(_x21){return _handleCharacteristics2.apply(this,arguments);}return _handleCharacteristics;}())},{key:"descriptorsForDevice",value:function descriptorsForDevice(deviceIdentifier,serviceUUID,characteristicUUID){return this._handleDescriptors(_BleModule.BleModule.descriptorsForDevice(deviceIdentifier,serviceUUID,characteristicUUID));}},{key:"_descriptorsForService",value:function _descriptorsForService(serviceIdentifier,characteristicUUID){return this._handleDescriptors(_BleModule.BleModule.descriptorsForService(serviceIdentifier,characteristicUUID));}},{key:"_descriptorsForCharacteristic",value:function _descriptorsForCharacteristic(characteristicIdentifier){return this._handleDescriptors(_BleModule.BleModule.descriptorsForCharacteristic(characteristicIdentifier));}},{key:"_handleDescriptors",value:(function(){var _handleDescriptors2=(0,_asyncToGenerator2.default)(function*(descriptorsPromise){var _this0=this;var descriptors=yield this._callPromise(descriptorsPromise);return descriptors.map(function(nativeDescriptor){return new _Descriptor.Descriptor(nativeDescriptor,_this0);});});function _handleDescriptors(_x22){return _handleDescriptors2.apply(this,arguments);}return _handleDescriptors;}())},{key:"readCharacteristicForDevice",value:function(){var _readCharacteristicForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,serviceUUID,characteristicUUID,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.readCharacteristicForDevice(deviceIdentifier,serviceUUID,characteristicUUID,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function readCharacteristicForDevice(_x23,_x24,_x25,_x26){return _readCharacteristicForDevice.apply(this,arguments);}return readCharacteristicForDevice;}()},{key:"_readCharacteristicForService",value:(function(){var _readCharacteristicForService2=(0,_asyncToGenerator2.default)(function*(serviceIdentifier,characteristicUUID,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.readCharacteristicForService(serviceIdentifier,characteristicUUID,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function _readCharacteristicForService(_x27,_x28,_x29){return _readCharacteristicForService2.apply(this,arguments);}return _readCharacteristicForService;}())},{key:"_readCharacteristic",value:(function(){var _readCharacteristic2=(0,_asyncToGenerator2.default)(function*(characteristicIdentifier,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.readCharacteristic(characteristicIdentifier,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function _readCharacteristic(_x30,_x31){return _readCharacteristic2.apply(this,arguments);}return _readCharacteristic;}())},{key:"writeCharacteristicWithResponseForDevice",value:(function(){var _writeCharacteristicWithResponseForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,serviceUUID,characteristicUUID,base64Value,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.writeCharacteristicForDevice(deviceIdentifier,serviceUUID,characteristicUUID,base64Value,true,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function writeCharacteristicWithResponseForDevice(_x32,_x33,_x34,_x35,_x36){return _writeCharacteristicWithResponseForDevice.apply(this,arguments);}return writeCharacteristicWithResponseForDevice;}())},{key:"_writeCharacteristicWithResponseForService",value:(function(){var _writeCharacteristicWithResponseForService2=(0,_asyncToGenerator2.default)(function*(serviceIdentifier,characteristicUUID,base64Value,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.writeCharacteristicForService(serviceIdentifier,characteristicUUID,base64Value,true,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function _writeCharacteristicWithResponseForService(_x37,_x38,_x39,_x40){return _writeCharacteristicWithResponseForService2.apply(this,arguments);}return _writeCharacteristicWithResponseForService;}())},{key:"_writeCharacteristicWithResponse",value:(function(){var _writeCharacteristicWithResponse2=(0,_asyncToGenerator2.default)(function*(characteristicIdentifier,base64Value,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.writeCharacteristic(characteristicIdentifier,base64Value,true,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function _writeCharacteristicWithResponse(_x41,_x42,_x43){return _writeCharacteristicWithResponse2.apply(this,arguments);}return _writeCharacteristicWithResponse;}())},{key:"writeCharacteristicWithoutResponseForDevice",value:(function(){var _writeCharacteristicWithoutResponseForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,serviceUUID,characteristicUUID,base64Value,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.writeCharacteristicForDevice(deviceIdentifier,serviceUUID,characteristicUUID,base64Value,false,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function writeCharacteristicWithoutResponseForDevice(_x44,_x45,_x46,_x47,_x48){return _writeCharacteristicWithoutResponseForDevice.apply(this,arguments);}return writeCharacteristicWithoutResponseForDevice;}())},{key:"_writeCharacteristicWithoutResponseForService",value:(function(){var _writeCharacteristicWithoutResponseForService2=(0,_asyncToGenerator2.default)(function*(serviceIdentifier,characteristicUUID,base64Value,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.writeCharacteristicForService(serviceIdentifier,characteristicUUID,base64Value,false,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function _writeCharacteristicWithoutResponseForService(_x49,_x50,_x51,_x52){return _writeCharacteristicWithoutResponseForService2.apply(this,arguments);}return _writeCharacteristicWithoutResponseForService;}())},{key:"_writeCharacteristicWithoutResponse",value:(function(){var _writeCharacteristicWithoutResponse2=(0,_asyncToGenerator2.default)(function*(characteristicIdentifier,base64Value,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeCharacteristic=yield this._callPromise(_BleModule.BleModule.writeCharacteristic(characteristicIdentifier,base64Value,false,transactionId));return new _Characteristic.Characteristic(nativeCharacteristic,this);});function _writeCharacteristicWithoutResponse(_x53,_x54,_x55){return _writeCharacteristicWithoutResponse2.apply(this,arguments);}return _writeCharacteristicWithoutResponse;}())},{key:"monitorCharacteristicForDevice",value:function monitorCharacteristicForDevice(deviceIdentifier,serviceUUID,characteristicUUID,listener,transactionId,subscriptionType){var filledTransactionId=transactionId||this._nextUniqueID();var commonArgs=[deviceIdentifier,serviceUUID,characteristicUUID,filledTransactionId];var args=_Utils.isIOS?commonArgs:[].concat(commonArgs,[subscriptionType]);return this._handleMonitorCharacteristic(_BleModule.BleModule.monitorCharacteristicForDevice.apply(_BleModule.BleModule,(0,_toConsumableArray2.default)(args)),filledTransactionId,listener);}},{key:"_monitorCharacteristicForService",value:function _monitorCharacteristicForService(serviceIdentifier,characteristicUUID,listener,transactionId,subscriptionType){var filledTransactionId=transactionId||this._nextUniqueID();var commonArgs=[serviceIdentifier,characteristicUUID,filledTransactionId];var args=_Utils.isIOS?commonArgs:[].concat(commonArgs,[subscriptionType]);return this._handleMonitorCharacteristic(_BleModule.BleModule.monitorCharacteristicForService.apply(_BleModule.BleModule,(0,_toConsumableArray2.default)(args)),filledTransactionId,listener);}},{key:"_monitorCharacteristic",value:function _monitorCharacteristic(characteristicIdentifier,listener,transactionId,subscriptionType){var filledTransactionId=transactionId||this._nextUniqueID();var commonArgs=[characteristicIdentifier,filledTransactionId];var args=_Utils.isIOS?commonArgs:[].concat(commonArgs,[subscriptionType]);return this._handleMonitorCharacteristic(_BleModule.BleModule.monitorCharacteristic.apply(_BleModule.BleModule,(0,_toConsumableArray2.default)(args)),filledTransactionId,listener);}},{key:"_handleMonitorCharacteristic",value:function _handleMonitorCharacteristic(monitorPromise,transactionId,listener){var _this1=this;var monitorListener=function monitorListener(_ref5){var _ref6=(0,_slicedToArray2.default)(_ref5,3),error=_ref6[0],characteristic=_ref6[1],msgTransactionId=_ref6[2];if(transactionId!==msgTransactionId){return;}if(error){listener((0,_BleError.parseBleError)(error,_this1._errorCodesToMessagesMapping),null);return;}listener(null,new _Characteristic.Characteristic(characteristic,_this1));};var subscription=this._eventEmitter.addListener(_BleModule.BleModule.ReadEvent,monitorListener);var id=this._nextUniqueID();var wrappedSubscription={remove:function remove(){if(_this1._activeSubscriptions[id]!=null){delete _this1._activeSubscriptions[id];subscription.remove();}}};this._activeSubscriptions[id]=wrappedSubscription;this._callPromise(monitorPromise).then(function(){wrappedSubscription.remove();},function(error){listener(error,null);wrappedSubscription.remove();});return{remove:function remove(){_BleModule.BleModule.cancelTransaction(transactionId);}};}},{key:"readDescriptorForDevice",value:function(){var _readDescriptorForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,serviceUUID,characteristicUUID,descriptorUUID,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.readDescriptorForDevice(deviceIdentifier,serviceUUID,characteristicUUID,descriptorUUID,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function readDescriptorForDevice(_x56,_x57,_x58,_x59,_x60){return _readDescriptorForDevice.apply(this,arguments);}return readDescriptorForDevice;}()},{key:"_readDescriptorForService",value:(function(){var _readDescriptorForService2=(0,_asyncToGenerator2.default)(function*(serviceIdentifier,characteristicUUID,descriptorUUID,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.readDescriptorForService(serviceIdentifier,characteristicUUID,descriptorUUID,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function _readDescriptorForService(_x61,_x62,_x63,_x64){return _readDescriptorForService2.apply(this,arguments);}return _readDescriptorForService;}())},{key:"_readDescriptorForCharacteristic",value:(function(){var _readDescriptorForCharacteristic2=(0,_asyncToGenerator2.default)(function*(characteristicIdentifier,descriptorUUID,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.readDescriptorForCharacteristic(characteristicIdentifier,descriptorUUID,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function _readDescriptorForCharacteristic(_x65,_x66,_x67){return _readDescriptorForCharacteristic2.apply(this,arguments);}return _readDescriptorForCharacteristic;}())},{key:"_readDescriptor",value:(function(){var _readDescriptor2=(0,_asyncToGenerator2.default)(function*(descriptorIdentifier,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.readDescriptor(descriptorIdentifier,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function _readDescriptor(_x68,_x69){return _readDescriptor2.apply(this,arguments);}return _readDescriptor;}())},{key:"writeDescriptorForDevice",value:(function(){var _writeDescriptorForDevice=(0,_asyncToGenerator2.default)(function*(deviceIdentifier,serviceUUID,characteristicUUID,descriptorUUID,valueBase64,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.writeDescriptorForDevice(deviceIdentifier,serviceUUID,characteristicUUID,descriptorUUID,valueBase64,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function writeDescriptorForDevice(_x70,_x71,_x72,_x73,_x74,_x75){return _writeDescriptorForDevice.apply(this,arguments);}return writeDescriptorForDevice;}())},{key:"_writeDescriptorForService",value:(function(){var _writeDescriptorForService2=(0,_asyncToGenerator2.default)(function*(serviceIdentifier,characteristicUUID,descriptorUUID,valueBase64,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.writeDescriptorForService(serviceIdentifier,characteristicUUID,descriptorUUID,valueBase64,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function _writeDescriptorForService(_x76,_x77,_x78,_x79,_x80){return _writeDescriptorForService2.apply(this,arguments);}return _writeDescriptorForService;}())},{key:"_writeDescriptorForCharacteristic",value:(function(){var _writeDescriptorForCharacteristic2=(0,_asyncToGenerator2.default)(function*(characteristicIdentifier,descriptorUUID,valueBase64,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.writeDescriptorForCharacteristic(characteristicIdentifier,descriptorUUID,valueBase64,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function _writeDescriptorForCharacteristic(_x81,_x82,_x83,_x84){return _writeDescriptorForCharacteristic2.apply(this,arguments);}return _writeDescriptorForCharacteristic;}())},{key:"_writeDescriptor",value:(function(){var _writeDescriptor2=(0,_asyncToGenerator2.default)(function*(descriptorIdentifier,valueBase64,transactionId){if(!transactionId){transactionId=this._nextUniqueID();}var nativeDescriptor=yield this._callPromise(_BleModule.BleModule.writeDescriptor(descriptorIdentifier,valueBase64,transactionId));return new _Descriptor.Descriptor(nativeDescriptor,this);});function _writeDescriptor(_x85,_x86,_x87){return _writeDescriptor2.apply(this,arguments);}return _writeDescriptor;}())}]);}();BleManager.sharedInstance=null;