Bluetooth Peripherals

Native iOS ==> Bluetooth framework

VLDBluetoothPeripheral represents Bluetooth peripheral models that can be discovered or read from by VLDBluetoothPeripheralController.

A peripheral object contains various information to be displayed to the user:

  • name - Name of the peripheral comprised of the the manufacturer name and model number.
  • pairingInstructions - Text telling the user how to pair the peripheral, if the peripheral requires pairing.
  • instructions - Text telling the user how to initialize the reading process with the peripheral.
  • readingInstructions - Text telling the user what to do during the reading process.
  • imageURL - URL for an image of the peripheral.

Supported Peripherals

To retrieve a list of peripherals that are supported in the Bluetooth framework, call VLDBluetoothPeripheral.supportedPeripherals():

guard let supportedPeripherals = VLDBluetoothPeripheral.supportedPeripherals() as? [VLDBluetoothPeripheral] else { return }

for peripheral in supportedPeripherals {
    print("Peripheral: \(peripheral.name())")
}

VLDBluetoothPeripheral.peripheralForID() can be used to retrieve a specific peripheral by peripheral ID. See the VLDBluetoothPeripheral class documentation for additional information.

Generic Peripherals

You can communicate with glucose meters that fully support the Bluetooth generic Glucose Profile using peripheralID 1000.

You can communicate with pulse oximeters that fully support the Bluetooth generic Pulse Oximeter Profile using peripheralID 2000.

You can communicate with blood pressure monitors that fully support the Bluetooth generic Blood Pressure Monitor Profile using peripheralID 3000.

You can communicate with thermometers that fully support the Bluetooth generic Health Thermometers Profile using peripheralID 4000.

You can communicate with weight scales that fully support the Bluetooth generic Weight Scales Profile using peripheralID 5000.

Unlike custom-supported peripherals, these generic peripherals have generic information in the BluetoothPeripheral object. The intended implementation is you either filter these peripherals from your view (if you do not want to display them to your end users), or you substitute in your own device name, image, and instructions within your app so that end users see device information that is applicable to the specific device(s) you wish to support.

Filtering Peripheral List

To get a subset of devices you can use the built in filter method on Arrays in Swift. Check out the Supported Peripherals list to find the ID of the devices you want to display.

For example, if you only want to display the A&D Pulse Oximeter (model UP-200BLE) you could do this:

guard let supportedPeripherals = VLDBluetoothPeripheral.supportedPeripherals() as? [VLDBluetoothPeripheral]
let devices = peripherals.filter { $0.peripheralID == 53 }