iOS

On iOS, the Aidlab SDK is provided as a CocoaPods library which contains all the necessary code to use the SDK.

Aidlab SDK for iOS was build with Swift 5.5, using Xcode 13.0 and is created on the top of Apple's Core Bluetooth technology.

Installation

  • Install AidlabSDK by adding pod 'AidlabSDK' in your podfile.

If you don't know what CocoaPods are, here is a tutorial that should help you.

Basics

The first step you need to take is to import our module.

import AidlabSDK

To start your connection with Aidlab, you need to create an AidlabSDK object:

aidlabSDK = AidlabSDK(delegate: self, aidlabDelegate: self)
aidlabSDK?.scan();

The scan function enables scanning for nearby Aidlabs. If one is found, the didDiscover function is called. An exemplary implementation of the function:

func didDiscover(_ aidlab: CBPeripheral) {

    let signals: [Signal] = [.ecg, .activity, .steps]

    aidlabSDK?.stopScan()
    aidlabSDK?.connect(signals: signals, peripheral: aidlab, aidlabDelegate: self)
}

The connect function expects three parameters:

  • signals - an array of signals you would like to listen to. List of the available signals.
  • peripheral - the name of the peripheral you'd like to connect to (in this case aidlab).
  • aidlabDelegate - delegate to receive events from aidlab.

The stopScan function stops searching for new Aidlabs - don't use it here if you'd like to connect to multiple Aidlabs at once.

For each event, the first parameter is an IAidlab object:

public protocol IAidlab: AnyObject {

    var address: UUID? { get }
    var firmwareRevision: String? { get }
    var hardwareRevision: String? { get }
    var serialNumber: String? { get }
    /* Aidlab's synchronization delegate */
    var aidlabSynchronizationDelegate: AidlabSynchronizationDelegate? {get set}
    /* Communicate with and control Aidlab. */
    func send(_ command: String)
    /* Disconnect from Aidlab. */
    func disconnect()
    /* Set the ECG Filtraton Method to normal or aggresive. */
    func setECGFiltrationMethod(_ ecgFiltrationMethod: ECGFiltrationMethod)
    /* Read the Received Signal Strength Indicator
        (a value between 0 and -120 measured in decibels). */
    func readRSSI()
    func startSynchronization()
    func stopSynchronization()
}

Saving data

While developing an app in Swift, you can take control over synchronization. After acquiring data and connecting Aidlab to your device, Aidlab will start sending unsynchronized data immediately. To change that, you can use the following functions on your IAidlab object:

func startSynchronization()
func stopSynchronization()

results matching ""

    No results matching ""