Peripheral

public class Peripheral : NSObject

An interface to the Bluetooth peripheral.

  • The UUID of the peripheral.

    Declaration

    Swift

    public var uuid: PeripheralIdentifier { get }
  • Returns the name of the peripheral. If name is not available, return the uuid string.

    Declaration

    Swift

    public var name: String { get }
  • Requests the current RSSI value from the peripheral, and the value is returned via the RSSIObserver delegation.

    Declaration

    Swift

    public func readRSSI()
  • Register a RSSI observer that can receive the RSSI value when readRSSI is called.

    Declaration

    Swift

    public func register(observer: RSSIObserver)
  • Unregister a RSSI observer.

    Declaration

    Swift

    public func unregister(observer: RSSIObserver)
  • Ask for the peripheral’s maximum payload length in bytes for a single write request.

    Declaration

    Swift

    public func maximumWriteValueLength(for writeType: CBCharacteristicWriteType) -> Int
  • Captures CoreBluetooth’s did discover services event and pass it to Bluejay’s queue for processing.

    Declaration

    Swift

    public func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?)
  • Captures CoreBluetooth’s did discover characteristics event and pass it to Bluejay’s queue for processing.

    Declaration

    Swift

    public func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?)
  • Captures CoreBluetooth’s did write to charactersitic event and pass it to Bluejay’s queue for processing.

    Declaration

    Swift

    public func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Error?)
  • Captures CoreBluetooth’s did receive a notification/value from a characteristic event and pass it to Bluejay’s queue for processing.

    Declaration

    Swift

    public func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?)
  • Captures CoreBluetooth’s did turn on or off notification/listening on a characteristic event and pass it to Bluejay’s queue for processing.

    Declaration

    Swift

    public func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?)
  • Captures CoreBluetooth’s did read RSSI event and pass it to Bluejay’s queue for processing.

    Declaration

    Swift

    public func peripheral(_ peripheral: CBPeripheral, didReadRSSI RSSI: NSNumber, error: Error?)