MacOS_DiscoveryViewController

class MacOS_DiscoveryViewController : RVS_BlueThoth_MacOS_Test_Harness_Base_SplitView_ViewController
extension MacOS_DiscoveryViewController: MacOS_ControllerList_Protocol

This is the permanent Device Discovery Screen. It is the leftmost screen, and contains a table that is updated as the discovery scanning goes on.

  • The font size for the Connect/Disconnect of each device.

    Declaration

    Swift

    static let buttonFontSize: Int
  • The font size for the header of each device.

    Declaration

    Swift

    let headerRowFontSize: Int
  • The padding around that header (above and below)

    Declaration

    Swift

    let headerPadding: Int
  • This is the font size for the information about each discovery (below the header).

    Declaration

    Swift

    let infoRowFontSize: Int
  • The padding around that text (above and below)

    Declaration

    Swift

    let infoPadding: Int
  • This enum has the scanning on/off states, expressed as 0-based Int.

    See more

    Declaration

    Swift

    enum ScanningModeSwitchValues : Int
  • This is the minimum width of the discovery section.

    Declaration

    Swift

    static let screenThickness: CGFloat
  • key

    This is a String key that uniquely identifies this screen.

    Declaration

    Swift

    let key: String
  • The currently selected device (nil, if no device selected).

    Declaration

    Swift

    var selectedDevice: RVS_BlueThoth.DiscoveryData?
  • This is a segmented switch that reflects the state of the scanning.

    Declaration

    Swift

    @IBOutlet
    weak var scanningModeSegmentedSwitch: NSSegmentedControl!
  • This is the image that is shown if Bluetooth is not available.

    Declaration

    Swift

    @IBOutlet
    weak var noBTImage: NSImageView!
  • This is the “Start Over From Scratch” button.

    Declaration

    Swift

    @IBOutlet
    weak var reloadButton: NSButton!
  • This is the stack view that we populate with the discovery data.

    Declaration

    Swift

    @IBOutlet
    weak var stackView: NSStackView!
  • This is the scroller that contains that stack view.

    Declaration

    Swift

    @IBOutlet
    weak var scrollView: NSScrollView!
  • This returns the peripherals, in a sorted order.

    Declaration

    Swift

    var sortedPeripherals: [RVS_BlueThoth.DiscoveryData] { get }

Private Methods

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

    Declaration

    Swift

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

  • This creates a single device row for the given index (in the sorted staged peripherals list).

    See more

    Declaration

    Swift

    private func _createTableRowViewFor(_ inRow: Int)

    Parameters

    inRow

    The 0-based index of the staged Discovery Info.

  • This wipes and reloads the deive list stack view.

    Declaration

    Swift

    private func _reloadStackView()

Base Class Overrides

  • Called when the view hierachy has loaded.

    Declaration

    Swift

    override func viewDidLoad()
  • Called just before the screen appears. We use this to register with the app delegate.

    Declaration

    Swift

    override func viewWillAppear()
  • Called just before the screen disappears. We use this to un-register with the app delegate.

    Declaration

    Swift

    override func viewWillDisappear()
  • Sets up the various accessibility labels.

    Declaration

    Swift

    override func setUpAccessibility()

IBAction Handlers

  • Called when the scanning/not scanning segmented switch changes.

    Declaration

    Swift

    @IBAction
    func scanningChanged(_ inSwitch: NSSegmentedControl)

    Parameters

    inSwitch

    The switch object.

  • This is the “Start Over From Scratch” button.

    Declaration

    Swift

    @IBAction
    func reloadButtonHit(_: NSButton)
  • Called when the Connect/Disconnect button is hit.

    Declaration

    Swift

    @IBAction
    func connectButtonHit(_ inButton: MacOS_Clicker)

    Parameters

    inButton

    The button, cast to our special class that associates a device.

MacOS_Base_ViewController_Protocol Conformance

  • This forces the UI elements to be updated.

    Declaration

    Swift

    func updateUI()