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

			winble.logger.logDebug("getServiceCharacteristics", "deviceHandle='" + deviceHandle + ", serviceHandle='" + serviceHandle + "'");

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

			// Find the requested service in the device's list of services
			var service = winble.deviceManager.getServiceFromHandle(device, serviceHandle, "getServiceCharacteristics", errorCallback);
			if (service == null)
				return;

			// Enumerate the characteristics on this service
			var charList = service.gattService.getAllCharacteristics();

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

				// Add characteristic internally to the device so we can retrieve it later by its handle
				winble.logger.logDebug("getServiceCharacteristics", "Found " + service.gattService.uuid + " characteristic '" + charList[i].uuid + "'");
				var charStore = {
					"gattChar": charList[i],
					"handle": winble.nextGattHandle++
				};
				device.charList[charStore.handle] = charStore;

				// Add characteristic to return list
				var charOut = {
					"handle": charStore.handle,
					"uuid": charStore.gattChar.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(charStore.gattChar.protectionLevel),
					"properties": charStore.gattChar.characteristicProperties, // Microsoft's bitfield matches the BLE 4.2 spec
					"writeType": 3 // So (1+2), where 1: WRITE_TYPE_NO_RESPONSE, 2: WRITE_TYPE_DEFAULT, 4: WRITE_TYPE_SIGNED

				};
				charListOut.push(charOut);
			}

			// Report the list of characteristics back to the caller
			successCallback(charListOut);
		}
function (successCallback, errorCallback, deviceHandle, serviceHandle) {

			winble.logger.logDebug("getServiceCharacteristics", "deviceHandle='" + deviceHandle + ", serviceHandle='" + serviceHandle + "'");

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

			// Find the requested service in the device's list of services
			var service = winble.deviceManager.getServiceFromHandle(device, serviceHandle, "getServiceCharacteristics", errorCallback);
			if (service == null)
				return;

			// Enumerate the characteristics on this service
			var charList = service.gattService.getAllCharacteristics();

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

				// Add characteristic internally to the device so we can retrieve it later by its handle
				winble.logger.logDebug("getServiceCharacteristics", "Found " + service.gattService.uuid + " characteristic '" + charList[i].uuid + "'");
				var charStore = {
					"gattChar": charList[i],
					"handle": winble.nextGattHandle++
				};
				device.charList[charStore.handle] = charStore;

				// Add characteristic to return list
				var charOut = {
					"handle": charStore.handle,
					"uuid": charStore.gattChar.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(charStore.gattChar.protectionLevel),
					"properties": charStore.gattChar.characteristicProperties, // Microsoft's bitfield matches the BLE 4.2 spec
					"writeType": 3 // So (1+2), where 1: WRITE_TYPE_NO_RESPONSE, 2: WRITE_TYPE_DEFAULT, 4: WRITE_TYPE_SIGNED

				};
				charListOut.push(charOut);
			}

			// Report the list of characteristics back to the caller
			successCallback(charListOut);
		}
function ( successCallback , errorCallback , deviceHandle , serviceHandle ) { winble . logger . logDebug ( "getServiceCharacteristics" , "deviceHandle='" + deviceHandle + ", serviceHandle='" + serviceHandle + "'" ) ; // Find the requested device in our list of discovered devices var device = winble . deviceManager . getDeviceFromHandle ( deviceHandle , "getServiceCharacteristics" , errorCallback ) ; if ( device == null ) return ; // Find the requested service in the device's list of services var service = winble . deviceManager . getServiceFromHandle ( device , serviceHandle , "getServiceCharacteristics" , errorCallback ) ; if ( service == null ) return ; // Enumerate the characteristics on this service var charList = service . gattService . getAllCharacteristics ( ) ; // Store the characteristics and return an API-specified list to the caller var charListOut = [ ] ; for ( var i = 0 ; i < charList . length ; i ++ ) { // Add characteristic internally to the device so we can retrieve it later by its handle winble . logger . logDebug ( "getServiceCharacteristics" , "Found " + service . gattService . uuid + " characteristic '" + charList [ i ] . uuid + "'" ) ; var charStore = { "gattChar" : charList [ i ] , "handle" : winble . nextGattHandle ++ } ; device . charList [ charStore . handle ] = charStore ; // Add characteristic to return list var charOut = { "handle" : charStore . handle , "uuid" : charStore . gattChar . 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 ( charStore . gattChar . protectionLevel ) , "properties" : charStore . gattChar . characteristicProperties , // Microsoft's bitfield matches the BLE 4.2 spec "writeType" : 3 // So (1+2), where 1: WRITE_TYPE_NO_RESPONSE, 2: WRITE_TYPE_DEFAULT, 4: WRITE_TYPE_SIGNED } ; charListOut . push ( charOut ) ; } // Report the list of characteristics back to the caller successCallback ( charListOut ) ; }
Called from the characteristics API; return a list of all BLE characteristics associated with the specified device+service.
Called from the characteristics API ; return a list of all BLE characteristics associated with the specified device + service .