CGA_WatchOS_ExtensionDelegate

class CGA_WatchOS_ExtensionDelegate : NSObject
extension CGA_WatchOS_ExtensionDelegate: WKExtensionDelegate
extension CGA_WatchOS_ExtensionDelegate: CGA_BlueThoth_Delegate

This is the main app extension delegate class.

Class Functions

  • Quick access to the extension delegate object.

    Declaration

    Swift

    class var extensionDelegateObject: CGA_WatchOS_ExtensionDelegate! { get }
  • Displays the given message and title in an alert with an “OK” button.

    Declaration

    Swift

    class func displayAlert(header inTitle: String, message inMessage: String = "")

    Parameters

    inTitle

    REQUIRED: a string to be displayed as the title of the alert. It is localized by this method.

    message

    OPTIONAL: a string to be displayed as the message of the alert. It is localized by this method.

    from

    REQUIRED: The controller presenting the error.

  • This special class function creates an Array of String, containing the advertisement data from the indexed device.

    Declaration

    Swift

    class func createAdvertimentStringsFor(_ inAdData: RVS_BlueThoth.AdvertisementData?, id inID: String, power inPower: Int) -> [String]

    Parameters

    inAdData

    The advertisement data.

    id

    The ID string.

    power

    The RSSI level.

    Return Value

    An Array of String, with the advertisement data in “key: value” form.

WKExtensionDelegate Conformance

  • This is called while the app is in the background, with various tasks that need to be handled.

    Declaration

    Swift

    func handle(_ inBackgroundTasks: Set<WKRefreshBackgroundTask>)

    Parameters

    inBackgroundTasks

    A set of background tasks that need to be taken care of.

CGA_BlueThoth_Delegate Conformance

  • Called to report an error.

    Declaration

    Swift

    func handleError(_ inError: CGA_Errors, from inCentralManager: RVS_BlueThoth)

    Parameters

    inError

    The error being reported.

    from

    The manager wrapper view that is calling this.

  • Called to tell this controller to recalculate the discovery table.

    Declaration

    Swift

    func updateFrom(_ inCentralManager: RVS_BlueThoth)

    Parameters

    inCentralManager

    The manager wrapper view that is calling this.

  • Called to tell the instance that the state of the Central manager just became “powered on.”

    Declaration

    Swift

    func centralManagerPoweredOn(_ inCentralManager: RVS_BlueThoth)

    Parameters

    inCentralManager

    The central manager that is calling this.

  • Called to tell the instance that a Peripheral device has been connected.

    Declaration

    Swift

    func centralManager(_ inCentralManager: RVS_BlueThoth, didConnectThisDevice inDevice: CGA_Bluetooth_Peripheral)

    Parameters

    inCentralManager

    The central manager that is calling this.

    didConnectThisDevice

    The device instance that was connected.

  • Called to tell the instance that a peripheral device is about to be disconnected. We use this to reset the view stack to the initial (Peripheral List) screen.

    Declaration

    Swift

    func centralManager(_ inCentralManager: RVS_BlueThoth, willDisconnectThisDevice inDevice: CGA_Bluetooth_Peripheral)

    Parameters

    inCentralManager

    The central manager that is calling this.

    willDisconnectThisDevice

    The device instance that will be removed after this call.

  • This is called to tell the instance that a Peripheral device has had some change.

    Declaration

    Swift

    func centralManager(_ inCentralManager: RVS_BlueThoth, deviceInfoChanged inDevice: CGA_Bluetooth_Peripheral)

    Parameters

    inCentralManager

    The central manager that is calling this.

    deviceInfoChanged

    The device instance that was connected.

  • Called to tell the instance that a Service changed.

    Declaration

    Swift

    func centralManager(_ inCentralManager: RVS_BlueThoth, device inDevice: CGA_Bluetooth_Peripheral, changedService inService: CGA_Bluetooth_Service)

    Parameters

    inCentralManager

    The central manager that is calling this.

    device

    The device instance that contained the changed Service.

    changedService

    The Service instance that contained the changed Characteristic.

  • Called to tell the instance that a Characteristic changed its value.

    Declaration

    Swift

    func centralManager(_ inCentralManager: RVS_BlueThoth, device inDevice: CGA_Bluetooth_Peripheral, service inService: CGA_Bluetooth_Service, changedCharacteristic inCharacteristic: CGA_Bluetooth_Characteristic)

    Parameters

    inCentralManager

    The central manager that is calling this.

    device

    The device instance that contained the changed Service.

    service

    The Service instance that contained the changed Characteristic.

    changedCharacteristic

    The Characteristic that was changed.

  • Called to tell the instance that a Characteristic changed its notification state.

    Declaration

    Swift

    func centralManager(_ inCentral: RVS_BlueThoth, device inDevice: CGA_Bluetooth_Peripheral, service inService: CGA_Bluetooth_Service, changedCharacteristicNotificationState inCharacteristic: CGA_Bluetooth_Characteristic)

    Parameters

    inCentralManager

    The central manager that is calling this.

    device

    The device instance that contained the changed Service.

    service

    The Service instance that contained the changed Characteristic.

    changedCharacteristicNotificationState

    The Characteristic that was changed.

  • Called to tell the instance that a Descriptor changed.

    Declaration

    Swift

    func centralManager(_ inCentralManager: RVS_BlueThoth, device inDevice: CGA_Bluetooth_Peripheral, service inService: CGA_Bluetooth_Service, characteristic inCharacteristic: CGA_Bluetooth_Characteristic, changedDescriptor inDescriptor: CGA_Bluetooth_Descriptor)

    Parameters

    inCentralManager

    The central manager that is calling this.

    device

    The device instance that contained the changed Service.

    service

    The Service instance that contained the changed Characteristic.

    characteristic

    The Characteristic that contains the Descriptor that was changed.

    changedDescriptor

    The Descriptor that was changed.

  • This is called to tell the instance that a Characteristic write with response received its response.

    Declaration

    Swift

    func centralManager(_ inCentralManager: RVS_BlueThoth, device inPeripheral: CGA_Bluetooth_Peripheral, service inService: CGA_Bluetooth_Service, characteristicWriteComplete inCharacteristic: CGA_Bluetooth_Characteristic)

    Parameters

    inCentralManager

    The central manager that is calling this.

    device

    The device instance that contained the changed Service.

    service

    The Service instance that contained the changed Characteristic.

    characteristicWriteComplete

    The Characteristic that had its write completed.