Examples#
The repository includes Example/BrainAccessExample.xcodeproj, a SwiftUI scan → connect →
stream harness with device info and firmware update. It is included in the distribution zip as a
starting point, not as a published app.
What it demonstrates#
Scanning for BrainAccess advertisements.
Connecting and handshaking to
DeviceState.ready.Streaming
EegChunkpackets.Showing battery, contact, missed-sample and hardware-generation state.
Firmware update with a board check: the headset’s DIS Model Number must name the board the
firmware_<MODEL>.binimage is built for.Exercising the same SDK calls as a consumer app without adding UI dependencies to the SDK.
Run the example#
Open
Example/BrainAccessExample.xcodeprojin Xcode on a Mac. Its package reference is the parent folder: the source package in the repository, or the bundle’s binaryPackage.swiftin the distribution zip.Select your team under Signing & Capabilities.
Run on a physical iPhone. The simulator cannot exercise CoreBluetooth scanning.
The project already sets NSBluetoothAlwaysUsageDescription. Example/README.md covers the
firmware images.
Minimal console-only check#
For non-UI integration checks inside an existing app target, this body exercises the same SDK path:
import BrainAccessKit
func printFirstChunk() async {
let client = BrainAccessClient(transport: CoreBluetoothTransport())
do {
for await device in client.scan() {
let session = try await client.connect(device).get()
for try await chunk in session.stream() {
print(chunk.channels, chunk.sampleCount)
break
}
await client.disconnect(device.id)
break
}
} catch {
print(error.localizedDescription)
}
}