Class

CBPeripheral

A remote peripheral device.

Declaration

@interface CBPeripheral : CBPeer

Overview

The CBPeripheral class represents remote peripheral devices that your app discovers with a central manager (an instance of CBCentralManager). Peripherals use universally unique identifiers (UUIDs), represented by NSUUID objects, to identify themselves. Peripherals may contain one or more services or provide useful information about their connected signal strength.

You use this class to discover, explore, and interact with the services available on a remote peripheral that supports Bluetooth low energy. A service encapsulates the way part of the device behaves. For example, one service of a heart rate monitor may be to expose heart rate data from a sensor. Services themselves contain of characteristics or included services (references to other services). Characteristics provide further details about a peripheral’s service. For example, the heart rate service may contain multiple characteristics. One characteristic could describe the intended body location of the device’s heart rate sensor, and another characteristic could transmit the heart rate measurement data. Finally, characteristics contain any number of descriptors that provide more information about the characteristic’s value, such as a human-readable description and a way to format the value.

Topics

Identifying a Peripheral

name

The name of the peripheral.

delegate

The delegate object specified to receive peripheral events.

Discovering Services

- discoverServices:

Discovers the specified services of the peripheral.

- discoverIncludedServices:forService:

Discovers the specified included services of a previously-discovered service.

services

A list of a peripheral’s discovered services.

Discovering Characteristics and Descriptors

- discoverCharacteristics:forService:

Discovers the specified characteristics of a service.

- discoverDescriptorsForCharacteristic:

Discovers the descriptors of a characteristic.

Reading Characteristic and Descriptor Values

- readValueForCharacteristic:

Retrieves the value of a specified characteristic.

- readValueForDescriptor:

Retrieves the value of a specified characteristic descriptor.

Writing Characteristic and Descriptor Values

- writeValue:forCharacteristic:type:

Writes the value of a characteristic.

- writeValue:forDescriptor:

Writes the value of a characteristic descriptor.

- maximumWriteValueLengthForType:

The maximum amount of data, in bytes, you can send to a characteristic in a single write type.

CBCharacteristicWriteType

Values representing the possible write types to a characteristic’s value.

Setting Notifications for a Characteristic’s Value

- setNotifyValue:forCharacteristic:

Sets notifications or indications for the value of a specified characteristic.

Monitoring a Peripheral’s Connection State

state

The connection state of the peripheral.

CBPeripheralState

Values representing the connection state of a peripheral.

canSendWriteWithoutResponse

A Boolean value that indicates whether the remote device can send a write without a response.

Accessing a Peripheral’s Signal Strength

- readRSSI

Retrieves the current RSSI value for the peripheral while connected to the central manager.

RSSI

The Received Signal Strength Indicator (RSSI), in decibels, of the peripheral.

Deprecated

Working with L2CAP Channels

- openL2CAPChannel:

Attempts to open an L2CAP channel to the peripheral using the supplied Protocol/Service Multiplexer (PSM).

CBL2CAPChannel

A live L2CAP connection to a remote device.

CBL2CAPPSM

The type of PSM identifiers.

Working with Apple Notification Center Service (ANCS)

ancsAuthorized

A Boolean value that indicates if the remote device has authorization to receive data over ANCS protocol.

Relationships

Inherits From

See Also

Peripherals

CBPeripheralDelegate

A protocol that provides updates on the use of a peripheral’s services.

CBPeripheralManager

An object that manages and advertises peripheral services exposed by this app.

CBPeripheralManagerDelegate

A protocol that provides updates for local peripheral state and interactions with remote central devices.

CBAttribute

A representation of common aspects of services offered by a peripheral.

CBAttributePermissions

Values that represent the read, write, and encryption permissions for a characteristic’s value.