CBCentralManager.ConnectPeripheral Method

Definition

Overloads

ConnectPeripheral(CBPeripheral, NSDictionary)

Connects to the specified peripheral (weakly typed parameter version).

ConnectPeripheral(CBPeripheral, PeripheralConnectionOptions)

Connects to the specified peripheral.

ConnectPeripheral(CBPeripheral, NSDictionary)

Connects to the specified peripheral (weakly typed parameter version).

[Foundation.Export("connectPeripheral:options:")]
public virtual void ConnectPeripheral (CoreBluetooth.CBPeripheral peripheral, Foundation.NSDictionary options);
abstract member ConnectPeripheral : CoreBluetooth.CBPeripheral * Foundation.NSDictionary -> unit
override this.ConnectPeripheral : CoreBluetooth.CBPeripheral * Foundation.NSDictionary -> unit

Parameters

peripheral
CBPeripheral

Peripheral to connect to.

options
NSDictionary

Options to configure the peripheral connection, the keys include OptionAllowDuplicatesKey and OptionNotifyOnDisconnectionKey which should contain NSNumbers.

This parameter can be null.

Attributes

Applies to

ConnectPeripheral(CBPeripheral, PeripheralConnectionOptions)

Connects to the specified peripheral.

public void ConnectPeripheral (CoreBluetooth.CBPeripheral peripheral, CoreBluetooth.PeripheralConnectionOptions options = null);
member this.ConnectPeripheral : CoreBluetooth.CBPeripheral * CoreBluetooth.PeripheralConnectionOptions -> unit

Parameters

peripheral
CBPeripheral

Peripheral to connect to.

options
PeripheralConnectionOptions

Options to configure the peripheral connection.

Remarks

This raises the ConnectedPeripheral event if the connection is successful, or raises the FailedToConnectPeripheral on failure (not on timeout).

Alternatively, if you set the Delegate method, the ConnectedPeripheral(CBCentralManager, CBPeripheral) method is called if the connection is successful, or calls the FailedToConnectPeripheral(CBCentralManager, CBPeripheral, NSError) on failure (not on timeout).

If the peripheral is not available, this method will keep waiting for it to become available. To cancel a connection attempt, you must call CancelPeripheralConnection(CBPeripheral).

Applies to