RVS_BTDriver_OBD_Mac_Test_Harness_AppDelegate
@NSApplicationMain
class RVS_BTDriver_OBD_Mac_Test_Harness_AppDelegate : NSObject
extension RVS_BTDriver_OBD_Mac_Test_Harness_AppDelegate: NSApplicationDelegate
extension RVS_BTDriver_OBD_Mac_Test_Harness_AppDelegate: RVS_BTDriverDelegate
This is the main application delegate for the OBD-specialized test harness Mac app.
-
This is the internal holder for the driver instance. It is initialized as a singleton, the first time it’s accessed.
Declaration
Swift
private var _driverInstance: RVS_BTDriver!
-
This is the main viewcontroller.
Declaration
Swift
var mainViewController: RVS_BTDriver_OBD_MacOS_Test_Harness_ViewController!
-
We use this to hold a list of all the open device viewers. The hash is the UUID of the device, and the value is the view controller that applies to that device.
Declaration
Swift
var openDeviceControllers: [String : RVS_BTDriver_OBD_MacOS_Test_Harness_Device_ViewController]
-
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: RVS_BTDriver_OBD_Mac_Test_Harness_AppDelegate { get }
Return Value
the app delegate object, in its natural environment.
-
This is our instance of the actual BLE driver. We initialize the singleton, here.
Declaration
Swift
@objc dynamic var driverInstance: RVS_BTDriver! { get }
-
This indicates that the driver is scanning for new devices. If set to true, and the driver is initialized, the driver will start scanning (unless it is already scanning). If it is set to false, and the driver is initialized and scanning, the driver will stop scanning. Otherwise, it is ignored.
Declaration
Swift
@objc dynamic var isScanning: Bool { get set }
-
Returns true, if bluetooth is available. READ-ONLY
Declaration
Swift
@objc dynamic var isBTAvailable: Bool { get }
-
Declaration
Swift
func applicationDidFinishLaunching(_ notification: Notification)
-
This establishes the driver instance, wiping out any old one.
If the driver was previously scanning, it will start scanning again. This may mean that deleted devices get rediscovered.
Declaration
Swift
func setUpDriver()
-
This displays a simple alert, with an OK button.
Declaration
Swift
class func displayAlert(header inHeader: String, message inMessage: String = "")
Parameters
header
The header to display at the top.
message
A String, containing whatever messge is to be displayed below the header.
-
Simple error reporting method.
Declaration
Swift
func btDriver(_ inDriver: RVS_BTDriver, encounteredThisError inError: RVS_BTDriver.Errors)
Parameters
inDriver
The
RVS_BTDriver
instance that encountered the error.encounteredThisError
The error that was encountered.
-
Called when a new device is discovered while scanning.
Declaration
Swift
func btDriver(_ inDriver: RVS_BTDriver, newDeviceAdded inDevice: RVS_BTDriver_DeviceProtocol)
Parameters
inDriver
The
RVS_BTDriver
instance that is calling this.newDeviceAdded
The new device instance.
-
Called to indicate that the driver’s status should be checked.
It may be called frequently, and there may not be any changes. This is mereley a “make you aware of the POSSIBILITY of a change” call.
This is optional, and is NOT guaranteed to be called in the main thread.
Declaration
Swift
func btDriverStatusUpdate(_ inDriver: RVS_BTDriver)
Parameters
driver
The
RVS_BTDriver
instance calling this. -
Called to indicate that the driver started or stopped scanning.
This is optional, and is NOT guaranteed to be called in the main thread.
Declaration
Swift
func btDriverScanningChanged(_ driver: RVS_BTDriver, isScanning: Bool)
Parameters
driver
The
RVS_BTDriver
instance calling this.isScanning
True, if the new state is scanning is on.