Table of Contents

Class CBPeripheral

Namespace
CoreBluetooth
public class CBPeripheral : IDisposable
Inheritance
CBPeripheral
Implements

Properties

CallbackContext

ICBPeripheralDelegate callbacks will be called in this context.

public SynchronizationContext CallbackContext { get; set; }

Property Value

SynchronizationContext

CanSendWriteWithoutResponse

public bool CanSendWriteWithoutResponse { get; }

Property Value

bool

Delegate

public ICBPeripheralDelegate Delegate { get; set; }

Property Value

ICBPeripheralDelegate

Identifier

public string Identifier { get; }

Property Value

string

Name

public string Name { get; }

Property Value

string

Services

public ReadOnlyCollection<CBService> Services { get; }

Property Value

ReadOnlyCollection<CBService>

State

The connection state of the peripheral.

public CBPeripheralState State { get; }

Property Value

CBPeripheralState

Methods

DiscoverCharacteristics(CBService)

Discover all characteristics in a service (slow).

public void DiscoverCharacteristics(CBService service)

Parameters

service CBService

DiscoverCharacteristics(string[], CBService)

Discovers the specified characteristics of a service.

public void DiscoverCharacteristics(string[] characteristicUUIDs, CBService service)

Parameters

characteristicUUIDs string[]
service CBService

DiscoverServices(string[])

Discovers the specified services of the peripheral. If the servicesUUIDs parameter is nil, this method returns all of the peripheral’s available services. This is much slower than providing an array of service UUIDs to search for.

public void DiscoverServices(string[] serviceUUIDs = null)

Parameters

serviceUUIDs string[]

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetMaximumWriteValueLength(CBCharacteristicWriteType)

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

public int GetMaximumWriteValueLength(CBCharacteristicWriteType type)

Parameters

type CBCharacteristicWriteType

Returns

int

ReadRSSI()

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

public void ReadRSSI()

ReadValue(CBCharacteristic)

Retrieves the value of a specified characteristic. When you call this method to read the value of a characteristic, the peripheral calls the peripheral(_:didUpdateValueFor:error:) method of its delegate object. If the peripheral successfully reads the value of the characteristic, you can access it through the characteristic’s value property.

public void ReadValue(CBCharacteristic characteristic)

Parameters

characteristic CBCharacteristic

SetNotifyValue(bool, CBCharacteristic)

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

public void SetNotifyValue(bool enabled, CBCharacteristic characteristic)

Parameters

enabled bool
characteristic CBCharacteristic

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

WriteValue(byte[], CBCharacteristic, CBCharacteristicWriteType)

public void WriteValue(byte[] data, CBCharacteristic characteristic, CBCharacteristicWriteType type)

Parameters

data byte[]
characteristic CBCharacteristic
type CBCharacteristicWriteType