LifeScan Operations

Native iOS ==> OneTouch framework

Using the convenience initializer

The Validic One Touch SDK adds a convenience initializer to VLDInformMeasurement, so that it can be instantiated with a BloodGlucoseRecord and a OneTouchDevice.

device.getGlucoseRecords(anchor: anchor, filterType: nil) { (device, anchor, records, error) in
    if (error != nil) {
        NSLog("getGlucoseRecords() for %@ received error: %@", device.name!, error!.localizedDescription)
        return
    }
    var validicRecords = [VLDInformMeasurement]()
    records?.forEach({ (record) in
        if let validicRecord = VLDInformMeasurement(oneTouchGlucoseRecord: record, oneTouchDevice: device) {
            validicRecords.append(validicRecord)
        }
    })
    // Submit the records to Validic
    VLDSession.sharedInstance()?.submitInformRecords(validicRecords)
}

Passive Bluetooth

To enable passive data collection, call OneTouchDeviceManager.shared.connect(device) for each paired device. Add a listener to onDeviceDisconnected that calls connect each time a disconnect occurs. The manager will connect to these devices any time they are available, even in the background. Make sure a listener is attached to the OneTouchDeviceManager, so that when onDeviceConnected is received, a read can be initiated. To disable passive data collection, call OneTouchDeviceManager.shared.disconnect(device) for each paired device.

Example:

public class VLDLifeScanPassiveDemo {
    // Init
    public init() {
        OneTouchDeviceManager.shared.addListener(self)
        OneTouchDeviceManager.shared.autoClockSync = true
    }

    // passiveRead variable with enable/disable
    public var passiveRead: Bool = false {
        didSet {
            for device in deviceManager.devices where device.isPaired {
                passiveRead ? OneTouchDeviceManager.shared.connect(device) : OneTouchDeviceManager.shared.disconnect(device)
            }
        }
    }
}

extension VLDLifeScanPassiveDemo: OneTouchDeviceManagerListener {
    // Read a device when it connects and passiveRead is enabled
    public func onDeviceConnected(device: OneTouchDevice) {
        guard passiveRead else { return } // Remove this if this listener is also used for foreground reads
        if !device.isPaired { return }
        device.getGlucoseRecords(anchor: anchor, filterType: nil) { (device, anchor, records, error) in
            // Records received. Convert to VLDInformMeasurement and submit to Validic.
        }
    }

    // If passiveRead is enabled, call connect again when a device disconnects
    public func onDeviceDisconnected(device: OneTouchDevice) {
        if passiveRead {
            OneTouchDeviceManager.shared.connect(device)
        }
    }

    // Not included: other `OneTouchDeviceManagerListener` methods
}

LifeScan Special Considerations

  • The native library for One Touch requires a license that must be provided for their SDK, and in turn the ValidicOneTouch framework to function.
  • Attempting to take a reading from an unpaired device can start the pairing flow. This is a feature of the OneTouch MCK and cannot be overridden.