CGA_Bluetooth_Descriptor

public class CGA_Bluetooth_Descriptor : CGA_Bluetooth_Descriptor_Protocol_Internal, CGA_Bluetooth_Writable, CGA_Class_Protocol
extension CGA_Bluetooth_Descriptor: CGA_DescriptorFactory

This class “wraps” instances of CBDescriptor, adding some functionality, and linking the hierarchy.

Public Properties

  • If the Descriptor has a value, it is returned here. It is completely untyped, as each descriptor has its own types.

    Declaration

    Swift

    public var value: Any? { get }
  • This attempts to cast the value of the Descriptor into a Data object.

    Declaration

    Swift

    public var dataValue: Data? { get }
  • If the Descriptor has a value, and that value can be expressed as a String, it is returned here.

    Declaration

    Swift

    public var stringValue: String? { get }
  • Returns the number (if possible) as an Int64. This assumes littlendian. This computed property is defined here, so it can be overridden by subclasses.

    Declaration

    Swift

    public var intValue: Int64? { get }
  • Returns the number (if possible) as a UInt8. This computed property is defined here, so it can be overridden by subclasses.

    Declaration

    Swift

    public var uInt8Value: UInt8? { get }
  • Returns the number (if possible) as a UInt16. This computed property is defined here, so it can be overridden by subclasses.

    Declaration

    Swift

    public var uInt16Value: UInt16? { get }
  • Returns the number (if possible) as a UInt32. This computed property is defined here, so it can be overridden by subclasses.

    Declaration

    Swift

    public var uInt32Value: UInt32? { get }
  • Returns the number (if possible) as a UInt64. This computed property is defined here, so it can be overridden by subclasses.

    Declaration

    Swift

    public var uInt64Value: UInt64? { get }
  • Returns the value as a Boolean. It should be noted that ANY non-zero number will return true. This computed property is defined here, so it can be overridden by subclasses.

    Declaration

    Swift

    public var boolValue: Bool? { get }
  • Returns the value as a Double. This computed property is defined here, so it can be overridden by subclasses.

    Declaration

    Swift

    public var doubleValue: Double? { get }
  • id

    This returns a unique UUID String for the instance.

    Declaration

    Swift

    public var id: String { get }
  • This holds the instance of CBDescriptor that is used by this instance.

    Declaration

    Swift

    public weak var cbElementInstance: CBDescriptor?

Public Methods

  • The Peripheral is asked to read our value.

    Declaration

    Swift

    public func readValue()
  • The Peripheral is asked to write the given data into its value.

    Declaration

    Swift

    public func writeValue(_ inData: Data)

    Parameters

    inData

    The Data instance to write.

Internal Properties

  • Root class does nothing.

    Declaration

    Swift

    internal class var uuid: String { get }
  • This is used to reference an “owning instance” of this instance, and it should be a CGA_Bluetooth_Characteristic

    Declaration

    Swift

    public weak var parent: CGA_Class_Protocol?
  • This casts the parent as a Characteristic Wrapper.

    Declaration

    Swift

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

    Declaration

    Swift

    internal var scanCriteria: RVS_BlueThoth.ScanCriteria? { get }
  • This returns the parent Central Manager

    Declaration

    Swift

    public var central: RVS_BlueThoth? { get }
  • Required init. Doesn’t do anything, but we have to have it for the factory.

    Declaration

    Swift

    internal required init()

CGA_DescriptorFactory Conformance

  • This creates an instance of the class, using the subclass-defined factory method.

    Declaration

    Swift

    internal class func createInstance(parent inParent: CGA_Bluetooth_Characteristic, cbElementInstance inCBDescriptor: CBDescriptor) -> CGA_Bluetooth_Descriptor?

    Parameters

    parent

    The Characteristic that “owns” this Service

    cbElementInstance

    The CB element for this Service.

    Return Value

    A new instance of CGA_Bluetooth_Descriptor, or a subclass, thereof. Nil, if it fails.