Dexcom G6
This commit is contained in:
parent
136ccce6be
commit
1bae9657ec
|
@ -86,6 +86,9 @@
|
|||
F821CF9722AE589E005C1E43 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F821CF9622AE589E005C1E43 /* HealthKit.framework */; };
|
||||
F821CF9D22AEF483005C1E43 /* BGReadingSpeaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F821CF9C22AEF483005C1E43 /* BGReadingSpeaker.swift */; };
|
||||
F8252867243E50FE0067AF77 /* ConstantsLibre.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8252866243E50FE0067AF77 /* ConstantsLibre.swift */; };
|
||||
F825286A2443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82528692443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift */; };
|
||||
F825286C2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F825286B2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift */; };
|
||||
F825286E2443C1000067AF77 /* BluetoothPeripheralManager+CGMG6TransmitterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F825286D2443C1000067AF77 /* BluetoothPeripheralManager+CGMG6TransmitterDelegate.swift */; };
|
||||
F8297F46238DC4AC00D74D66 /* BluetoothPeripheralManaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8297F44238DC4AC00D74D66 /* BluetoothPeripheralManaging.swift */; };
|
||||
F8297F4E238DCAD800D74D66 /* BluetoothPeripheralsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8297F4B238DCAD800D74D66 /* BluetoothPeripheralsViewController.swift */; };
|
||||
F8297F4F238DCAD800D74D66 /* BluetoothPeripheralNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8297F4C238DCAD800D74D66 /* BluetoothPeripheralNavigationController.swift */; };
|
||||
|
@ -398,6 +401,9 @@
|
|||
F821CF9822AE589E005C1E43 /* xdrip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = xdrip.entitlements; sourceTree = "<group>"; };
|
||||
F821CF9C22AEF483005C1E43 /* BGReadingSpeaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BGReadingSpeaker.swift; sourceTree = "<group>"; };
|
||||
F8252866243E50FE0067AF77 /* ConstantsLibre.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstantsLibre.swift; sourceTree = "<group>"; };
|
||||
F82528692443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DexcomG6BluetoothPeripheralViewModel.swift; sourceTree = "<group>"; };
|
||||
F825286B2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGMG6TransmitterDelegate.swift; sourceTree = "<group>"; };
|
||||
F825286D2443C1000067AF77 /* BluetoothPeripheralManager+CGMG6TransmitterDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BluetoothPeripheralManager+CGMG6TransmitterDelegate.swift"; sourceTree = "<group>"; };
|
||||
F8297F41238C3A6400D74D66 /* xdrip v5.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "xdrip v5.xcdatamodel"; sourceTree = "<group>"; };
|
||||
F8297F44238DC4AC00D74D66 /* BluetoothPeripheralManaging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BluetoothPeripheralManaging.swift; sourceTree = "<group>"; };
|
||||
F8297F4B238DCAD800D74D66 /* BluetoothPeripheralsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BluetoothPeripheralsViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -1097,6 +1103,14 @@
|
|||
path = Speak;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F82528682443AE040067AF77 /* DexcomG6 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F82528692443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift */,
|
||||
);
|
||||
path = DexcomG6;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F8297F42238DC4AC00D74D66 /* BluetoothPeripheral */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1113,6 +1127,7 @@
|
|||
F897E24F23FC871C0075E0E8 /* BluetoothPeripheralManager+WatlaaBluetoothTransmitterDelegate.swift */,
|
||||
F8297F44238DC4AC00D74D66 /* BluetoothPeripheralManaging.swift */,
|
||||
F816E12D2439E06E009EE65B /* BluetoothPeripheralManager+CGMDexcomG4TransmitterDelegate.swift */,
|
||||
F825286D2443C1000067AF77 /* BluetoothPeripheralManager+CGMG6TransmitterDelegate.swift */,
|
||||
);
|
||||
path = BluetoothPeripheral;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1535,6 +1550,7 @@
|
|||
F8DF766A23ED9AF100063910 /* Dexcom */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F82528682443AE040067AF77 /* DexcomG6 */,
|
||||
F816E12F2439E2A0009EE65B /* DexcomG4 */,
|
||||
F8DF766B23ED9AF100063910 /* DexcomG5 */,
|
||||
);
|
||||
|
@ -1741,6 +1757,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
F8F971BD23A5915900C3F17D /* CGMG6Transmitter.swift */,
|
||||
F825286B2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift */,
|
||||
);
|
||||
path = G6;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2276,6 +2293,7 @@
|
|||
F8B3A79622635A25004BA588 /* AlertEntry+CoreDataClass.swift in Sources */,
|
||||
F808D2CA240325E40084B5DB /* CGMBubbleTransmitterDelegate.swift in Sources */,
|
||||
F804870C2336D90200EBDDB7 /* M5Stack+CoreDataClass.swift in Sources */,
|
||||
F825286C2443BEDC0067AF77 /* CGMG6TransmitterDelegate.swift in Sources */,
|
||||
F8C97854242AA70D00A09483 /* MiaoMiao+CoreDataProperties.swift in Sources */,
|
||||
F8F9720A23A5915900C3F17D /* DexcomTransmitterOpCode.swift in Sources */,
|
||||
F8AC425E21ADEBD60078C348 /* AppDelegate.swift in Sources */,
|
||||
|
@ -2386,8 +2404,10 @@
|
|||
F816E1242439DB63009EE65B /* DexcomG4+BluetoothPeripheral.swift in Sources */,
|
||||
F808D2D2240329E80084B5DB /* Bubble+BluetoothPeripheral.swift in Sources */,
|
||||
F8025C1321DA683400ECF0C0 /* Data.swift in Sources */,
|
||||
F825286A2443AE190067AF77 /* DexcomG6BluetoothPeripheralViewModel.swift in Sources */,
|
||||
F8F9722023A5915900C3F17D /* LibreGlucoseSmoothing.swift in Sources */,
|
||||
F80859272364355F00F3829D /* ConstantsGlucoseChart.swift in Sources */,
|
||||
F825286E2443C1000067AF77 /* BluetoothPeripheralManager+CGMG6TransmitterDelegate.swift in Sources */,
|
||||
F816E10324367389009EE65B /* GNSEntryBluetoothPeripheralViewModel.swift in Sources */,
|
||||
F8DF766D23ED9B0900063910 /* DexcomG5BluetoothPeripheralViewModel.swift in Sources */,
|
||||
F85DC2EF21CFE2F500B9F74A /* Sensor+CoreDataProperties.swift in Sources */,
|
||||
|
|
|
@ -16,30 +16,33 @@ enum BluetoothPeripheralType: String, CaseIterable {
|
|||
/// watlaa master
|
||||
case watlaaMaster = "Watlaa master"
|
||||
|
||||
/// DexcomG5
|
||||
case DexcomG5Type = "Dexcom G5"
|
||||
|
||||
/// DexcomG4
|
||||
case DexcomG4Type = "Dexcom G4 (bridge)"
|
||||
|
||||
/// bubble
|
||||
case BubbleType = "Bubble"
|
||||
/// DexcomG5
|
||||
case DexcomG5Type = "Dexcom G5"
|
||||
|
||||
/// MiaoMiao
|
||||
case MiaoMiaoType = "MiaoMiao"
|
||||
/// DexcomG6
|
||||
case DexcomG6Type = "Dexcom G6"
|
||||
|
||||
/// Blucon
|
||||
case BluconType = "Blucon"
|
||||
|
||||
/// GNSentry
|
||||
case GNSentryType = "GNSentry"
|
||||
|
||||
/// BlueReader
|
||||
case BlueReaderType = "BlueReader"
|
||||
|
||||
/// bubble
|
||||
case BubbleType = "Bubble"
|
||||
|
||||
/// Droplet
|
||||
case DropletType = "Droplet"
|
||||
|
||||
/// GNSentry
|
||||
case GNSentryType = "GNSentry"
|
||||
|
||||
/// MiaoMiao
|
||||
case MiaoMiaoType = "MiaoMiao"
|
||||
|
||||
/// - returns: the BluetoothPeripheralViewModel. If nil then there's no specific settings for the tpe of bluetoothPeripheral
|
||||
func viewModel() -> BluetoothPeripheralViewModel? {
|
||||
|
||||
|
@ -78,6 +81,9 @@ enum BluetoothPeripheralType: String, CaseIterable {
|
|||
case .DexcomG4Type:
|
||||
return DexcomG4BluetoothPeripheralViewModel()
|
||||
|
||||
case .DexcomG6Type:
|
||||
return DexcomG6BluetoothPeripheralViewModel()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -107,6 +113,14 @@ enum BluetoothPeripheralType: String, CaseIterable {
|
|||
|
||||
return DexcomG5(address: address, name: name, alias: nil, nsManagedObjectContext: nsManagedObjectContext)
|
||||
|
||||
case .DexcomG6Type:
|
||||
|
||||
// DexcomG6 is a DexcomG5 with isDexcomG6 set to trye
|
||||
let dexcomG6 = DexcomG5(address: address, name: name, alias: nil, nsManagedObjectContext: nsManagedObjectContext)
|
||||
dexcomG6.isDexcomG6 = true
|
||||
|
||||
return dexcomG6
|
||||
|
||||
case .BubbleType:
|
||||
|
||||
return Bubble(address: address, name: name, alias: nil, nsManagedObjectContext: nsManagedObjectContext)
|
||||
|
@ -153,7 +167,7 @@ enum BluetoothPeripheralType: String, CaseIterable {
|
|||
case .watlaaMaster:
|
||||
return .watlaa
|
||||
|
||||
case .DexcomG5Type, .BubbleType, .MiaoMiaoType, .BluconType, .GNSentryType, .BlueReaderType, .DropletType, .DexcomG4Type:
|
||||
case .DexcomG5Type, .BubbleType, .MiaoMiaoType, .BluconType, .GNSentryType, .BlueReaderType, .DropletType, .DexcomG4Type, .DexcomG6Type:
|
||||
return .CGM
|
||||
|
||||
}
|
||||
|
@ -168,7 +182,7 @@ enum BluetoothPeripheralType: String, CaseIterable {
|
|||
case .M5StackType, .M5StickCType, .watlaaMaster, .BubbleType, .MiaoMiaoType, .GNSentryType, .BlueReaderType, .DropletType:
|
||||
return false
|
||||
|
||||
case .DexcomG5Type, .BluconType, .DexcomG4Type:
|
||||
case .DexcomG5Type, .BluconType, .DexcomG4Type, .DexcomG6Type:
|
||||
return true
|
||||
|
||||
}
|
||||
|
@ -181,9 +195,9 @@ enum BluetoothPeripheralType: String, CaseIterable {
|
|||
|
||||
switch self {
|
||||
|
||||
case .DexcomG5Type: //.dexcomG6:
|
||||
case .DexcomG5Type, .DexcomG6Type:
|
||||
|
||||
// length for G5 is 6
|
||||
// length for G5 and G6 is 6
|
||||
if transmitterId.count != 6 {
|
||||
return Texts_ErrorMessages.TransmitterIDShouldHaveLength6
|
||||
}
|
||||
|
@ -273,6 +287,9 @@ enum BluetoothPeripheralType: String, CaseIterable {
|
|||
case .DexcomG4Type:
|
||||
return false
|
||||
|
||||
case .DexcomG6Type:
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ class CGMG6Transmitter: CGMG5Transmitter {
|
|||
/// - transmitterID: expected transmitterID, 6 characters
|
||||
/// - bluetoothTransmitterDelegate : a BluetoothTransmitterDelegate
|
||||
/// - cGMTransmitterDelegate : a CGMTransmitterDelegate
|
||||
override init(address:String?, name: String?, transmitterID:String, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, cGMG5TransmitterDelegate: CGMG5TransmitterDelegate, cGMTransmitterDelegate:CGMTransmitterDelegate) {
|
||||
init(address:String?, name: String?, transmitterID:String, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, cGMG6TransmitterDelegate: CGMG6TransmitterDelegate, cGMTransmitterDelegate:CGMTransmitterDelegate) {
|
||||
|
||||
// call super.init
|
||||
super.init(address: address, name: name, transmitterID: transmitterID, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate, cGMG5TransmitterDelegate: cGMG5TransmitterDelegate, cGMTransmitterDelegate: cGMTransmitterDelegate)
|
||||
super.init(address: address, name: name, transmitterID: transmitterID, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate, cGMG5TransmitterDelegate: cGMG6TransmitterDelegate, cGMTransmitterDelegate: cGMTransmitterDelegate)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
import Foundation
|
||||
|
||||
protocol CGMG6TransmitterDelegate: CGMG5TransmitterDelegate {
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import Foundation
|
||||
import CoreData
|
||||
|
||||
/// used for DexcomG5 and G6
|
||||
public class DexcomG5: NSManagedObject {
|
||||
|
||||
/// should reset be done ? Not stored in coreData, means will be reset to false each time app is resarted
|
||||
|
|
|
@ -26,4 +26,6 @@ extension DexcomG5 {
|
|||
|
||||
@NSManaged public var lastResetTimeStamp: Date?
|
||||
|
||||
@NSManaged public var isDexcomG6: Bool
|
||||
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
<attribute name="batteryStatus" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="batteryTemperature" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="firmwareVersion" optional="YES" attributeType="String"/>
|
||||
<attribute name="isDexcomG6" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||
<attribute name="lastResetTimeStamp" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<attribute name="voltageA" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="voltageB" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
|
@ -151,13 +152,13 @@
|
|||
<element name="BlueReader" positionX="-639" positionY="207" width="128" height="58"/>
|
||||
<element name="Bubble" positionX="-657" positionY="189" width="128" height="103"/>
|
||||
<element name="Calibration" positionX="-859.21484375" positionY="46.21484375" width="128" height="285"/>
|
||||
<element name="DexcomG5" positionX="-648" positionY="198" width="128" height="178"/>
|
||||
<element name="DexcomG4" positionX="-621" positionY="225" width="128" height="58"/>
|
||||
<element name="DexcomG5" positionX="-648" positionY="198" width="128" height="193"/>
|
||||
<element name="Droplet" positionX="-630" positionY="216" width="128" height="58"/>
|
||||
<element name="GNSEntry" positionX="-648" positionY="198" width="128" height="118"/>
|
||||
<element name="M5Stack" positionX="-657" positionY="180" width="128" height="163"/>
|
||||
<element name="MiaoMiao" positionX="-657" positionY="189" width="128" height="103"/>
|
||||
<element name="Sensor" positionX="-603.0859375" positionY="482.2890625" width="128" height="133"/>
|
||||
<element name="Watlaa" positionX="-639" positionY="207" width="128" height="58"/>
|
||||
<element name="Droplet" positionX="-630" positionY="216" width="128" height="58"/>
|
||||
<element name="DexcomG4" positionX="-621" positionY="225" width="128" height="58"/>
|
||||
</elements>
|
||||
</model>
|
|
@ -0,0 +1,7 @@
|
|||
import Foundation
|
||||
|
||||
extension BluetoothPeripheralManager: CGMG6TransmitterDelegate {
|
||||
|
||||
// apparently conforms by conforming to CGMG5TransmitterDelegate, as I see no compile errors
|
||||
|
||||
}
|
|
@ -88,7 +88,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
// need to initialize all types of bluetoothperipheral
|
||||
// using enum here to make sure future types are not forgotten
|
||||
for bluetoothPeripheralType in BluetoothPeripheralType.allCases {
|
||||
bluetoothPeripheralTypeLoop: for bluetoothPeripheralType in BluetoothPeripheralType.allCases {
|
||||
|
||||
switch bluetoothPeripheralType {
|
||||
|
||||
|
@ -145,21 +145,29 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
}
|
||||
|
||||
case .DexcomG5Type:
|
||||
case .DexcomG5Type, .DexcomG6Type:
|
||||
|
||||
if let dexcomG5 = blePeripheral.dexcomG5 {
|
||||
if let dexcomG5orG6 = blePeripheral.dexcomG5 {
|
||||
|
||||
// add it to the list of bluetoothPeripherals
|
||||
let index = insertInBluetoothPeripherals(bluetoothPeripheral: dexcomG5)
|
||||
let index = insertInBluetoothPeripherals(bluetoothPeripheral: dexcomG5orG6)
|
||||
|
||||
if dexcomG5.blePeripheral.shouldconnect {
|
||||
if dexcomG5orG6.blePeripheral.shouldconnect {
|
||||
|
||||
if let transmitterId = dexcomG5.blePeripheral.transmitterId {
|
||||
if let transmitterId = dexcomG5orG6.blePeripheral.transmitterId {
|
||||
|
||||
// create an instance of WatlaaBluetoothTransmitter, WatlaaBluetoothTransmitter will automatically try to connect to the watlaa with the address that is stored in watlaa
|
||||
// create an instance of CGMG5Transmitter (or CGMG6Transmitter), CGMG5Transmitter (or CGMG6Transmitter) will automatically try to connect to the dexcom with the address that is stored in dexcom
|
||||
// add it to the array of bluetoothTransmitters
|
||||
bluetoothTransmitters.insert(CGMG5Transmitter(address: dexcomG5.blePeripheral.address, name: dexcomG5.blePeripheral.name, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG5TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate), at: index)
|
||||
if bluetoothPeripheralType == .DexcomG5Type {
|
||||
|
||||
bluetoothTransmitters.insert(CGMG5Transmitter(address: dexcomG5orG6.blePeripheral.address, name: dexcomG5orG6.blePeripheral.name, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG5TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate), at: index)
|
||||
|
||||
} else {
|
||||
|
||||
bluetoothTransmitters.insert(CGMG6Transmitter(address: dexcomG5orG6.blePeripheral.address, name: dexcomG5orG6.blePeripheral.name, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG6TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate), at: index)
|
||||
|
||||
}
|
||||
|
||||
// if DexcomG5Type is of type CGM, then assign the address to currentCgmTransmitterAddress, there shouldn't be any other bluetoothPeripherals of type .CGM with shouldconnect = true
|
||||
if bluetoothPeripheralType.category() == .CGM {
|
||||
currentCgmTransmitterAddress = blePeripheral.address
|
||||
|
@ -174,6 +182,10 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
}
|
||||
|
||||
// because two types are being handled here (DexcomG5Type and DexcomG6Type) we need to avoid that the same blePeripheral is added two times
|
||||
// this we do by breaking the bluetoothPeripheralTypeLoop
|
||||
break bluetoothPeripheralTypeLoop
|
||||
|
||||
}
|
||||
|
||||
case .BubbleType:
|
||||
|
@ -428,7 +440,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
// no need to send reading to watlaa in master mode
|
||||
break
|
||||
|
||||
case .DexcomG5Type, .BubbleType, .MiaoMiaoType, .BluconType, .GNSentryType, .BlueReaderType, .DropletType, .DexcomG4Type:
|
||||
case .DexcomG5Type, .BubbleType, .MiaoMiaoType, .BluconType, .GNSentryType, .BlueReaderType, .DropletType, .DexcomG4Type, .DexcomG6Type:
|
||||
// cgm's don't receive reading, they send it
|
||||
break
|
||||
|
||||
|
@ -495,17 +507,26 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
}
|
||||
|
||||
case .DexcomG5Type:
|
||||
case .DexcomG5Type, .DexcomG6Type:
|
||||
|
||||
if let dexcomG5 = bluetoothPeripheral as? DexcomG5 {
|
||||
if let dexcomG5orG6 = bluetoothPeripheral as? DexcomG5 {
|
||||
|
||||
if let transmitterId = dexcomG5.blePeripheral.transmitterId, let cgmTransmitterDelegate = cgmTransmitterDelegate {
|
||||
if let transmitterId = dexcomG5orG6.blePeripheral.transmitterId, let cgmTransmitterDelegate = cgmTransmitterDelegate {
|
||||
|
||||
if bluetoothPeripheral.bluetoothPeripheralType() == .DexcomG5Type {
|
||||
|
||||
newTransmitter = CGMG5Transmitter(address: dexcomG5orG6.blePeripheral.address, name: dexcomG5orG6.blePeripheral.name, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG5TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate)
|
||||
|
||||
} else {
|
||||
|
||||
newTransmitter = CGMG6Transmitter(address: dexcomG5orG6.blePeripheral.address, name: dexcomG5orG6.blePeripheral.name, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG6TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate)
|
||||
|
||||
}
|
||||
|
||||
newTransmitter = CGMG5Transmitter(address: dexcomG5.blePeripheral.address, name: dexcomG5.blePeripheral.name, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG5TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate)
|
||||
|
||||
} else {
|
||||
|
||||
trace("in getBluetoothTransmitter, case DexcomG5Type but transmitterId is nil or cgmTransmitterDelegate is nil, looks like a coding error ", log: log, category: ConstantsLog.categoryBluetoothPeripheralManager, type: .error)
|
||||
trace("in getBluetoothTransmitter, case DexcomG5Type or DexcomG6Type but transmitterId is nil or cgmTransmitterDelegate is nil, looks like a coding error ", log: log, category: ConstantsLog.categoryBluetoothPeripheralManager, type: .error)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -653,6 +674,11 @@ class BluetoothPeripheralManager: NSObject {
|
|||
return .DexcomG5Type
|
||||
}
|
||||
|
||||
case .DexcomG6Type:
|
||||
if bluetoothTransmitter is CGMG6Transmitter {
|
||||
return .DexcomG6Type
|
||||
}
|
||||
|
||||
case .BubbleType:
|
||||
if bluetoothTransmitter is CGMBubbleTransmitter {
|
||||
return .BubbleType
|
||||
|
@ -719,6 +745,14 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
return CGMG5Transmitter(address: nil, name: nil, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG5TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate)
|
||||
|
||||
case .DexcomG6Type:
|
||||
|
||||
guard let transmitterId = transmitterId, let cgmTransmitterDelegate = cgmTransmitterDelegate else {
|
||||
fatalError("in createNewTransmitter, type DexcomG6Type, transmitterId is nil or cgmTransmitterDelegate is nil")
|
||||
}
|
||||
|
||||
return CGMG6Transmitter(address: nil, name: nil, transmitterID: transmitterId, bluetoothTransmitterDelegate: self, cGMG6TransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate)
|
||||
|
||||
case .BubbleType:
|
||||
|
||||
guard let cgmTransmitterDelegate = cgmTransmitterDelegate else {
|
||||
|
@ -975,7 +1009,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
bluetoothPeripheral.blePeripheral.parameterUpdateNeededAtNextConnect = true
|
||||
}
|
||||
|
||||
case .watlaaMaster, .DexcomG5Type, .BubbleType, .MiaoMiaoType, .BluconType, .GNSentryType, .BlueReaderType, .DropletType, .DexcomG4Type:
|
||||
case .watlaaMaster, .DexcomG5Type, .BubbleType, .MiaoMiaoType, .BluconType, .GNSentryType, .BlueReaderType, .DropletType, .DexcomG4Type, .DexcomG6Type:
|
||||
// none of the observed values needs to be sent to the watlaa
|
||||
break
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Texts_BluetoothPeripheralsView {
|
|||
static let selectCategory: String = {
|
||||
return NSLocalizedString("selectCategory", tableName: filename, bundle: Bundle.main, value: "Select Category", comment: "when clicking add button in screen with list of bluetoothperipherals, title of pop up where user needs to select bluetooth peripheral category")
|
||||
}()
|
||||
|
||||
|
||||
static let selectType: String = {
|
||||
return NSLocalizedString("selectType", tableName: filename, bundle: Bundle.main, value: "Select Type", comment: "when clicking add button in screen with list of bluetoothperipherals, after having selected the category, a new pop up appears, this is the title of pop up where user needs to select bluetooth peripheral type")
|
||||
}()
|
||||
|
|
|
@ -32,6 +32,7 @@ final class BluetoothPeripheralNavigationController: UINavigationController {
|
|||
super.viewDidLoad()
|
||||
|
||||
delegate = self
|
||||
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
|
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import CoreBluetooth
|
||||
|
||||
class DexcomG5BluetoothPeripheralViewModel {
|
||||
// 't is hier dat de transmitter id die gekozen werd door gebruiker, moet toegevoegd worden
|
||||
|
||||
// MARK: - private properties
|
||||
|
||||
|
@ -114,6 +113,13 @@ class DexcomG5BluetoothPeripheralViewModel {
|
|||
|
||||
}
|
||||
|
||||
// MARK: - public functions
|
||||
|
||||
/// screenTitle, can be overriden for G6
|
||||
public func dexcomScreenTitle() -> String {
|
||||
return BluetoothPeripheralType.DexcomG5Type.rawValue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - conform to BluetoothPeripheralViewModel
|
||||
|
@ -150,7 +156,7 @@ extension DexcomG5BluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
|||
}
|
||||
|
||||
func screenTitle() -> String {
|
||||
return BluetoothPeripheralType.DexcomG5Type.rawValue
|
||||
return dexcomScreenTitle()
|
||||
}
|
||||
|
||||
func sectionTitle(forSection section: Int) -> String {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import Foundation
|
||||
import UIKit
|
||||
import CoreBluetooth
|
||||
|
||||
class DexcomG6BluetoothPeripheralViewModel: DexcomG5BluetoothPeripheralViewModel {
|
||||
|
||||
// MARK: - overriden functions
|
||||
|
||||
override public func dexcomScreenTitle() -> String {
|
||||
return BluetoothPeripheralType.DexcomG6Type.rawValue
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue