CGA_SettingsViewController

class CGA_SettingsViewController : CGA_BaseViewController
extension CGA_SettingsViewController: UITextViewDelegate

This controls the settings view.

  • This switch will determine whether or not duplicate filtering is applied to the Peripheral scanning. If it is applied, then duplicates will be ignored during the discovery process (meaning that the devices are not continuously updated). False/Off means that duplicates ARE being filtered.

    Declaration

    Swift

    @IBOutlet
    weak var ignoreDuplicatesScanningSwitch: UISwitch!
  • This button is the “label” for the switch. I always like my labels to actuate their targets. This toggles the value of the switch.

    Declaration

    Swift

    @IBOutlet
    weak var ignoreDuplicatesSwitchButton: UIButton!
  • The label for the header over the three TextFields.

    Declaration

    Swift

    @IBOutlet
    weak var filterHeaderLabel: UILabel!
  • The Label for the device/Peripheral filter TextField.

    Declaration

    Swift

    @IBOutlet
    weak var deviceFilterLabel: UILabel!
  • The TextField for entry of the device/Peripheral filters.

    Declaration

    Swift

    @IBOutlet
    weak var deviceFilterTextView: UITextView!
  • The Label for the Service filter TextField.

    Declaration

    Swift

    @IBOutlet
    weak var serviceFilterLabel: UILabel!
  • The TextField for entry of the Service filters.

    Declaration

    Swift

    @IBOutlet
    weak var serviceFilterTextView: UITextView!
  • The Label for the Characteristic filter TextField.

    Declaration

    Swift

    @IBOutlet
    weak var characteristicFilterLabel: UILabel!
  • The TextField for entry of the Characteristic filters.

    Declaration

    Swift

    @IBOutlet
    weak var characteristicFilterTextView: UITextView!
  • The Label for the Minimum RSSI threshold.

    Declaration

    Swift

    @IBOutlet
    weak var minimumRSSILevelLabel: UILabel!
  • The Label for the Left (minimum) RSSI threshold.

    Declaration

    Swift

    @IBOutlet
    weak var minimumRSSILevelMinValLabel: UILabel!
  • The Label for the Right (maximum) RSSI threshold.

    Declaration

    Swift

    @IBOutlet
    weak var minimumRSSILevelMaxValLabel: UILabel!
  • The Label for the Current Value of the Minimum RSSI threshold.

    Declaration

    Swift

    @IBOutlet
    weak var minimumRSSILevelValueLabel: UILabel!
  • The Slider for the Minimum RSSI threshold.

    Declaration

    Swift

    @IBOutlet
    weak var minimumRSSILevelSlider: UISlider!
  • This switch will determine whether or not filtering is applied to the Peripheral scanning, ignoring devices that can’t be connected. If it is applied, then any device that does not advertise that it can be connected will be ignored. False/Off means that all connectables and non-connectables are being discovered. True/On means that only connectable devices will be listed.

    Declaration

    Swift

    @IBOutlet
    weak var onlyConnectablesSwitch: UISwitch!
  • This button is the “label” for the switch. I always like my labels to actuate their targets. This toggles the value of the switch.

    Declaration

    Swift

    @IBOutlet
    weak var onlyConnectablesSwitchButton: UIButton!
  • This button controls whether or not to filter out empty names.

    Declaration

    Swift

    @IBOutlet
    weak var emptyNamesSwitch: UISwitch!
  • This button is the “label” for the switch. I always like my labels to actuate their targets. This toggles the value of the switch.

    Declaration

    Swift

    @IBOutlet
    weak var emptyNamesSwitchButton: UIButton!
  • This switch controls whether or not to always send endlines as CRLF pairs.

    Declaration

    Swift

    @IBOutlet
    weak var alwaysUseCRLFSwitch: UISwitch!
  • This button is the “label” for the switch. I always like my labels to actuate their targets. This toggles the value of the switch.

    Declaration

    Swift

    @IBOutlet
    weak var alwaysUseCRLFSwitchButton: UIButton!

Private Methods

  • This is a utility method that “scrubs” the contents of the passed-in text, so it is an Array of String, containing valid UUID values.

    Declaration

    Swift

    private class func _parseThisTextForUUIDs(_ inTextToParse: String!) -> [String]

    Parameters

    inTextToParse

    The String to be parsed. The Array will be formed from split by linefeed (“\n”).

    Return Value

    an Array of String, containing the UUIDs extracted from the text.

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

    Declaration

    Swift

    func setUpAccessibility()

Callback/Observer Methods

  • Called when the “Continuous Scan” switch is hit. This immediately updates our prefs.

    Declaration

    Swift

    @IBAction
    func ignoreDuplicatesSwitchHit(_ inSwitch: UISwitch)

    Parameters

    inSwitch

    The switch object.

  • Called when the label for the switch is hit. It toggles the value in the prefs, and forces a UI update, which will change the switch.

    Declaration

    Swift

    @IBAction
    func ignoreDuplicatesButtonHit(_: Any)
  • Declaration

    Swift

    @IBAction
    func minimumRSSISliderChanged(_ inSlider: UISlider)

    Parameters

    inSlider

    The slider instance.

  • This dismisses any open keyboard.

    Declaration

    Swift

    @IBAction
    func dismissKeyboard(_: Any! = nil)
  • Called when the “Only Connectable Devices” switch is hit. This immediately updates our prefs.

    Declaration

    Swift

    @IBAction
    func onlyConnectableSwitchHit(_ inSwitch: UISwitch)

    Parameters

    inSwitch

    The switch object.

  • Called when the label for the switch is hit. It toggles the value in the prefs, and forces a UI update, which will change the switch.

    Declaration

    Swift

    @IBAction
    func onlyConnectableButtonHit(_: Any)
  • Called when the “Allow Empty Names” switch is hit. This immediately updates our prefs.

    Declaration

    Swift

    @IBAction
    func emptyNamesSwitchHit(_ inSwitch: UISwitch)

    Parameters

    inSwitch

    The switch object.

  • Called when the label for the switch is hit. It toggles the value in the prefs, and forces a UI update, which will change the switch.

    Declaration

    Swift

    @IBAction
    func emptyNamesButtonHit(_: Any)
  • Called when the “Always Use CRLF” switch is hit. This immediately updates our prefs.

    Declaration

    Swift

    @IBAction
    func alwaysUseCRLFSwitchHit(_ inSwitch: UISwitch)

    Parameters

    inSwitch

    The switch object.

  • Called when the label for the switch is hit. It toggles the value in the prefs, and forces a UI update, which will change the switch.

    Declaration

    Swift

    @IBAction
    func alwaysUseCRLFButtonHit(_: Any)

Instance Methods

  • Updates all the values to match the prefs.

    Declaration

    Swift

    func updateUI()
  • Declaration

    Swift

    func updateMInimumRSSIValue()
  • Forces a prefs update on the contents of the Peripheral filter TextView.

    Declaration

    Swift

    func parseDeviceTextView()
  • Forces a prefs update on the contents of the Service filter TextView.

    Declaration

    Swift

    func parseServiceTextView()
  • Forces a prefs update on the contents of the Characteristic filter TextView.

    Declaration

    Swift

    func parseCharacteristicTextView()

Base Class Override Methods

  • Called after the view data has been loaded.

    Declaration

    Swift

    override func viewDidLoad()
  • Called before the view is displayed. We use this to ensure that the orientation is portrait.

    Declaration

    Swift

    override func viewWillAppear(_ inAnimated: Bool)

    Parameters

    inAnimated

    ignored.

  • This allows us to restart scanning in the main screen, if it was running before we were called. It also allows us to restore the orientation.

    Declaration

    Swift

    override func viewDidDisappear(_ inAnimated: Bool)

    Parameters

    inAnimated

    ignored.

UITextViewDelegate Conformance

  • Called when any of the TextFields change. We use this to parse the values.

    Declaration

    Swift

    func textViewDidChange(_ inTextView: UITextView)

    Parameters

    inTextView

    The TextView that is being changed.