Array

public extension Array where Element == RVS_BlueThoth.DiscoveryData
public extension Array where Element == CGA_Bluetooth_Peripheral
public extension Array where Element: CBAttribute
public extension Array where Element == CGA_Bluetooth_Characteristic
public extension Array where Element == CGA_Bluetooth_Descriptor_Protocol
public extension Array where Element == CGA_Bluetooth_Service

This allows us to fetch Peripherals in our staged Arrays, looking for an exact instance.

Available where Element == RVS_BlueThoth.DiscoveryData

  • Special subscript that allows us to retrieve an Element by its contained Peripheral (as the opaque type).

    Declaration

    Swift

    subscript(inItem: Element) -> Element? { get }

    Parameters

    inItem

    The Peripheral we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • Special subscript that allows us to retrieve an Element by its contained Peripheral

    Declaration

    Swift

    subscript(inItem: CBPeripheral) -> Element? { get }

    Parameters

    inItem

    The Peripheral we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • Special subscript that allows us to retrieve an Element by its ID (String)

    Declaration

    Swift

    subscript(inID: String) -> Element? { get }

    Parameters

    inID

    The UUID/Identifier of Peripheral we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • Removes the element (as the opaque type).

    Declaration

    Swift

    @discardableResult
    mutating func removeThisDevice(_ inItem: Element) -> Bool

    Parameters

    inItem

    The CB element we’re looking to remove, as the opaque type.

    Return Value

    True, if the item was found and removed. Can be ignored.

  • Checks to see if the Array contains an instance that wraps the given CB element (as the opaque type).

    Declaration

    Swift

    func contains(_ inItem: Element) -> Bool

    Parameters

    inItem

    The CB element we’re looking to match.

    Return Value

    True, if the Array contains a wrapper for the given element.

  • Checks to see if the Array contains an instance that wraps the given CB element.

    Declaration

    Swift

    func contains(_ inItem: CBPeripheral) -> Bool

    Parameters

    inItem

    The CB element we’re looking to match.

    Return Value

    True, if the Array contains a wrapper for the given element.

Available where Element == CGA_Bluetooth_Peripheral

  • Special subscript that allows us to retrieve an Element by its UUID

    Declaration

    Swift

    subscript(inItem: CBUUID) -> Element? { get }

    Parameters

    inItem

    The UUID of the item we want

    Return Value

    The found Element, or nil, if not found.

  • Special subscript that allows us to retrieve an Element by its contained Peripheral

    Declaration

    Swift

    subscript(inItem: CBPeripheral) -> Element? { get }

    Parameters

    inItem

    The Peripheral we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • Method that allows us to retrieve an Element by its contained Characteristic

    Declaration

    Swift

    func characteristic(_ inItem: CBCharacteristic) -> CGA_Bluetooth_Characteristic?

    Parameters

    inItem

    The Characteristic that belongs to the element that we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • Checks to see if the Array contains an instance that wraps the given CB element.

    Declaration

    Swift

    func contains(_ inItem: CBPeripheral) -> Bool

    Parameters

    inItem

    The CB element we’re looking to match.

    Return Value

    True, if the Array contains a wrapper for the given element.

  • Removes the element (as a CBPeripheral).

    Declaration

    Swift

    @discardableResult
    mutating func removeThisDevice(_ inItem: CBPeripheral) -> Bool

    Parameters

    inItem

    The CB element we’re looking to remove, as the opaque type.

    Return Value

    True, if the item was found and removed. Can be ignored.

  • Returns the first index of the submitted Peripheral warapper.

    Declaration

    Swift

    func indexOf(_ inPeripheral: CGA_Bluetooth_Peripheral) -> Int

    Parameters

    inPeripheral

    The Peripheral to find.

Available where Element: CBAttribute

  • Special subscript that allows us to retrieve an Element by its UUID

    Declaration

    Swift

    subscript(inUUIDString: String) -> Element? { get }

    Parameters

    inItem

    The UUID of the item we want

    Return Value

    The found Element, or nil, if not found.

  • Special subscript that allows us to retrieve an Element by its contained Characteristic or CBService.

    Declaration

    Swift

    subscript(inItem: Element) -> Element? { get }

    Parameters

    inItem

    The CBCharacteristic/CBService we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

Available where Element == CGA_Bluetooth_Characteristic

  • Special subscript that allows us to retrieve an Element by its UUID

    Declaration

    Swift

    subscript(inItem: CBUUID) -> Element? { get }

    Parameters

    inItem

    The UUID of the item we want

    Return Value

    The found Element, or nil, if not found.

  • Special subscript that allows us to retrieve an Element by its contained Characteristic.

    Declaration

    Swift

    subscript(inItem: CBCharacteristic) -> Element? { get }

    Parameters

    inItem

    The CBCharacteristic we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • Removes the element (as a CBCharacteristic).

    Declaration

    Swift

    @discardableResult
    mutating func removeThisCharacteristic(_ inItem: CBCharacteristic) -> Bool

    Parameters

    inItem

    The CB element we’re looking to remove.

    Return Value

    True, if the item was found and removed. Can be ignored.

  • Checks to see if the Array contains an instance that wraps the given CB element.

    Declaration

    Swift

    func contains(_ inItem: CBCharacteristic) -> Bool

    Parameters

    inItem

    The CB element we’re looking to match.

    Return Value

    True, if the Array contains a wrapper for the given element.

Available where Element == CGA_Bluetooth_Descriptor_Protocol

  • Special subscript that allows us to retrieve an Element by its UUID

    Declaration

    Swift

    subscript(inItem: CBUUID) -> Element? { get }

    Parameters

    inItem

    The UUID of the item we want

    Return Value

    The found Element, or nil, if not found.

  • Special subscript that allows us to retrieve an Element by its contained Descriptor.

    Declaration

    Swift

    subscript(inItem: CBAttribute) -> Element? { get }

    Parameters

    inItem

    The CBDescriptor we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • Checks to see if the Array contains an instance that wraps the given CB element.

    Declaration

    Swift

    func contains(_ inItem: CBDescriptor) -> Bool

    Parameters

    inItem

    The CB element we’re looking to match.

    Return Value

    True, if the Array contains a wrapper for the given element.

Available where Element == CGA_Bluetooth_Service

  • Special subscript that allows us to retrieve an Element by its contained Service

    Declaration

    Swift

    subscript(inItem: CBService) -> Element? { get }

    Parameters

    inItem

    The CBService we’re looking to match.

    Return Value

    The found Element, or nil, if not found.

  • This subscript goes through our Services, looking for the one that “owns” the proferred Characteristic.

    Declaration

    Swift

    subscript(inItem: CBCharacteristic) -> Element? { get }

    Parameters

    inItem

    The CBCharacteristic that the Service will aggregate.

    Return Value

    The found Element, or nil, if not found.

  • This method goes through the Services, looking for the one that “owns” the proferred Characteristic, and then returning the “wrapper” for the Characteristic.

    Declaration

    Swift

    func characteristic(_ inItem: CBCharacteristic) -> CGA_Bluetooth_Characteristic?

    Parameters

    inItem

    The CBCharacteristic that the Service will aggregate.

    Return Value

    The found Element, or nil, if not found.

  • Removes the element (as a CBService).

    Declaration

    Swift

    @discardableResult
    mutating func removeThisService(_ inItem: CBService) -> Bool

    Parameters

    inItem

    The CB element we’re looking to remove.

    Return Value

    True, if the item was found and removed. Can be ignored.

  • Checks to see if the Array contains an instance that wraps the given CB element.

    Declaration

    Swift

    func contains(_ inItem: CBService) -> Bool

    Parameters

    inItem

    The CB element we’re looking to match.

    Return Value

    True, if the Array contains a wrapper for the given element.