CGA_ServiceViewController
class CGA_ServiceViewController : CGA_BaseViewController, CGA_ServiceContainer
extension CGA_ServiceViewController: CGA_UpdatableScreenViewController
extension CGA_ServiceViewController: UITableViewDataSource
extension CGA_ServiceViewController: UITableViewDelegate
This controls the Service Information View.
-
The reuse ID that we use for creating new table cells.
Declaration
Swift
private static let _characteristicRowReuseID: String -
The ID of the segue that is executed to display Characteristic details.
Declaration
Swift
private static let _characteristicDetailSegueID: String -
The ID of the segue that is executed to display the Interaction Screen.
Declaration
Swift
private static let _interactionSegueID: String -
The margin we use for our labels.
Declaration
Swift
private static let _marginToFlagLabel: CGFloat -
This implements a “pull to refresh.”
Declaration
Swift
private let _refreshControl: UIRefreshControl -
The Service that is associated with this view controller.
Declaration
Swift
var serviceInstance: CGA_Bluetooth_Service? -
This is the table that will list the discovered Services.
Declaration
Swift
@IBOutlet weak var characteristicsTableView: UITableView!
-
This sets up the accessibility and voiceover strings for the screen.
Declaration
Swift
func setUpAccessibility() -
This just resets the data aggregators for each Characteristic.
Declaration
Swift
private func _clearCharacteristicDataValues()
-
This is called by the table’s “pull to refresh” handler.
When this is called, the Service wipes out its Characteristics, and starts over from scratch.
Declaration
Swift
@objc func startOver(_: Any) -
This is a button callback for a tap in the read button, and the Characteristic can read. It toggles the notify state of the Characteristic.
Declaration
Swift
@objc func readTapped(_ inButton: CG_TappableButton)Parameters
inButtonThe special button, with our row index.
-
This is a button callback for a tap in the notify button, and the Characteristic can notify. It toggles the notify state of the Characteristic.
Declaration
Swift
@objc func notifyTapped(_ inButton: CG_TappableButton)Parameters
inButtonThe special button, with our row index.
-
This is a gesture callback for a double-tap in a row, and the Characteristic has descriptors. It causes the Descriptor List screen to appear.
Declaration
Swift
@objc func descriptorTapped(_ inGestureRecognizer: CG_TapGestureRecognizer)Parameters
inGestureRecognizerThe special gesture recognizer, with our row index.
-
This simply makes sure that the UI matches the state of the Service.
Declaration
Swift
func updateUI()
-
Called after the view data has been loaded.
Declaration
Swift
override func viewDidLoad() -
Called just before the view will appear.
Declaration
Swift
override func viewWillAppear(_ inAnimated: Bool) -
This is called just before we bring in the Characteristic or Interaction screen.
Declaration
Swift
override func prepare(for inSegue: UIStoryboardSegue, sender inSender: Any?)Parameters
forThe segue being executed.
senderThe data we want passed into the destination.
-
This struct is used to create a dynamic set of labels, indicating the Characteristic Properties.
See moreDeclaration
Swift
struct _PropertyLabelGenerator -
This returns the number of available rows, in the given section.
Declaration
Swift
func tableView(_ inTableView: UITableView, numberOfRowsInSection inSection: Int) -> IntParameters
inTableViewThe table view that is asking for the row count.
numberOfRowsInSectionThe 0-based section index being queried.
Return Value
The number of rows in the given section.
-
This returns a view, with the data for the given row and section.
Declaration
Swift
func tableView(_ inTableView: UITableView, cellForRowAt inIndexPath: IndexPath) -> UITableViewCellParameters
inTableViewThe table view that is asking for the cell.
cellForRowAtThe index path (section, row) for the cell.
-
This returns the number of available rows, in the given section.
Declaration
Swift
func tableView(_ inTableView: UITableView, heightForRowAt inIndexPath: IndexPath) -> CGFloatParameters
inTableViewThe table view that is asking for the row count.
numberOfRowsInSectionThe 0-based section index being queried.
Return Value
The height of the row in the given index.
View on GitHub
CGA_ServiceViewController Class Reference