Esempio n. 1
0
        /// <summary>
        /// Asynchronously creates a <see cref="BluetoothConnection"/> and connects it.
        /// </summary>
        /// <param name="bluetoothDeviceInfo">The device information for the remote Bluetooth device.</param>
        /// <returns>
        /// A <see cref="Task{T}"/> representing the asynchronous operation, with the promise of a tuple with the
        /// <see cref="ConnectionResult"/> and created <see cref="BluetoothConnection"/> on completion.
        /// </returns>
        public static async Task <Tuple <ConnectionResult, BluetoothConnection> > CreateBluetoothConnectionAsync(DeviceInfo bluetoothDeviceInfo)
        {
            BluetoothConnection bluetoothConnection = new BluetoothConnection(bluetoothDeviceInfo);
            ConnectionResult    result = await bluetoothConnection.TryConnect();

            return(new Tuple <ConnectionResult, BluetoothConnection>(result, bluetoothConnection));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a <see cref="BluetoothConnection"/> and connects it.
        /// </summary>
        /// <param name="bluetoothDeviceInfo">The device information for the remote Bluetooth device.</param>
        /// <returns>A tuple with the <see cref="ConnectionResult"/> and created <see cref="BluetoothConnection"/>.</returns>
        public static Tuple <ConnectionResult, BluetoothConnection> CreateBluetoothConnection(DeviceInfo bluetoothDeviceInfo)
        {
            BluetoothConnection bluetoothConnection = new BluetoothConnection(bluetoothDeviceInfo);
            ConnectionResult    result = bluetoothConnection.TryConnect().Result;

            return(new Tuple <ConnectionResult, BluetoothConnection>(result, bluetoothConnection));
        }