RVS_BTDriver_OBD_MacOS_Test_Harness_ViewController

class RVS_BTDriver_OBD_MacOS_Test_Harness_ViewController : RVS_BTDriver_OBD_MacOS_Test_Harness_Base_ViewController
extension RVS_BTDriver_OBD_MacOS_Test_Harness_ViewController: NSTableViewDelegate
extension RVS_BTDriver_OBD_MacOS_Test_Harness_ViewController: NSTableViewDataSource

This view controller manages the main device selection screen.

Static Properties

  • This is the segue ID for the “show details” transition.

    Declaration

    Swift

    static let showDetailsSegueID: String
  • This is KVO

    Declaration

    Swift

    @objc
    dynamic public var isScanning: Bool { get set }

    Return Value

    true, if all of the vendor interfaces have Bluetooth powered on.

  • This is the image that is displayed if there is no bluetooth available.

    Declaration

    Swift

    @IBOutlet
    weak var noBTImageView: NSImageView!
  • This is the checkbox that reflects the scanning state.

    Declaration

    Swift

    @IBOutlet
    weak var scanningCheckbox: NSButton!
  • This is the image that is displayed if there is no bluetooth available.

    Declaration

    Swift

    @IBOutlet
    weak var deviceTableView: NSTableView!
  • This contains all the devices we will display.

    Declaration

    Swift

    var deviceList: [RVS_BTDriver_DeviceProtocol]
  • This will hold a selected device, for presentation to the user. It is ephemeral.

    Declaration

    Swift

    var selectedDevice: RVS_BTDriver_DeviceProtocol!
  • Called when we’re going away. This needs to be in the main declaration area. You can’t have it in extensions.

    Declaration

    Swift

    deinit

Superclass Overrides

  • Called when the view has completed loading.

    Declaration

    Swift

    override func viewDidLoad()
  • Called just before we bring in a device instance screen.

    Declaration

    Swift

    override func prepare(for inSegue: NSStoryboardSegue, sender inDevice: Any?)

    Parameters

    for

    The Segue instance

    sender

    Data being associated. In this case, it is the device to associate with the screen.

Instance Methods

  • This just sets up the UI to match the current driver state.

    Declaration

    Swift

    func setUpUI()
  • This scans the driver for OBD devices, loads them, and reloads the table data.

    Declaration

    Swift

    func reloadDevices()

NSTableViewDelegate Support

  • This is called when a row is selected. We match the device to the row, set that in the semaphore, and approve the selection.

    Declaration

    Swift

    func tableView(_ inTableView: NSTableView, shouldSelectRow inRow: Int) -> Bool

    Parameters

    inTableView

    The table instance.

    shouldSelectRow

    0-based Int, with the index of the row, within the column.

    Return Value

    False (always).

  • This is called to supply the string display for one row that corresponds to a device.

    Declaration

    Swift

    func tableView(_ inTableView: NSTableView, objectValueFor inTableColumn: NSTableColumn?, row inRow: Int) -> Any?

    Parameters

    inTableView

    The table instance.

    objectValueFor

    Container object for the column that holds the row.

    row

    0-based Int, with the index of the row, within the column.

    Return Value

    A new String, with the device name.

  • Called after the selection was set up and approved.

    Declaration

    Swift

    func tableViewSelectionDidChange(_: Notification)

NSTableViewDataSource Support

  • Called to supply the number of rows in the table.

    Declaration

    Swift

    func numberOfRows(in inTableView: NSTableView) -> Int

    Parameters

    inTableView

    The table instance.

    Return Value

    A 1-based Int, with 0 being no rows.