MacOS_AppDelegate
@NSApplicationMain
class MacOS_AppDelegate : NSObject, NSApplicationDelegate
extension MacOS_AppDelegate: CGA_BlueThoth_Delegate
-
This is the unique key for the device discovery panel.
Declaration
Swift
static let deviceScreenID: String -
This is the length of our timeout, in seconds.
Declaration
Swift
static let timeoutInSeconds: TimeInterval -
This is the menu item for the main app menu. It allows us to customize the text.
Declaration
Swift
@IBOutlet weak var appNameMenuTitle: NSMenuItem! -
This is the menu item for the about item. It allows us to customize the text.
Declaration
Swift
@IBOutlet weak var aboutMenuItem: NSMenuItem! -
This is the menu item for the quit item. It allows us to customize the text.
Declaration
Swift
@IBOutlet weak var quitMenuItem: NSMenuItem! -
The help menu item.
Declaration
Swift
@IBOutlet weak var helpMenuItem: NSMenuItem! -
The “hide this app” menu item.
Declaration
Swift
@IBOutlet weak var hideMenuItem: NSMenuItem! -
This is the Bluetooth Central Manager instance. Everything goes through this.
Declaration
Swift
var centralManager: RVS_BlueThoth? -
This will contain our persistent prefs
Declaration
Swift
var prefs: CGA_PersistentPrefs -
This has our open windows.
Declaration
Swift
var screenList: [MacOS_ControllerList_Protocol] -
This is true, if the main window is open.
Declaration
Swift
@objc dynamic var mainSreenOpen: Bool { get }
-
Called when the app has completed launching.
Declaration
Swift
func applicationDidFinishLaunching(_: Notification)
-
This is a quick way to get this object instance (it’s a SINGLETON), cast as the correct class.
Declaration
Swift
@objc dynamic class var appDelegateObject: MacOS_AppDelegate { get }Return Value
the app delegate object, in its natural environment.
-
This displays a simple alert, with an OK button.
Declaration
Swift
class func displayAlert(header inHeader: String, message inMessage: String = "")Parameters
headerThe header to display at the top.
messageA String, containing whatever messge is to be displayed below the header.
-
Updates a single screen UI.
Declaration
Swift
func updateScreen(_ inScreenID: String)Parameters
inScreenIDA String, with the unique ID of the screen.
-
This closes any open screens, and disconnects any connected Peripherals.
Declaration
Swift
func collapseSplit()
-
Handles an error from the SDK.
Declaration
Swift
func handleError(_ inError: CGA_Errors, from inCentralInstance: RVS_BlueThoth)Parameters
inErrorThe error that occurred.
fromThe Central instance that experienced the error.
-
This is called to tell the instance to do whatever it needs to do to update its data. NOTE: There may be no changes, or many changes. What has changed is not specified.
Declaration
Swift
func updateFrom(_ inCentralInstance: RVS_BlueThoth)Parameters
inCentralInstanceThe central manager that is calling this.
-
This is called to tell the instance that a Peripheral device has been connected.
Declaration
Swift
func centralManager(_ inCentralInstance: RVS_BlueThoth, didConnectThisDevice inPeripheral: CGA_Bluetooth_Peripheral)Parameters
inCentralInstanceThe central manager that is calling this.
didConnectThisDeviceThe device instance that was connected.
-
Called prior to a device being disconnected.
Declaration
Swift
func centralManager(_ inCentralInstance: RVS_BlueThoth, willDisconnectThisDevice inDevice: CGA_Bluetooth_Peripheral)Parameters
inCentralInstanceThe central manager that is calling this.
willDisconnectThisDeviceThe device instance that will be disconnected.
-
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
inCentralManagerThe central manager that is calling this.
deviceInfoChangedThe device instance that was connected.
-
This is called to tell the instance that the state of the Central manager just became “powered on.”
Declaration
Swift
func centralManagerPoweredOn(_ inCentralInstance: RVS_BlueThoth)Parameters
inCentralInstanceThe central manager that is calling this.
-
This is 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
inCentralThe central manager that is calling this.
deviceThe device instance that contained the changed Service.
serviceThe Service instance that contained the changed Characteristic.
changedCharacteristicNotificationStateThe Characteristic that was changed.
-
This is called when a Peripheral announces a change to one of its Characteristics.
Declaration
Swift
func centralManager(_ inCentral: RVS_BlueThoth, device inDevice: CGA_Bluetooth_Peripheral, service inService: CGA_Bluetooth_Service, changedCharacteristic inCharacteristic: CGA_Bluetooth_Characteristic)Parameters
inCentralInstanceThe central manager that is calling this.
deviceThe Peripheral that contains the changed Characteristic.
serviceThe Service that contains the changed Characteristic.
changedCharacteristicThe Characteristic that has experienced the change.
-
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
inCentralManagerThe central manager that is calling this.
deviceThe device instance that contained the changed Service.
serviceThe Service instance that contained the changed Characteristic.
characteristicWriteCompleteThe Characteristic that had its write completed.
-
This is called to tell the instance that a Descriptor changed its value.
Declaration
Swift
public func centralManager(_ inCentral: RVS_BlueThoth, device inDevice: CGA_Bluetooth_Peripheral, service inService: CGA_Bluetooth_Service, characteristic inCharacteristic: CGA_Bluetooth_Characteristic, changedDescriptor inDescriptor: CGA_Bluetooth_Descriptor)Parameters
centralManagerThe central manager that is calling this.
deviceThe device instance that contained the changed Service.
serviceThe Service instance that contained the changed Characteristic.
characteristicThe Characteristic that contains the Descriptor that was changed.
changedDescriptorThe Descriptor that was changed.
View on GitHub
MacOS_AppDelegate Class Reference