Implementation of Bluetooth Low Energy communication using Flow Controllers to make asynchronous code clean
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
BluetoothDemo.xcodeproj Updates for article Jul 21, 2018
BluetoothDemo
.gitignore
LICENSE
README.md

README.md

SwiftBluetooth

Implementation of Bluetooth Low Energy communication using Flow Controllers to make asynchronous code clean.

You can read more in this article: Swift – Bluetooth Low Energy communication using Flow Controllers

Structure

BluetoothService:

  • BluetoothService.swift
    Only very basic operations - state, connect, disconnect, startScan, stopScan and property to assign FlowController.
  • BluetoothConnectionHandler.swift
    Extension to handle delegate methods related with connection like didConnect, didDisconnectPeripheral, didDiscover etc.
  • BluetoothEventsHandler.swift
    Extension to handle delegate methods related with Bluetooth events like didDiscoverServices, didUpdateValueFor etc.
  • BluetoothCommands.swift
    Extension to wrap preparing requests like binary payloads.

Flows implementation:

  • FlowController.swift
  • PairingFlow.swift
  • SynchronizationFlow.swift (example - not implemented)
  • ConfigurationFlow.swift (example - not implemented)