RVS_BTDriver_MacOS_Test_Harness_Main_ViewController

class RVS_BTDriver_MacOS_Test_Harness_Main_ViewController : RVS_BTDriver_MacOS_Test_Harness_Base_ViewController
extension RVS_BTDriver_MacOS_Test_Harness_Main_ViewController: NSTableViewDelegate, NSTableViewDataSource

This class controls the main listing screen (the one that displays a list of devices).

Instance Constants

  • The column ID for the device name.

    Declaration

    Swift

    let deviceNameID: String
  • The column ID for the “Is Connected” text.

    Declaration

    Swift

    let isConnectedID: String
  • This will hold a selected device, for presentation to the user. It is ephemeral.

    Declaration

    Swift

    var selectedDevice: RVS_BTDriver_DeviceProtocol!

IB Properties

  • The checkbox for “scanning” state.

    Declaration

    Swift

    @IBOutlet
    weak var scanningCheckbox: NSButton!
  • The “No Bluetooth” image.

    Declaration

    Swift

    @IBOutlet
    weak var noBTImage: NSImageView!
  • A table, containing rows for the discovered devices.

    Declaration

    Swift

    @IBOutlet
    weak var deviceListTable: NSTableView!

Instance Methods

  • Simply forces the table to reload.

    Declaration

    Swift

    func reloadTable()

Base Class Override Methods

  • Called after the view has loaded and initialized from the storyboard.

    Declaration

    Swift

    override func viewDidLoad()

NSTableViewDelegate/DataSource Methods

  • 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.

  • 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 String, with the device name.

  • 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).

  • Called after the selection was set up and approved.

    We open a modal window, with the device info.

    Declaration

    Swift

    func tableViewSelectionDidChange(_: Notification)
  • Declaration

    Swift

    func setup()