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

			// Find the requested device in our list of discovered devices
			var device = winble.deviceManager.getDeviceFromId(deviceId, "connectToDevice", errorCallback);
			if (device == null) {
				errorCallback(winble.DEVICE_NOT_FOUND);
				return;
			}

			// Save the success callback; we will need to call this whenever the connection status changes.
			if (device.connectSuccessCallback == null)
				device.connectSuccessCallback = successCallback;

			// Call the success callback if the device is connected, error callback if not
			if (device.isReachable && device.isConnected) {
				winble.logger.logDebug("connectToDevice", "Connection successful");
				var connectInfo = {
					"deviceHandle": device.handle,
					"state": 2 // 0 = Disconnected, 1 = Connecting, 2 = Connected, 3 = Disconnecting
				};
				device.connectSuccessCallback(connectInfo, { keepCallback: true });
			} else {
				winble.logger.logDebug("connectToDevice", "Connection failed");
				errorCallback(winble.DEVICE_NOT_CONNECTED);
			}
		}
function (successCallback, errorCallback, deviceId) {

			// Find the requested device in our list of discovered devices
			var device = winble.deviceManager.getDeviceFromId(deviceId, "connectToDevice", errorCallback);
			if (device == null) {
				errorCallback(winble.DEVICE_NOT_FOUND);
				return;
			}

			// Save the success callback; we will need to call this whenever the connection status changes.
			if (device.connectSuccessCallback == null)
				device.connectSuccessCallback = successCallback;

			// Call the success callback if the device is connected, error callback if not
			if (device.isReachable && device.isConnected) {
				winble.logger.logDebug("connectToDevice", "Connection successful");
				var connectInfo = {
					"deviceHandle": device.handle,
					"state": 2 // 0 = Disconnected, 1 = Connecting, 2 = Connected, 3 = Disconnecting
				};
				device.connectSuccessCallback(connectInfo, { keepCallback: true });
			} else {
				winble.logger.logDebug("connectToDevice", "Connection failed");
				errorCallback(winble.DEVICE_NOT_CONNECTED);
			}
		}
function ( successCallback , errorCallback , deviceId ) { // Find the requested device in our list of discovered devices var device = winble . deviceManager . getDeviceFromId ( deviceId , "connectToDevice" , errorCallback ) ; if ( device == null ) { errorCallback ( winble . DEVICE_NOT_FOUND ) ; return ; } // Save the success callback; we will need to call this whenever the connection status changes. if ( device . connectSuccessCallback == null ) device . connectSuccessCallback = successCallback ; // Call the success callback if the device is connected, error callback if not if ( device . isReachable && device . isConnected ) { winble . logger . logDebug ( "connectToDevice" , "Connection successful" ) ; var connectInfo = { "deviceHandle" : device . handle , "state" : 2 // 0 = Disconnected, 1 = Connecting, 2 = Connected, 3 = Disconnecting } ; device . connectSuccessCallback ( connectInfo , { keepCallback : true } ) ; } else { winble . logger . logDebug ( "connectToDevice" , "Connection failed" ) ; errorCallback ( winble . DEVICE_NOT_CONNECTED ) ; } }
Called from the connect API; caller wants to connect to a previously discovered BLE device
Called from the connect API ; caller wants to connect to a previously discovered BLE device