src/windows/bleProxy.js
function (successCallback, errorCallback, deviceHandle, charHandle) {

			winble.logger.logDebug("getCharacteristicDescriptors", "deviceHandle='" + deviceHandle + ", charHandle='" + charHandle + "'");

			// Find the requested device in our list of discovered devices
			var device = winble.deviceManager.getDeviceFromHandle(deviceHandle, "getCharacteristicDescriptors", errorCallback);
			if (device == null)
				return;

			// Find the requested characteristic in the device's list of characteristics
			var characteristic = winble.deviceManager.getCharacteristicFromHandle(device, charHandle, "getCharacteristicDescriptors", errorCallback);
			if (characteristic == null)
				return;

			// Enumerate the descriptors on this characteristic
			var descList = characteristic.gattChar.getAllDescriptors();

			// Store the descriptors and return an API-specified list to the caller
			var descListOut = [];
			for (var i = 0; i < descList.length; i++) {

				// Add descriptor internally to the device so we can retrieve it later by its handle
				winble.logger.logDebug("getCharacteristicDescriptors", "Found " + characteristic.gattChar.uuid + " descriptor '" + descList[i].uuid + "'");
				var descStore = {
					"gattDesc": descList[i],
					"handle": winble.nextGattHandle++
				};
				device.descList[descStore.handle] = descStore;

				// Add characteristic to return list
				var charOut = {
					"handle": descStore.handle,
					"uuid": descStore.gattDesc.uuid,

					// TODO: Not at all sure if this is right as Microsoft has 1 of 4 values in this field and iOS/Android
					// TODO: have a bitfield, but see code in winble.deviceManager.permissionsFromProtectionLevel
					// TODO: as I try to map Microsoft's number to a bitfield.
					"permissions": winble.deviceManager.permissionsFromProtectionLevel(descStore.gattDesc.protectionLevel)
				};
				descListOut.push(charOut);
			}

			// Report the list of descriptors back to the caller
			successCallback(descListOut);
		}
function (successCallback, errorCallback, deviceHandle, charHandle) {

			winble.logger.logDebug("getCharacteristicDescriptors", "deviceHandle='" + deviceHandle + ", charHandle='" + charHandle + "'");

			// Find the requested device in our list of discovered devices
			var device = winble.deviceManager.getDeviceFromHandle(deviceHandle, "getCharacteristicDescriptors", errorCallback);
			if (device == null)
				return;

			// Find the requested characteristic in the device's list of characteristics
			var characteristic = winble.deviceManager.getCharacteristicFromHandle(device, charHandle, "getCharacteristicDescriptors", errorCallback);
			if (characteristic == null)
				return;

			// Enumerate the descriptors on this characteristic
			var descList = characteristic.gattChar.getAllDescriptors();

			// Store the descriptors and return an API-specified list to the caller
			var descListOut = [];
			for (var i = 0; i < descList.length; i++) {

				// Add descriptor internally to the device so we can retrieve it later by its handle
				winble.logger.logDebug("getCharacteristicDescriptors", "Found " + characteristic.gattChar.uuid + " descriptor '" + descList[i].uuid + "'");
				var descStore = {
					"gattDesc": descList[i],
					"handle": winble.nextGattHandle++
				};
				device.descList[descStore.handle] = descStore;

				// Add characteristic to return list
				var charOut = {
					"handle": descStore.handle,
					"uuid": descStore.gattDesc.uuid,

					// TODO: Not at all sure if this is right as Microsoft has 1 of 4 values in this field and iOS/Android
					// TODO: have a bitfield, but see code in winble.deviceManager.permissionsFromProtectionLevel
					// TODO: as I try to map Microsoft's number to a bitfield.
					"permissions": winble.deviceManager.permissionsFromProtectionLevel(descStore.gattDesc.protectionLevel)
				};
				descListOut.push(charOut);
			}

			// Report the list of descriptors back to the caller
			successCallback(descListOut);
		}
function ( successCallback , errorCallback , deviceHandle , charHandle ) { winble . logger . logDebug ( "getCharacteristicDescriptors" , "deviceHandle='" + deviceHandle + ", charHandle='" + charHandle + "'" ) ; // Find the requested device in our list of discovered devices var device = winble . deviceManager . getDeviceFromHandle ( deviceHandle , "getCharacteristicDescriptors" , errorCallback ) ; if ( device == null ) return ; // Find the requested characteristic in the device's list of characteristics var characteristic = winble . deviceManager . getCharacteristicFromHandle ( device , charHandle , "getCharacteristicDescriptors" , errorCallback ) ; if ( characteristic == null ) return ; // Enumerate the descriptors on this characteristic var descList = characteristic . gattChar . getAllDescriptors ( ) ; // Store the descriptors and return an API-specified list to the caller var descListOut = [ ] ; for ( var i = 0 ; i < descList . length ; i ++ ) { // Add descriptor internally to the device so we can retrieve it later by its handle winble . logger . logDebug ( "getCharacteristicDescriptors" , "Found " + characteristic . gattChar . uuid + " descriptor '" + descList [ i ] . uuid + "'" ) ; var descStore = { "gattDesc" : descList [ i ] , "handle" : winble . nextGattHandle ++ } ; device . descList [ descStore . handle ] = descStore ; // Add characteristic to return list var charOut = { "handle" : descStore . handle , "uuid" : descStore . gattDesc . uuid , // TODO: Not at all sure if this is right as Microsoft has 1 of 4 values in this field and iOS/Android // TODO: have a bitfield, but see code in winble.deviceManager.permissionsFromProtectionLevel // TODO: as I try to map Microsoft's number to a bitfield. "permissions" : winble . deviceManager . permissionsFromProtectionLevel ( descStore . gattDesc . protectionLevel ) } ; descListOut . push ( charOut ) ; } // Report the list of descriptors back to the caller successCallback ( descListOut ) ; }
Called from the descriptors API; return a list of all BLE descriptors associated with the specified device+characteristic.
Called from the descriptors API ; return a list of all BLE descriptors associated with the specified device + characteristic .