Skip to content

Connectivity

Daniel Varga edited this page Jun 28, 2019 · 4 revisions

Bluetooth Low Energy

The device is set up in the BLE peripheral role, providing the data through notifications using various standard as well as custom services. The S132 SoftDevice Bluetooth 5 protocol stack is used for its high performance, broad feature set and wide support. The BLE code is based on the Nordic Heart Rate Application which is further expanded by additional services.

The following gives a summary of the available Generic Attribute Profile (GATT) services and characteristics:

  • Generic Access
    • Device Name
    • Appearance
    • Peripheral Preferred Connection Parameters
    • Central Address Resolution
  • Generic Attribute
    • Service Changed
  • Heart Rate
    • Heart Rate Measurement
    • Body Sensor Location
  • Health Thermometer
    • Temperature Measurement
  • Battery Service
    • Battery Level
  • Device Information
    • Manufacturer Name String
  • Custom Service
    • Custom Characteristic (step count)
    • Custom Characteristic (blood oxygen saturation)

The first six in the list are standard services defined by the Bluetooth Special Interest Group (SIG) and implemented in the Nordic SDK.

For the remaining data that needs to be transmitted (step count, blood oxygen saturation) a custom service is used. In the future this can easily be expanded to include further characteristics, or new services can be added. The source code for the custom service was developed with the help of a Nordic tutorial series on Bluetooth services (part 1, part 2, part 3). The custom service and characteristics require a 128-bit vendor specific UUID. A base UUID is generated by the nRFgo Studio and is used in combination with short 16-bit UUIDs to save on memory. Due to the many services the advertising has to be set up to only include the UUIDs in the scan response in order to keep the advertising packet length within the limit of 31 Bytes.

Near-Field Communication

For ease of connecting and pairing the P24 device includes an NFC antenna. It is configured as a Type 2 Tag with three separate records in the NFC Data Exchange Format (NDEF) message.

  • Text Record - containing the device name
  • URI Record - website link for iOS
  • Android Application Record - containing the app package name

For the demo the device has been set up to disconnect any current connections and start advertising whenever an NFC field is sensed (i.e. a phone is in contact). The name is included to allow the phone to connect to the correct device.

A URI Record linking to the Patient 24 website is included for iOS devices. An Apple Universal Link could be used to launch the iOS app, however this requires an expensive Apple Developer licence, which is over the budget of this project.

The Android Application Record allows to launch our Android app when the phone is brought close to the tag. If the app is not yet installed, it automatically redirects to the Google Play Store.

In the future the NFC functionality can be extended to include secure Out Of Band (OOB) pairing and bonding.