Skip to content

Commit 4943864

Browse files
author
Emilio Pavia
committed
Remove trailing whitespaces
1 parent 95f8a25 commit 4943864

18 files changed

+86
-86
lines changed

ScienceJournal/BLEArduino/BLEArduinoSensorInterface.swift

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// BLEArduinoSensorInterface.swift
33
// ScienceJournal
44
//
@@ -33,43 +33,43 @@ enum BLEArduinoSensorConfig: Int, Codable {
3333
protocol BLEArduinoSensor {
3434
static var identifier: String { get }
3535
static var uuid: CBUUID { get }
36-
36+
3737
var name: String { get }
3838
var iconName: String { get }
3939
var animatingIconName: String { get }
4040
var unitDescription: String? { get }
4141
var textDescription: String { get }
4242
var learnMoreInformation: Sensor.LearnMore { get }
4343
var options: [BLEArduinoSensorConfig] { get }
44-
44+
4545
var config: BLEArduinoSensorConfig? { get set }
46-
46+
4747
func point(for data: Data) -> Double
4848
}
4949

5050
extension BLEArduinoSensor {
5151
static var identifier: String { uuid.uuidString }
52-
52+
5353
var options: [BLEArduinoSensorConfig] { [] }
5454
}
5555

5656
class BLEArduinoSensorInterface: BLESensorInterface {
5757
var sensor: BLEArduinoSensor
58-
58+
5959
var identifier: String { type(of: sensor).identifier }
60-
60+
6161
var serviceId: CBUUID
62-
62+
6363
var providerId: String
64-
64+
6565
var peripheralName: String
66-
66+
6767
var name: String { sensor.name }
68-
68+
6969
var iconName: String { sensor.iconName }
70-
70+
7171
var animatingIconName: String { sensor.animatingIconName }
72-
72+
7373
var config: Data? {
7474
get {
7575
guard let config = sensor.config else { return nil }
@@ -82,27 +82,27 @@ class BLEArduinoSensorInterface: BLESensorInterface {
8282
sensor.config = config
8383
}
8484
}
85-
85+
8686
var peripheral: CBPeripheral?
87-
87+
8888
var unitDescription: String? { sensor.unitDescription }
89-
89+
9090
var textDescription: String { sensor.textDescription }
91-
91+
9292
var hasOptions: Bool { !sensor.options.isEmpty }
93-
93+
9494
var learnMoreInformation: Sensor.LearnMore { sensor.learnMoreInformation }
95-
95+
9696
var characteristic: CBUUID { type(of: sensor).uuid }
97-
97+
9898
private var serviceScanner: BLEServiceScanner
9999
private var peripheralInterface: BLEPeripheralInterface?
100-
100+
101101
private lazy var clock = Clock()
102-
102+
103103
private var configViewController: ScienceKitSensorConfigViewController?
104104
private var configCompletionBlock: (() -> Void)?
105-
105+
106106
required init(sensor: BLEArduinoSensor,
107107
providerId: String,
108108
serviceId: CBUUID,
@@ -113,30 +113,30 @@ class BLEArduinoSensorInterface: BLESensorInterface {
113113
self.peripheralName = peripheralName
114114
self.serviceScanner = BLEServiceScanner(services: [serviceId])
115115
}
116-
116+
117117
convenience init(peripheral: CBPeripheral, sensor: BLEArduinoSensor, serviceId: CBUUID) {
118118
self.init(sensor: sensor,
119119
providerId: peripheral.identifier.uuidString,
120120
serviceId: serviceId,
121121
peripheralName: peripheral.name ?? "")
122122
}
123-
123+
124124
convenience init(spec: SensorSpec, sensor: BLEArduinoSensor, serviceId: CBUUID) {
125125
self.init(sensor: sensor,
126126
providerId: spec.gadgetInfo.providerID,
127127
serviceId: serviceId,
128128
peripheralName: spec.gadgetInfo.hostID)
129129
config = spec.config
130130
}
131-
131+
132132
func presentOptions(from viewController: UIViewController, completion: @escaping () -> Void) {
133133
guard sensor.options.count > 1 else {
134134
completion()
135135
return
136136
}
137-
137+
138138
configCompletionBlock = completion
139-
139+
140140
let dialogController = MDCDialogTransitionController()
141141
// swiftlint:disable force_cast
142142
let appDelegate = UIApplication.shared.delegate as! AppDelegate
@@ -145,23 +145,23 @@ class BLEArduinoSensorInterface: BLESensorInterface {
145145
ScienceKitSensorConfigViewController(analyticsReporter: appDelegate.analyticsReporter)
146146
dialog.options = sensor.options
147147
dialog.config = sensor.config ?? .raw
148-
148+
149149
dialog.okButton.addTarget(self,
150150
action: #selector(sensorConfigOKButtonPressed),
151151
for: .touchUpInside)
152152
dialog.modalPresentationStyle = .custom
153153
dialog.transitioningDelegate = dialogController
154154
dialog.mdc_dialogPresentationController?.dismissOnBackgroundTap = false
155155
viewController.present(dialog, animated: true)
156-
156+
157157
configViewController = dialog
158158
}
159-
159+
160160
func connect(_ completion: @escaping (Bool) -> Void) {
161161
serviceScanner.connectToPeripheral(withIdentifier: providerId) { (peripheral, error) in
162162
// Stop scanning.
163163
self.serviceScanner.stopScanning()
164-
164+
165165
guard peripheral != nil else {
166166
print("[BluetoothSensor] Error connecting to " +
167167
"peripheral: \(String(describing: error?.peripheral.name)) " +
@@ -170,16 +170,16 @@ class BLEArduinoSensorInterface: BLESensorInterface {
170170
completion(false)
171171
return
172172
}
173-
173+
174174
self.peripheral = peripheral
175-
175+
176176
completion(true)
177177
}
178178
}
179-
179+
180180
func startObserving(_ listener: @escaping (DataPoint) -> Void) {
181181
guard let peripheral = peripheral else { return }
182-
182+
183183
let interface = BLEPeripheralInterface(peripheral: peripheral,
184184
serviceUUID: serviceId,
185185
characteristicUUIDs: [characteristic])
@@ -191,7 +191,7 @@ class BLEArduinoSensorInterface: BLESensorInterface {
191191
})
192192
self.peripheralInterface = interface
193193
}
194-
194+
195195
func stopObserving() {
196196
peripheralInterface?.stopUpdatesForCharacteristic(characteristic)
197197
}
@@ -203,9 +203,9 @@ private extension BLEArduinoSensorInterface {
203203
guard let configViewController = configViewController else {
204204
return
205205
}
206-
206+
207207
sensor.config = configViewController.config
208-
208+
209209
let completion = configCompletionBlock
210210
configCompletionBlock = nil
211211
configViewController.dismiss(animated: true, completion: completion)

ScienceJournal/BLEArduino/MKRWiFi1010/MKRWiFi1010ServiceInterface.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ class MKRWiFi1010ServiceInterface: BLEServiceInterface {
2727
var serviceId: CBUUID {
2828
return MKRWiFi1010Ids.serviceUUID
2929
}
30-
30+
3131
var name: String {
3232
return "MKR WiFi 1010"
3333
}
34-
34+
3535
var iconName: String {
3636
return "ic_sensor_bluetooth"
3737
}
38-
38+
3939
class func sensor(for spec: SensorSpec) -> BLESensorInterface? {
4040
switch spec.gadgetInfo.address {
4141
case BLEScienceKitVoltageSensor.identifier:
@@ -98,7 +98,7 @@ class MKRWiFi1010ServiceInterface: BLEServiceInterface {
9898
return nil
9999
}
100100
}
101-
101+
102102
func devicesForPeripheral(_ peripheral: CBPeripheral) -> [BLESensorInterface] {
103103
return [
104104
BLEArduinoSensorInterface(peripheral: peripheral,

ScienceJournal/BLEArduino/Nano33BLE/Nano33BLESenseServiceInterface.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseServiceInterface.swift
33
// ScienceJournal
44
//
@@ -27,15 +27,15 @@ class Nano33BLESenseServiceInterface: BLEServiceInterface {
2727
var serviceId: CBUUID {
2828
return Nano33BLESenseIds.serviceUUID
2929
}
30-
30+
3131
var name: String {
3232
return "Nano 33 BLE Sense"
3333
}
34-
34+
3535
var iconName: String {
3636
return "ic_sensor_bluetooth"
3737
}
38-
38+
3939
class func sensor(for spec: SensorSpec) -> BLESensorInterface? {
4040
switch spec.gadgetInfo.address {
4141
case Nano33BLESenseTemperatureSensor.identifier:
@@ -98,7 +98,7 @@ class Nano33BLESenseServiceInterface: BLEServiceInterface {
9898
return nil
9999
}
100100
}
101-
101+
102102
func devicesForPeripheral(_ peripheral: CBPeripheral) -> [BLESensorInterface] {
103103
return [
104104
BLEArduinoSensorInterface(peripheral: peripheral,

ScienceJournal/BLEArduino/Nano33BLE/Sensors/Nano33BLESenseAccelerometerXSensor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseAccelerometerXSensor.swift
33
// ScienceJournal
44
//

ScienceJournal/BLEArduino/Nano33BLE/Sensors/Nano33BLESenseAccelerometerYSensor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseAccelerometerYSensor.swift
33
// ScienceJournal
44
//

ScienceJournal/BLEArduino/Nano33BLE/Sensors/Nano33BLESenseAccelerometerZSensor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseAccelerometerZSensor.swift
33
// ScienceJournal
44
//

ScienceJournal/BLEArduino/Nano33BLE/Sensors/Nano33BLESenseBarometricPressureSensor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseBarometricPressureSensor.swift
33
// ScienceJournal
44
//

ScienceJournal/BLEArduino/Nano33BLE/Sensors/Nano33BLESenseColorIlluminanceSensor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseColorIlluminanceSensor.swift
33
// ScienceJournal
44
//

ScienceJournal/BLEArduino/Nano33BLE/Sensors/Nano33BLESenseColorTemperatureSensor.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseColorTemperatureSensor.swift
33
// ScienceJournal
44
//
@@ -47,25 +47,25 @@ struct Nano33BLESenseColorTemperatureSensor: BLEArduinoSensor {
4747
let rawR = data.withUnsafeBytes { $0.load(fromByteOffset: 0, as: Int16.self) }
4848
let rawG = data.withUnsafeBytes { $0.load(fromByteOffset: 1 * 4, as: Int16.self) }
4949
let rawB = data.withUnsafeBytes { $0.load(fromByteOffset: 2 * 4, as: Int16.self) }
50-
50+
5151
// 1. Map RGB values to their XYZ counterparts.
5252
let r = (Double(rawR) / 4097.0)
5353
let g = (Double(rawG) / 4097.0)
5454
let b = (Double(rawB) / 4097.0)
5555
let x = (0.412453 * r) + (0.35758 * g) + (0.180423 * b)
5656
let y = (0.212671 * r) + (0.71516 * g) + (0.072169 * b)
5757
let z = (0.019334 * r) + (0.119193 * g) + (0.950227 * b)
58-
58+
5959
// 2. Calculate the chromaticity co-ordinates
6060
let xchrome = x / (x + y + z)
6161
let ychrome = y / (x + y + z)
62-
62+
6363
// 3. Use to determine the CCT
6464
let n = (xchrome - 0.3320) / (0.1858 - ychrome)
65-
65+
6666
// 4. Calculate the final CCT
6767
let cct = (449.0 * pow(n, 3)) + (3525.0 * pow(n, 2)) + (6823.3 * n) + 5520.33
68-
68+
6969
if cct > 15000.0 {
7070
return 15000.0
7171
} else if cct < 0 || cct.isNaN {

ScienceJournal/BLEArduino/Nano33BLE/Sensors/Nano33BLESenseGyroscopeXSensor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Nano33BLESenseGyroscopeXSensor.swift
33
// ScienceJournal
44
//

0 commit comments

Comments
 (0)