RVS_BTDriver_OBD_MacOS_Test_Harness_Device_ViewController

class RVS_BTDriver_OBD_MacOS_Test_Harness_Device_ViewController : RVS_BTDriver_OBD_MacOS_Test_Harness_Base_Device_ViewController
extension RVS_BTDriver_OBD_MacOS_Test_Harness_Device_ViewController: NSTextFieldDelegate

This controls a screen that allows a direct command/response with each device, and also allows a “details” screen to appear, listing the device state.

Static Properties

  • This is the storyboard instantiation ID.

    Declaration

    Swift

    static let storyboardID: String
  • The label for the enter text field.

    Declaration

    Swift

    @IBOutlet
    weak var enterTextLabel: NSTextField!
  • The text entry field, where the user types in the command.

    Declaration

    Swift

    @IBOutlet
    weak var enterTextField: NSTextField!
  • the button the user presses to send the command.

    Declaration

    Swift

    @IBOutlet
    weak var sendTextButton: NSButton!
  • The label for the response display.

    Declaration

    Swift

    @IBOutlet
    weak var responseDisplayLabel: NSTextField!
  • The text view portion of the scrollable area for the response.

    Declaration

    Swift

    @IBOutlet
    var responseTextView: NSTextView!
  • This is the button that calls out the details modal sheet.

    Declaration

    Swift

    @IBOutlet
    weak var detailsCalloutButton: NSButton!
  • This is the button that calls out the commands modal sheet.

    Declaration

    Swift

    @IBOutlet
    weak var commandsButton: NSButton!

RVS_BTDriver_OBD_DeviceDelegate Handlers

  • This is called when an OBD device updates its transaction.

    Declaration

    Swift

    override func deviceUpdatedTransaction(_ inTransaction: RVS_BTDriver_OBD_Device_TransactionStruct)

    Parameters

    inTransaction

    The transaction that was updated. It may be nil.

RVS_BTDriver_DeviceSubscriberProtocol Handlers

  • Error reporting method.

    Since the driver will handle displaying the error, all we do, is clean up the UX.

    Declaration

    Swift

    override func subscribedDevice(_ device: RVS_BTDriver_DeviceProtocol, encounteredThisError inError: RVS_BTDriver.Errors)

    Parameters

    inDevice

    The RVS_BTDriver_OBD_DeviceProtocol instance that encountered the error.

    encounteredThisError

    The error that was encountered.

NSTextFieldDelegate Methods

  • Called when text changes in the send text box.

    Declaration

    Swift

    func controlTextDidChange(_ inNotification: Notification)

    Parameters

    inNotification

    The notification object for the text field.

IBAction Methods

  • This will initiate a data send to the device, using whatever is in the command text field.

    Declaration

    Swift

    @IBAction
    func sendButtonHit(_: Any)

Instance Methods

  • Sets up the UI elements.

    Declaration

    Swift

    func setUpUI()

Base Class Override Methods

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

    Declaration

    Swift

    override func viewDidLoad()
  • When we are about to appear, we register with the app delegate object.

    Declaration

    Swift

    override func viewWillAppear()
  • We remove ourselves when we are about to go away.

    Declaration

    Swift

    override func viewWillDisappear()
  • Called just before we bring in a device details 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.

RVS_BTDriver_DeviceSubscriberProtocol Handlers

  • Called if the device state changes, in some way.

    Declaration

    Swift

    func deviceStatusUpdate(_ inDevice: RVS_BTDriver_DeviceProtocol)

    Parameters

    inDevice

    The device instance that is calling this.