Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c2609db
Use the same PeripheralManager class as RLBLEKit2, and fix auth issues
ps2 Jan 24, 2018
fe93d47
Merge pull request #67 from LoopKit/peripheral-manager-and-fixes
ps2 Feb 3, 2018
5c006b1
Addresses some authentication & bonding issues
ps2 Feb 18, 2018
5987316
Moves the example app to the Carthage project. Cocoapods is no longer…
ps2 Feb 18, 2018
87d2379
Merge pull request #71 from LoopKit/example-app
ps2 Feb 18, 2018
9257ab2
remove deinit to fix central manager state
thebookins Feb 20, 2018
49ff3e1
proceed to control after bond
thebookins Feb 22, 2018
eccf139
Merge pull request #70 from LoopKit/auth-bonding-fixes
ps2 Feb 22, 2018
3d5411b
Merge pull request #72 from thebookins/scan-on-new-ID
ps2 Feb 22, 2018
49189d7
Merge pull request #74 from thebookins/bond-then-control
ps2 Feb 23, 2018
4b8aafd
Data/BLE Modernization
ps2 Mar 2, 2018
b9c264a
Merge pull request #77 from LoopKit/better-data
ps2 Mar 3, 2018
638b1dc
Observe backfill messages (#82)
ps2 Mar 22, 2018
cf8d6d7
support sensor start, stop, calibrate (#76)
thebookins Apr 8, 2018
e1314fd
Utility app to reset transmitter clock. (#84)
ps2 Apr 8, 2018
a4b385f
update ReadMe with resetTransmitter build instructions (#85)
Kdisimone Apr 11, 2018
6c7e4a5
Build target iOS 10 for framework, iOS 11 for reset app (#86)
ps2 Apr 14, 2018
37f1b8a
Rename xDripG5 framework to CGMBLEKit (#87)
ps2 Apr 14, 2018
6e4b5bb
Update glucose reliability to check glucose values
ps2 Apr 14, 2018
613ba0c
Updates from master for dev
ps2 Apr 14, 2018
1692564
Merge pull request #89 from LoopKit/merge-master
ps2 Apr 14, 2018
fd964f5
Bump version for release
ps2 Apr 14, 2018
b2c9a8d
Merge pull request #88 from LoopKit/glucose-reliability
ps2 Apr 14, 2018
b9e714a
Merge pull request #90 from LoopKit/bump-version
ps2 Apr 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ profile
DerivedData
*.hmap
*.ipa
project.xcworkspace

# Bundler
.bundle
Expand All @@ -32,3 +33,4 @@ Carthage
#

Pods/

6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode9
osx_image: xcode9.3

# cache: cocoapods
# podfile: Example/Podfile
Expand All @@ -12,5 +12,7 @@ script:
# Build cocoapods example project
# - set -o pipefail && xcodebuild -workspace Example/xDripG5.xcworkspace -scheme xDripG5-Example -sdk iphonesimulator -destination name="iPhone SE" ONLY_ACTIVE_ARCH=NO | xcpretty
# Build Travis project and run tests
- xcodebuild -project xDripG5.xcodeproj -scheme xDripG5 -sdk iphonesimulator11.0 build -destination name="iPhone SE" test
- xcodebuild -project CGMBLEKit.xcodeproj -scheme CGMBLEKit build -destination name="iPhone SE" test
- xcodebuild -project CGMBLEKit.xcodeproj -scheme "CGMBLEKit Example" build -destination name="iPhone SE"
- xcodebuild -project CGMBLEKit.xcodeproj -scheme ResetTransmitter build -destination name="iPhone SE"
# - pod lib lint
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,44 @@
//

import UIKit
import xDripG5
import CGMBLEKit
import CoreBluetooth

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate {
class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate, TransmitterCommandSource {

var window: UIWindow?

static var sharedDelegate: AppDelegate {
return UIApplication.shared.delegate as! AppDelegate
}

var transmitterID: String? {
didSet {
if let id = transmitterID {
transmitter = Transmitter(
id: id,
passiveModeEnabled: UserDefaults.standard.passiveModeEnabled
)
transmitter?.stayConnected = UserDefaults.standard.stayConnected
transmitter?.delegate = self
transmitter?.commandSource = self

UserDefaults.standard.transmitterID = id
}
glucose = nil
}
}

var transmitter: Transmitter?

let commandQueue = CommandQueue()

var glucose: Glucose?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

transmitter = Transmitter(
ID: UserDefaults.standard.transmitterID,
passiveModeEnabled: UserDefaults.standard.passiveModeEnabled
)
transmitter?.stayConnected = UserDefaults.standard.stayConnected
transmitter?.delegate = self
transmitterID = UserDefaults.standard.transmitterID

return true
}
Expand All @@ -42,7 +58,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

if let transmitter = transmitter , !transmitter.stayConnected {
if let transmitter = transmitter, !transmitter.stayConnected {
transmitter.stopScanning()
}
}
Expand Down Expand Up @@ -72,27 +88,48 @@ class AppDelegate: UIResponder, UIApplicationDelegate, TransmitterDelegate {
return dateFormatter
}()

func dequeuePendingCommand(for transmitter: Transmitter) -> Command? {
return commandQueue.dequeue()
}

func transmitter(_ transmitter: Transmitter, didFail command: Command, with error: Error) {
// TODO: implement
}

func transmitter(_ transmitter: Transmitter, didComplete command: Command) {
// TODO: implement
}

func transmitter(_ transmitter: Transmitter, didError error: Error) {
if let vc = window?.rootViewController as? TransmitterDelegate {
DispatchQueue.main.async {
DispatchQueue.main.async {
if let vc = self.window?.rootViewController as? TransmitterDelegate {
vc.transmitter(transmitter, didError: error)
}
}
}

func transmitter(_ transmitter: Transmitter, didRead glucose: Glucose) {
if let vc = window?.rootViewController as? TransmitterDelegate {
DispatchQueue.main.async {
self.glucose = glucose
DispatchQueue.main.async {
if let vc = self.window?.rootViewController as? TransmitterDelegate {
vc.transmitter(transmitter, didRead: glucose)
}
}
}

func transmitter(_ transmitter: Transmitter, didReadUnknownData data: Data) {
if let vc = window?.rootViewController as? TransmitterDelegate {
DispatchQueue.main.async {
DispatchQueue.main.async {
if let vc = self.window?.rootViewController as? TransmitterDelegate {
vc.transmitter(transmitter, didReadUnknownData: data)
}
}
}

func transmitter(_ transmitter: Transmitter, didReadBackfill glucose: [Glucose]) {
DispatchQueue.main.async {
if let vc = self.window?.rootViewController as? TransmitterDelegate {
vc.transmitter(transmitter, didReadBackfill: glucose)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down Expand Up @@ -64,6 +84,11 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
Loading