Class

CBCentral​Manager

CBCentral​Manager objects are used to manage discovered or connected remote peripheral devices (represented by CBPeripheral objects), including scanning for, discovering, and connecting to advertising peripherals.

Overview

Before you call CBCentral​Manager methods, the state of the central manager object must be powered on, as indicated by the powered​On constant. This state indicates that the central device (your iPhone or iPad, for instance) supports Bluetooth low energy and that Bluetooth is on and available to use.

Symbols

Initializing a Central Manager

init(delegate:​ CBCentral​Manager​Delegate?, queue:​ Dispatch​Queue?)

Initializes the central manager with a specified delegate and dispatch queue.

init(delegate:​ CBCentral​Manager​Delegate?, queue:​ Dispatch​Queue?, options:​ [String :​ Any]? = nil)

Initializes the central manager with specified delegate, dispatch queue, and initialization options.

Establishing or Canceling Connections with Peripherals

func connect(CBPeripheral, options:​ [String :​ Any]? = nil)

Establishes a local connection to a peripheral.

func cancel​Peripheral​Connection(CBPeripheral)

Cancels an active or pending local connection to a peripheral.

Retrieving Lists of Peripherals

func retrieve​Connected​Peripherals(with​Services:​ [CBUUID])

Returns a list of the peripherals (containing any of the specified services) currently connected to the system.

func retrieve​Peripherals(with​Identifiers:​ [UUID])

Returns a list of known peripherals by their identifiers.

Scanning or Stopping Scans of Peripherals

func stop​Scan()

Asks the central manager to stop scanning for peripherals.

Monitoring Properties

var state:​ CBCentral​Manager​State

Returns the current state of the central manager.

var delegate:​ CBCentral​Manager​Delegate?

The delegate object you want to receive central events.

Constants

Central Manager Initialization Options

Keys used to pass options to the CBCentral​Manager method.

Peripheral Connection Options

Keys used to pass options to the connect(_:​options:​) method.

CBCentral​Manager​State

Values representing the current state of a central manager object.

Initializers

Instance Properties

Relationships

Inherits From