CGA_Bluetooth_Peripheral

public class CGA_Bluetooth_Peripheral : NSObject, RVS_SequenceProtocol
extension CGA_Bluetooth_Peripheral: CGA_Class_Protocol_UpdateDescriptor

This class is instantiated when a Peripheral is connected, and will handle discovery of Services, Characteristics and Descriptors.

Public types, properties and methods.

  • This is the type we’re aggregating.

    Declaration

    Swift

    public typealias Element = CGA_Bluetooth_Service
  • This is our main cache Array. It contains wrapped instances of our aggregate CB type.

    Declaration

    Swift

    public var sequence_contents: Array<Element>
  • This is used to reference an “owning instance” of this instance, and it should be a CGA_Bluetooth_Parent instance.

    Declaration

    Swift

    public weak var parent: CGA_Class_Protocol?
  • This holds the discovery data that applies to this instance.

    Declaration

    Swift

    public var discoveryData: RVS_BlueThoth.DiscoveryData!
  • This returns the parent Central Manager

    Declaration

    Swift

    public var central: RVS_BlueThoth? { get }
  • Returns true, if we are currently connected.

    Declaration

    Swift

    public var isConnected: Bool { get }
  • The Peripheral is capable of sending writes back (without response).

    Declaration

    Swift

    public var canSendWriteWithoutResponse: Bool { get }
  • This is the signal strength, at the time of discovery, in dBm. This is also updated, as we receive RSSI change notifications.

    Declaration

    Swift

    public var rssi: Int { get }
  • This will contain any required scan criteria. It simply passes on the Central criteria.

    Declaration

    Swift

    public var scanCriteria: RVS_BlueThoth.ScanCriteria! { get }
  • id

    This returns a unique UUID String for the instance.

    Declaration

    Swift

    public var id: String { get }
  • The required init, with a “primed” sequence.

    Declaration

    Swift

    public required init(sequence_contents inSequence_Contents: [Element])

    Parameters

    sequence_contents

    The initial value of the Array cache.

  • Forces a connect. If already connected, nothing happens.

    Declaration

    Swift

    public func connect()
  • Forces a disconnect. If not connected, nothing happens.

    Declaration

    Swift

    public func disconnect()

Instance Methods

  • This eliminates all of the stored results, and asks the Bluetooth subsystem to start over from scratch.

    Declaration

    Swift

    public func startOver()

CGA_Class_UpdateDescriptor Conformance

  • This eliminates all of the stored and staged results.

    Declaration

    Swift

    public func clear()

CGA_Class_Protocol Conformance

  • This searches the hierarchy, and will return any instance that has an ID that matches the string passed in. This could be a Peripheral, Service, Characteristic or Descriptor. The response will need to be cast.

    Declaration

    Swift

    public func findEntityByUUIDString(_ inUUIDString: String) -> CGA_Class_Protocol?

    Parameters

    inUUIDString

    The String for the UUID for which we are searching.

    Return Value

    Any element in the hierarchy with a UUID that matches the one passed in, or nil.