CGA_CharacteristicViewController

class CGA_CharacteristicViewController : CGA_BaseViewController
extension CGA_CharacteristicViewController: CGA_UpdatableScreenViewController
extension CGA_CharacteristicViewController: UITableViewDataSource
extension CGA_CharacteristicViewController: UITableViewDelegate
  • Each element of the table data is a struct, with a label, atarget, and an action function

    See more

    Declaration

    Swift

    struct TableRowStruct
  • The reuse ID for rows with just a label.

    Declaration

    Swift

    static let labelTableCellReuseID: String
  • The Service wrapper instance for this Service.

    Declaration

    Swift

    var characteristicInstance: CGA_Bluetooth_Characteristic!
  • This defines the data that we’ll use to populate the table.

    Declaration

    Swift

    var tableRowData: [TableRowStruct]
  • This label displays the device name.

    Declaration

    Swift

    @IBOutlet
    weak var nameLabel: UILabel!
  • The table that displays the Characteristics.

    Declaration

    Swift

    @IBOutlet
    weak var descriptorsTableView: UITableView!

Special Table Response Methods

  • Tells the Characteristic to switch its notify state.

    Declaration

    Swift

    func toggleCharacteristicNotify(_ inCharacteristic: Any)
  • Tells the Characteristic to read.

    Declaration

    Swift

    func readCharacteristicData(_ inCharacteristic: Any)
  • Tells the Descriptor to read.

    Declaration

    Swift

    func readDescriptorData(_ inDescriptor: Any)

Instance Methods

  • This sets up the accessibility and voiceover strings for the screen.

    Declaration

    Swift

    func setUpAccessibility()
  • This establishes the data that we’ll use for our table.

    Declaration

    Swift

    func populateTableData()
  • This establishes the data that we’ll use for our table.

    Declaration

    Swift

    func populateTableData2()

Base Class Overrides

  • Called just after the view hierarchy has loaded.

    Declaration

    Swift

    override func viewDidLoad()
  • Called just before the view will appear. We use this to ensure that we are disconnected.

    Declaration

    Swift

    override func viewWillAppear(_ inAnimated: Bool)

    Parameters

    inAnimated

    ignored, but passed to the superclas.

CGA_UpdatableScreenViewController Conformance

  • This simply makes sure that the table is displayed if BT is available, or the “No BT” image is shown, if it is not.

    Declaration

    Swift

    func updateUI()

UITableViewDataSource Conformance

  • Called to provide the data to display in the indicated table cell.

    Declaration

    Swift

    func tableView(_ inTableView: UITableView, cellForRowAt inIndexPath: IndexPath) -> UITableViewCell

    Parameters

    inTableView

    The Table View that is asking for this View.

    cellForRowAt

    The IndexPath of the cell.

    Return Value

    A new view, set up for the indicated cell.

  • Declaration

    Swift

    func tableView(_: UITableView, numberOfRowsInSection: Int) -> Int

    Return Value

    The number of rows in the table.

UITableViewDelegate Conformance

  • Called when a row is about to be highlighted.

    Declaration

    Swift

    func tableView(_: UITableView, shouldHighlightRowAt inIndexPath: IndexPath) -> Bool

    Parameters

    shouldHighlightRowAt

    The IndexPath of the selected row.

    Return Value

    True (allow row to highlight), or false (don’t allow)..

  • Called when a row is about to be selected.

    Declaration

    Swift

    func tableView(_: UITableView, willSelectRowAt inIndexPath: IndexPath) -> IndexPath?

    Parameters

    willSelectRowAt

    The IndexPath of the selected row.

    Return Value

    Either nil (don’t select), or the given index path.

  • Called when a row is selected.

    Declaration

    Swift

    func tableView(_: UITableView, didSelectRowAt inIndexPath: IndexPath)

    Parameters

    didSelectRowAt

    The IndexPath of the selected row.