code: function (protectionLevel) {
  
  			// ReSharper disable InconsistentNaming
  			var PERMISSION_READ = 1;
  			var PERMISSION_READ_ENCRYPTED = 2;
  			var PERMISSION_READ_ENCRYPTED_MITM = 4;
  			var PERMISSION_WRITE = 16;
  			var PERMISSION_WRITE_ENCRYPTED = 32;
  			var PERMISSION_WRITE_ENCRYPTED_MITM = 64;
  			var PERMISSION_WRITE_SIGNED = 128;
  			var PERMISSION_WRITE_SIGNED_MITM = 256;
  			// ReSharper restore InconsistentNaming
  
  			var permissions = 0;
  
  			switch (protectionLevel) {
  				case winble.gatt.GattProtectionLevel.plain:
  					permissions = PERMISSION_READ | PERMISSION_WRITE;
  					break;
  				case winble.gatt.GattProtectionLevel.authenticationRequired:
  					permissions = PERMISSION_READ | PERMISSION_WRITE_SIGNED;
  					break;
  				case winble.gatt.GattProtectionLevel.encryptionRequired:
  					permissions = PERMISSION_READ_ENCRYPTED | PERMISSION_WRITE_ENCRYPTED;
  					break;
  				case winble.gatt.GattProtectionLevel.encryptionAndAuthenticationRequired:
  					permissions = PERMISSION_READ_ENCRYPTED | PERMISSION_WRITE_ENCRYPTED | PERMISSION_WRITE_SIGNED;
  					break;
  			}
  
  			return (permissions);
  		}
docs: Called internally from getServiceCharacteristics() and getCharacteristicDescriptors.