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

			winble.logger.logDebug("writeDescriptor", "deviceHandle='" + deviceHandle + ", descHandle='" + descHandle + "'");

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

			// Find the requested descriptor in the device's list of descriptors
			var descriptor = winble.deviceManager.getDescriptorFromHandle(device, descHandle, "writeDescriptor", errorCallback);
			if (descriptor == null)
				return;

			// Write the data. The incoming buffer is and ArrayBuffer, and the writeValueAsync() function takes an iBuffer as its
			// parameter, so we need to do some conversion here.
			// https://msdn.microsoft.com/en-us/library/windows/apps/windows.security.cryptography.cryptographicbuffer.createfrombytearray
			// https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.bluetooth.genericattributeprofile.gattdescriptor.writevalueasync.aspx
			var data = new Uint8Array(dataBuffer);
			var dataOut = Windows.Security.Cryptography.CryptographicBuffer.createFromByteArray(data);
			descriptor.gattDesc.writeValueAsync(dataOut).done(
				function (commStatus) {
					if (commStatus == winble.gatt.GattCommunicationStatus.success) {
						winble.logger.logDebug("writeDescriptor", "gattDesc.writeValueAsync completed with success");
						successCallback();
					} else {
						winble.logger.logDebug("writeDescriptor", "gattDesc.writeValueAsync completed with error");
						var msg = "Write failed or device unreachable, GattCommunicationStatus = " + commStatus;
						winble.logger.logError("writeDescriptor", msg);
						errorCallback(msg);
					}
				},
				function (error) {
					var msg = "gattDesc.writeValueAsync() failed: " + error;
					winble.logger.logError("writeDescriptor", msg);
					errorCallback(msg);
				});
		}
function (successCallback, errorCallback, deviceHandle, descHandle, dataBuffer) {

			winble.logger.logDebug("writeDescriptor", "deviceHandle='" + deviceHandle + ", descHandle='" + descHandle + "'");

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

			// Find the requested descriptor in the device's list of descriptors
			var descriptor = winble.deviceManager.getDescriptorFromHandle(device, descHandle, "writeDescriptor", errorCallback);
			if (descriptor == null)
				return;

			// Write the data. The incoming buffer is and ArrayBuffer, and the writeValueAsync() function takes an iBuffer as its
			// parameter, so we need to do some conversion here.
			// https://msdn.microsoft.com/en-us/library/windows/apps/windows.security.cryptography.cryptographicbuffer.createfrombytearray
			// https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.bluetooth.genericattributeprofile.gattdescriptor.writevalueasync.aspx
			var data = new Uint8Array(dataBuffer);
			var dataOut = Windows.Security.Cryptography.CryptographicBuffer.createFromByteArray(data);
			descriptor.gattDesc.writeValueAsync(dataOut).done(
				function (commStatus) {
					if (commStatus == winble.gatt.GattCommunicationStatus.success) {
						winble.logger.logDebug("writeDescriptor", "gattDesc.writeValueAsync completed with success");
						successCallback();
					} else {
						winble.logger.logDebug("writeDescriptor", "gattDesc.writeValueAsync completed with error");
						var msg = "Write failed or device unreachable, GattCommunicationStatus = " + commStatus;
						winble.logger.logError("writeDescriptor", msg);
						errorCallback(msg);
					}
				},
				function (error) {
					var msg = "gattDesc.writeValueAsync() failed: " + error;
					winble.logger.logError("writeDescriptor", msg);
					errorCallback(msg);
				});
		}
function ( successCallback , errorCallback , deviceHandle , descHandle , dataBuffer ) { winble . logger . logDebug ( "writeDescriptor" , "deviceHandle='" + deviceHandle + ", descHandle='" + descHandle + "'" ) ; // Find the requested device in our list of discovered devices var device = winble . deviceManager . getDeviceFromHandle ( deviceHandle , "writeDescriptor" , errorCallback ) ; if ( device == null ) return ; // Find the requested descriptor in the device's list of descriptors var descriptor = winble . deviceManager . getDescriptorFromHandle ( device , descHandle , "writeDescriptor" , errorCallback ) ; if ( descriptor == null ) return ; // Write the data. The incoming buffer is and ArrayBuffer, and the writeValueAsync() function takes an iBuffer as its // parameter, so we need to do some conversion here. // https://msdn.microsoft.com/en-us/library/windows/apps/windows.security.cryptography.cryptographicbuffer.createfrombytearray // https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.bluetooth.genericattributeprofile.gattdescriptor.writevalueasync.aspx var data = new Uint8Array ( dataBuffer ) ; var dataOut = Windows . Security . Cryptography . CryptographicBuffer . createFromByteArray ( data ) ; descriptor . gattDesc . writeValueAsync ( dataOut ) . done ( function ( commStatus ) { if ( commStatus == winble . gatt . GattCommunicationStatus . success ) { winble . logger . logDebug ( "writeDescriptor" , "gattDesc.writeValueAsync completed with success" ) ; successCallback ( ) ; } else { winble . logger . logDebug ( "writeDescriptor" , "gattDesc.writeValueAsync completed with error" ) ; var msg = "Write failed or device unreachable, GattCommunicationStatus = " + commStatus ; winble . logger . logError ( "writeDescriptor" , msg ) ; errorCallback ( msg ) ; } } , function ( error ) { var msg = "gattDesc.writeValueAsync() failed: " + error ; winble . logger . logError ( "writeDescriptor" , msg ) ; errorCallback ( msg ) ; } ) ; }
Called from the writeDescriptor API; write the data to the specified descriptor.
Called from the writeDescriptor API ; write the data to the specified descriptor .