Class CBPeripheral
- Namespace
- CoreBluetooth
A remote peripheral device. https://developer.apple.com/documentation/corebluetooth/cbperipheral
public class CBPeripheral : IDisposable
- Inheritance
-
CBPeripheral
- Implements
Properties
CallbackContext
ICBPeripheralDelegate callbacks will be called in this context.
public SynchronizationContext CallbackContext { get; set; }
Property Value
CanSendWriteWithoutResponse
public bool CanSendWriteWithoutResponse { get; }
Property Value
Delegate
public ICBPeripheralDelegate Delegate { get; set; }
Property Value
Identifier
public string Identifier { get; }
Property Value
Name
public string Name { get; }
Property Value
Services
public ReadOnlyCollection<CBService> Services { get; }
Property Value
State
The connection state of the peripheral.
public CBPeripheralState State { get; }
Property Value
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
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
Returns
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
boolcharacteristic
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
CBCharacteristictype
CBCharacteristicWriteType