Skip to content

Commit ab54f10

Browse files
authored
Sensor states (LoopKit#40)
* Enumerating sensor states in a new Glucose wrapper Fixes LoopKit#11 Fixes LoopKit#39 * version bump * Updating podspec
1 parent 8059bca commit ab54f10

23 files changed

+341
-104
lines changed

Example/xDripG5.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
06C991A3D94948120AD2A278 /* Pods_xDripG5_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42011659993839B43D24C553 /* Pods_xDripG5_Example.framework */; };
1111
439FCA211C332AA4007DE84C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 439FCA1F1C332AA4007DE84C /* LaunchScreen.storyboard */; };
1212
439FCA231C332AE5007DE84C /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 439FCA221C332AE5007DE84C /* NSUserDefaults.swift */; };
13+
43E3979F1D569B340028E321 /* HKUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E3979E1D569B340028E321 /* HKUnit.swift */; };
1314
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
1415
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
1516
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
@@ -20,6 +21,7 @@
2021
42011659993839B43D24C553 /* Pods_xDripG5_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_xDripG5_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2122
439FCA201C332AA4007DE84C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2223
439FCA221C332AE5007DE84C /* NSUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSUserDefaults.swift; sourceTree = "<group>"; };
24+
43E3979E1D569B340028E321 /* HKUnit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = HKUnit.swift; path = ../../xDripG5/HKUnit.swift; sourceTree = "<group>"; };
2325
598554A3C216FA3B8F8CD6BE /* xDripG5.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = xDripG5.podspec; path = ../xDripG5.podspec; sourceTree = "<group>"; };
2426
607FACD01AFB9204008FA782 /* xDripG5_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = xDripG5_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
2527
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -76,6 +78,7 @@
7678
isa = PBXGroup;
7779
children = (
7880
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
81+
43E3979E1D569B340028E321 /* HKUnit.swift */,
7982
439FCA221C332AE5007DE84C /* NSUserDefaults.swift */,
8083
607FACD71AFB9204008FA782 /* ViewController.swift */,
8184
607FACDC1AFB9204008FA782 /* Assets.xcassets */,
@@ -243,6 +246,7 @@
243246
files = (
244247
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
245248
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
249+
43E3979F1D569B340028E321 /* HKUnit.swift in Sources */,
246250
439FCA231C332AE5007DE84C /* NSUserDefaults.swift in Sources */,
247251
);
248252
runOnlyForDeploymentPostprocessing = 0;

Example/xDripG5/AppDelegate.swift

+2-11
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate {
2525

2626
transmitter = Transmitter(
2727
ID: NSUserDefaults.standardUserDefaults().transmitterID,
28-
startTimeInterval: NSUserDefaults.standardUserDefaults().startTimeInterval,
2928
passiveModeEnabled: NSUserDefaults.standardUserDefaults().passiveModeEnabled
3029
)
3130
transmitter?.stayConnected = NSUserDefaults.standardUserDefaults().stayConnected
@@ -81,19 +80,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate {
8180
}
8281
}
8382

84-
func transmitter(transmitter: Transmitter, didReadGlucose glucose: GlucoseRxMessage) {
85-
86-
if let startTime = transmitter.startTimeInterval {
87-
NSUserDefaults.standardUserDefaults().startTimeInterval = startTime
88-
}
89-
83+
func transmitter(transmitter: Transmitter, didRead glucose: Glucose) {
9084
if let vc = window?.rootViewController as? TransmitterDelegate {
9185
dispatch_async(dispatch_get_main_queue()) {
92-
vc.transmitter(transmitter, didReadGlucose: glucose)
86+
vc.transmitter(transmitter, didRead: glucose)
9387
}
9488
}
9589
}
9690
}
97-
98-
99-

Example/xDripG5/NSUserDefaults.swift

-15
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@ extension NSUserDefaults {
1919
}
2020
}
2121

22-
var startTimeInterval: NSTimeInterval? {
23-
get {
24-
let value = doubleForKey("startTimeInterval")
25-
26-
return value > 0 ? value : nil
27-
}
28-
set {
29-
if let value = newValue {
30-
setDouble(value, forKey: "startTimeInterval")
31-
} else {
32-
setObject(nil, forKey: "startTimeInterval")
33-
}
34-
}
35-
}
36-
3722
var stayConnected: Bool {
3823
get {
3924
return boolForKey("stayConnected") ?? true

Example/xDripG5/ViewController.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import UIKit
10+
import HealthKit
1011
import xDripG5
1112

1213
class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate {
@@ -106,19 +107,18 @@ class ViewController: UIViewController, TransmitterDelegate, UITextFieldDelegate
106107
subtitleLabel.text = "\(error)"
107108
}
108109

109-
func transmitter(transmitter: Transmitter, didReadGlucose glucose: GlucoseRxMessage) {
110-
titleLabel.text = NSNumberFormatter.localizedStringFromNumber(NSNumber(short: Int16(glucose.glucose)), numberStyle: .NoStyle)
111-
112-
if let startTime = transmitter.startTimeInterval {
113-
let date = NSDate(timeIntervalSince1970: startTime).dateByAddingTimeInterval(NSTimeInterval(glucose.timestamp))
114-
115-
subtitleLabel.text = NSDateFormatter.localizedStringFromDate(date, dateStyle: .NoStyle, timeStyle: .LongStyle)
110+
func transmitter(transmitter: Transmitter, didRead glucose: Glucose) {
111+
let unit = HKUnit.milligramsPerDeciliter()
112+
if let value = glucose.glucose?.doubleValueForUnit(unit) {
113+
titleLabel.text = "\(value) \(unit.unitString)"
116114
} else {
117-
subtitleLabel.text = "Unknown time"
115+
titleLabel.text = String(glucose.state)
118116
}
119117

120-
}
121118

119+
let date = glucose.readDate
120+
subtitleLabel.text = NSDateFormatter.localizedStringFromDate(date, dateStyle: .NoStyle, timeStyle: .LongStyle)
121+
}
122122
}
123123

124124

xDripG5.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "xDripG5"
3-
s.version = "0.5.0"
3+
s.version = "0.6.0"
44
s.summary = "An interface for communicating with the G5 glucose transmitter over Bluetooth."
55

66
s.description = <<-DESC

xDripG5.xcodeproj/project.pbxproj

+28-8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
43CE7CDC1CA77468003CC1B0 /* TransmitterStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43CE7CDB1CA77468003CC1B0 /* TransmitterStatus.swift */; };
3737
43DC87C01C8B509B005BC30D /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DC87BF1C8B509B005BC30D /* NSData.swift */; };
3838
43DC87C21C8B520F005BC30D /* GlucoseRxMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DC87C11C8B520F005BC30D /* GlucoseRxMessageTests.swift */; };
39+
43E3978B1D5668BD0028E321 /* CalibrationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E3978A1D5668BD0028E321 /* CalibrationState.swift */; };
40+
43E3978D1D566AEA0028E321 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43E3978C1D566AEA0028E321 /* HealthKit.framework */; };
41+
43E3978F1D566B170028E321 /* Glucose.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E3978E1D566B170028E321 /* Glucose.swift */; };
42+
43E397911D5692080028E321 /* GlucoseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E397901D5692080028E321 /* GlucoseTests.swift */; };
43+
43E397931D56950C0028E321 /* HKUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E397921D56950C0028E321 /* HKUnit.swift */; };
3944
43EEA7111D14DC0800CBBDA0 /* AESCrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EEA70F1D14DC0800CBBDA0 /* AESCrypt.h */; settings = {ATTRIBUTES = (Public, ); }; };
4045
43EEA7121D14DC0800CBBDA0 /* AESCrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = 43EEA7101D14DC0800CBBDA0 /* AESCrypt.m */; };
4146
43F82BCC1D035AA4006F5DD7 /* TransmitterTimeRxMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F82BCB1D035AA4006F5DD7 /* TransmitterTimeRxMessageTests.swift */; };
@@ -100,6 +105,11 @@
100105
43CE7CDB1CA77468003CC1B0 /* TransmitterStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransmitterStatus.swift; sourceTree = "<group>"; };
101106
43DC87BF1C8B509B005BC30D /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSData.swift; sourceTree = "<group>"; };
102107
43DC87C11C8B520F005BC30D /* GlucoseRxMessageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlucoseRxMessageTests.swift; sourceTree = "<group>"; };
108+
43E3978A1D5668BD0028E321 /* CalibrationState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalibrationState.swift; sourceTree = "<group>"; };
109+
43E3978C1D566AEA0028E321 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
110+
43E3978E1D566B170028E321 /* Glucose.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Glucose.swift; sourceTree = "<group>"; };
111+
43E397901D5692080028E321 /* GlucoseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlucoseTests.swift; sourceTree = "<group>"; };
112+
43E397921D56950C0028E321 /* HKUnit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HKUnit.swift; sourceTree = "<group>"; };
103113
43EEA70F1D14DC0800CBBDA0 /* AESCrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AESCrypt.h; sourceTree = "<group>"; };
104114
43EEA7101D14DC0800CBBDA0 /* AESCrypt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AESCrypt.m; sourceTree = "<group>"; };
105115
43F82BCB1D035AA4006F5DD7 /* TransmitterTimeRxMessageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransmitterTimeRxMessageTests.swift; sourceTree = "<group>"; };
@@ -114,6 +124,7 @@
114124
isa = PBXFrameworksBuildPhase;
115125
buildActionMask = 2147483647;
116126
files = (
127+
43E3978D1D566AEA0028E321 /* HealthKit.framework in Frameworks */,
117128
);
118129
runOnlyForDeploymentPostprocessing = 0;
119130
};
@@ -131,6 +142,7 @@
131142
43CABDE91C3506F100005705 = {
132143
isa = PBXGroup;
133144
children = (
145+
43E3978C1D566AEA0028E321 /* HealthKit.framework */,
134146
43CABDF51C3506F100005705 /* xDripG5 */,
135147
43CABE011C3506F100005705 /* xDripG5Tests */,
136148
43CABDF41C3506F100005705 /* Products */,
@@ -149,24 +161,28 @@
149161
43CABDF51C3506F100005705 /* xDripG5 */ = {
150162
isa = PBXGroup;
151163
children = (
152-
43CABDF61C3506F100005705 /* xDripG5.h */,
153-
43CABDF81C3506F100005705 /* Info.plist */,
164+
43EEA70F1D14DC0800CBBDA0 /* AESCrypt.h */,
165+
43EEA7101D14DC0800CBBDA0 /* AESCrypt.m */,
154166
43CABE0E1C350B2800005705 /* BluetoothManager.swift */,
155167
43CABE0F1C350B2800005705 /* BluetoothServices.swift */,
168+
43E3978A1D5668BD0028E321 /* CalibrationState.swift */,
169+
43E3978E1D566B170028E321 /* Glucose.swift */,
170+
43E397921D56950C0028E321 /* HKUnit.swift */,
171+
43CABDF81C3506F100005705 /* Info.plist */,
156172
43CABE101C350B2800005705 /* NSData.swift */,
157173
430D64C41CB7846A00FCA750 /* NSData+CRC.swift */,
158174
43CABE111C350B2800005705 /* Transmitter.swift */,
159175
43CE7CDB1CA77468003CC1B0 /* TransmitterStatus.swift */,
176+
43CABDF61C3506F100005705 /* xDripG5.h */,
160177
43CABE161C350B2E00005705 /* Messages */,
161-
43EEA70F1D14DC0800CBBDA0 /* AESCrypt.h */,
162-
43EEA7101D14DC0800CBBDA0 /* AESCrypt.m */,
163178
);
164179
path = xDripG5;
165180
sourceTree = "<group>";
166181
};
167182
43CABE011C3506F100005705 /* xDripG5Tests */ = {
168183
isa = PBXGroup;
169184
children = (
185+
43E397901D5692080028E321 /* GlucoseTests.swift */,
170186
43DC87C11C8B520F005BC30D /* GlucoseRxMessageTests.swift */,
171187
43CABE041C3506F100005705 /* Info.plist */,
172188
43DC87BF1C8B509B005BC30D /* NSData.swift */,
@@ -316,13 +332,15 @@
316332
buildActionMask = 2147483647;
317333
files = (
318334
43CE7CCA1CA73B94003CC1B0 /* TransmitterVersionTxMessage.swift in Sources */,
335+
43E3978B1D5668BD0028E321 /* CalibrationState.swift in Sources */,
319336
43CABE2D1C350B3D00005705 /* TransmitterTimeRxMessage.swift in Sources */,
320337
43CABE291C350B3D00005705 /* GlucoseRxMessage.swift in Sources */,
321338
43CE7CDC1CA77468003CC1B0 /* TransmitterStatus.swift in Sources */,
322339
43CABE271C350B3D00005705 /* BondRequestTxMessage.swift in Sources */,
323340
43CABE231C350B3D00005705 /* AuthChallengeRxMessage.swift in Sources */,
324341
43CABE261C350B3D00005705 /* AuthStatusRxMessage.swift in Sources */,
325342
43CE7CD41CA73CE8003CC1B0 /* GlucoseHistoryTxMessage.swift in Sources */,
343+
43E397931D56950C0028E321 /* HKUnit.swift in Sources */,
326344
43CE7CD01CA73C57003CC1B0 /* SessionStopTxMessage.swift in Sources */,
327345
43CABE2A1C350B3D00005705 /* GlucoseTxMessage.swift in Sources */,
328346
43CE7CC81CA73AEB003CC1B0 /* FirmwareVersionTxMessage.swift in Sources */,
@@ -332,6 +350,7 @@
332350
43CABE2E1C350B3D00005705 /* TransmitterTimeTxMessage.swift in Sources */,
333351
43CABE2C1C350B3D00005705 /* TransmitterMessage.swift in Sources */,
334352
43CABE131C350B2800005705 /* BluetoothServices.swift in Sources */,
353+
43E3978F1D566B170028E321 /* Glucose.swift in Sources */,
335354
43CABE151C350B2800005705 /* Transmitter.swift in Sources */,
336355
43CABE281C350B3D00005705 /* DisconnectTxMessage.swift in Sources */,
337356
43CABE141C350B2800005705 /* NSData.swift in Sources */,
@@ -354,6 +373,7 @@
354373
43F82BD41D037227006F5DD7 /* SessionStartRxMessageTests.swift in Sources */,
355374
43DC87C01C8B509B005BC30D /* NSData.swift in Sources */,
356375
43F82BD21D037040006F5DD7 /* SessionStopRxMessageTests.swift in Sources */,
376+
43E397911D5692080028E321 /* GlucoseTests.swift in Sources */,
357377
43DC87C21C8B520F005BC30D /* GlucoseRxMessageTests.swift in Sources */,
358378
);
359379
runOnlyForDeploymentPostprocessing = 0;
@@ -388,7 +408,7 @@
388408
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
389409
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
390410
COPY_PHASE_STRIP = NO;
391-
CURRENT_PROJECT_VERSION = 11;
411+
CURRENT_PROJECT_VERSION = 12;
392412
DEBUG_INFORMATION_FORMAT = dwarf;
393413
ENABLE_STRICT_OBJC_MSGSEND = YES;
394414
ENABLE_TESTABILITY = YES;
@@ -436,7 +456,7 @@
436456
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
437457
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
438458
COPY_PHASE_STRIP = NO;
439-
CURRENT_PROJECT_VERSION = 11;
459+
CURRENT_PROJECT_VERSION = 12;
440460
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
441461
ENABLE_NS_ASSERTIONS = NO;
442462
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -464,7 +484,7 @@
464484
CLANG_ENABLE_MODULES = YES;
465485
DEFINES_MODULE = YES;
466486
DYLIB_COMPATIBILITY_VERSION = 1;
467-
DYLIB_CURRENT_VERSION = 11;
487+
DYLIB_CURRENT_VERSION = 12;
468488
DYLIB_INSTALL_NAME_BASE = "@rpath";
469489
INFOPLIST_FILE = xDripG5/Info.plist;
470490
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -482,7 +502,7 @@
482502
CLANG_ENABLE_MODULES = YES;
483503
DEFINES_MODULE = YES;
484504
DYLIB_COMPATIBILITY_VERSION = 1;
485-
DYLIB_CURRENT_VERSION = 11;
505+
DYLIB_CURRENT_VERSION = 12;
486506
DYLIB_INSTALL_NAME_BASE = "@rpath";
487507
INFOPLIST_FILE = xDripG5/Info.plist;
488508
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";

xDripG5/BluetoothManager.swift

+23-12
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,17 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
7272

7373
private var manager: CBCentralManager! = nil
7474

75-
private var peripheral: CBPeripheral?
75+
private var peripheral: CBPeripheral? {
76+
didSet {
77+
if let oldValue = oldValue {
78+
oldValue.delegate = nil
79+
}
80+
81+
if let newValue = peripheral {
82+
newValue.delegate = self
83+
}
84+
}
85+
}
7686

7787
// MARK: - GCD Management
7888

@@ -91,12 +101,18 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
91101
return
92102
}
93103

94-
manager.scanForPeripheralsWithServices(
95-
[
96-
CBUUID(string: TransmitterServiceUUID.Advertisement.rawValue)
97-
],
98-
options: nil
99-
)
104+
if let peripheral = manager.retrieveConnectedPeripheralsWithServices([
105+
CBUUID(string: TransmitterServiceUUID.Advertisement.rawValue),
106+
CBUUID(string: TransmitterServiceUUID.CGMService.rawValue)
107+
]).first where delegate == nil || delegate!.bluetoothManager(self, shouldConnectPeripheral: peripheral) {
108+
self.peripheral = peripheral
109+
} else {
110+
manager.scanForPeripheralsWithServices([
111+
CBUUID(string: TransmitterServiceUUID.Advertisement.rawValue)
112+
],
113+
options: nil
114+
)
115+
}
100116

101117
if let peripheral = self.peripheral {
102118
self.manager.connectPeripheral(peripheral, options: nil)
@@ -313,17 +329,14 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
313329
for peripheral in peripherals {
314330
if delegate == nil || delegate!.bluetoothManager(self, shouldConnectPeripheral: peripheral) {
315331
self.peripheral = peripheral
316-
peripheral.delegate = self
317332
}
318333
}
319334
}
320335
}
321336

322337
func centralManager(central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData: [String : AnyObject], RSSI: NSNumber) {
323-
324338
if delegate == nil || delegate!.bluetoothManager(self, shouldConnectPeripheral: peripheral) {
325339
self.peripheral = peripheral
326-
peripheral.delegate = self
327340

328341
central.connectPeripheral(peripheral, options: nil)
329342

@@ -348,14 +361,12 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
348361
}
349362

350363
func centralManager(central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: NSError?) {
351-
352364
if stayConnected {
353365
scanAfterDelay()
354366
}
355367
}
356368

357369
func centralManager(central: CBCentralManager, didFailToConnectPeripheral peripheral: CBPeripheral, error: NSError?) {
358-
359370
if stayConnected {
360371
scanAfterDelay()
361372
}

0 commit comments

Comments
 (0)