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

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

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

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

			// Read and return the data
			// https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.bluetooth.genericattributeprofile.gattcharacteristic.readvalueasync.aspx
			//characteristic.gattChar.readValueAsync(Windows.Devices.Bluetooth.BluetoothCacheMode.uncached).done(
			characteristic.gattChar.readValueAsync(Windows.Devices.Bluetooth.BluetoothCacheMode.cached).done(
				function (readResult) {
					if (readResult.status == winble.gatt.GattCommunicationStatus.success) {
						var dataOut = new Uint8Array(readResult.value.length);
						var dataReader = Windows.Storage.Streams.DataReader.fromBuffer(readResult.value);
						dataReader.readBytes(dataOut);
						winble.logger.logDebug("readCharacteristic", "gattChar.readValueAsync completed with success, returning '" + dataOut + "'");
						successCallback(dataOut);
					} else {
						winble.logger.logDebug("readCharacteristic", "gattChar.readValueAsync completed with error");
						var msg = "Read failed or device unreachable, GattCommunicationStatus = " + readResult.status;
						winble.logger.logError("readCharacteristic", msg);
						errorCallback(msg);
					}
				},
				function (error) {
					var msg = "gattChar.readValueAsync() failed: " + error;
					winble.logger.logError("readCharacteristic", msg);
					errorCallback(msg);
				});
		}
function (successCallback, errorCallback, deviceHandle, charHandle) {

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

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

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

			// Read and return the data
			// https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.bluetooth.genericattributeprofile.gattcharacteristic.readvalueasync.aspx
			//characteristic.gattChar.readValueAsync(Windows.Devices.Bluetooth.BluetoothCacheMode.uncached).done(
			characteristic.gattChar.readValueAsync(Windows.Devices.Bluetooth.BluetoothCacheMode.cached).done(
				function (readResult) {
					if (readResult.status == winble.gatt.GattCommunicationStatus.success) {
						var dataOut = new Uint8Array(readResult.value.length);
						var dataReader = Windows.Storage.Streams.DataReader.fromBuffer(readResult.value);
						dataReader.readBytes(dataOut);
						winble.logger.logDebug("readCharacteristic", "gattChar.readValueAsync completed with success, returning '" + dataOut + "'");
						successCallback(dataOut);
					} else {
						winble.logger.logDebug("readCharacteristic", "gattChar.readValueAsync completed with error");
						var msg = "Read failed or device unreachable, GattCommunicationStatus = " + readResult.status;
						winble.logger.logError("readCharacteristic", msg);
						errorCallback(msg);
					}
				},
				function (error) {
					var msg = "gattChar.readValueAsync() failed: " + error;
					winble.logger.logError("readCharacteristic", msg);
					errorCallback(msg);
				});
		}
function ( successCallback , errorCallback , deviceHandle , charHandle ) { winble . logger . logDebug ( "readCharacteristic" , "deviceHandle='" + deviceHandle + ", charHandle='" + charHandle + "'" ) ; // Find the requested device in our list of discovered devices var device = winble . deviceManager . getDeviceFromHandle ( deviceHandle , "readCharacteristic" , errorCallback ) ; if ( device == null ) return ; // Find the requested characteristic in the device's list of characteristics var characteristic = winble . deviceManager . getCharacteristicFromHandle ( device , charHandle , "readCharacteristic" , errorCallback ) ; if ( characteristic == null ) return ; // Read and return the data // https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.bluetooth.genericattributeprofile.gattcharacteristic.readvalueasync.aspx //characteristic.gattChar.readValueAsync(Windows.Devices.Bluetooth.BluetoothCacheMode.uncached).done( characteristic . gattChar . readValueAsync ( Windows . Devices . Bluetooth . BluetoothCacheMode . cached ) . done ( function ( readResult ) { if ( readResult . status == winble . gatt . GattCommunicationStatus . success ) { var dataOut = new Uint8Array ( readResult . value . length ) ; var dataReader = Windows . Storage . Streams . DataReader . fromBuffer ( readResult . value ) ; dataReader . readBytes ( dataOut ) ; winble . logger . logDebug ( "readCharacteristic" , "gattChar.readValueAsync completed with success, returning '" + dataOut + "'" ) ; successCallback ( dataOut ) ; } else { winble . logger . logDebug ( "readCharacteristic" , "gattChar.readValueAsync completed with error" ) ; var msg = "Read failed or device unreachable, GattCommunicationStatus = " + readResult . status ; winble . logger . logError ( "readCharacteristic" , msg ) ; errorCallback ( msg ) ; } } , function ( error ) { var msg = "gattChar.readValueAsync() failed: " + error ; winble . logger . logError ( "readCharacteristic" , msg ) ; errorCallback ( msg ) ; } ) ; }
Called from the readCharacteristic API; return the specified characteristic.
Called from the readCharacteristic API ; return the specified characteristic .