Connecting Brainbit to iOS app via Bluetooth
Hello Brainbit
I am attempting to establish a bluetooth connection between my iOS app and the Brainbit headset. I am using the below connection script within the ViewDidLoad. I am able to receive a ping from the Brainbit as I can see the initial data exchange in the Xcode print() interface. Yet, I am unable to establish and maintain a connection and move on to receiving EEG data. I know that Bluetooth is setup correctly in my Xcode project because I am able to connect to other Bluetooth devices within the same project workspace. Code is below and print() message.
Thanks very much!!
----------------------------------------------- Code --------------------
let brainBit = NTDeviceEnumerator(deviceType: .TypeBrainbit) // Brainbit constant in class header
override func viewDidLoad() { super.viewDidLoad()
// --- Brainbit code below
brainBit.subscribeFoundDevice { (deviceInfo) in
let device = NTDevice(deviceInfo) // Brainbit constant
device.connect()
print("DeviceInfo: \(deviceInfo.rawInfo)")
print("Device Channels: \(device.channels())")
print("Device State: \(device.readState())")
// stopped here. Need to send connection script question to Brainbit support
}
}
----------------------------------------------- Print() message in Interface Builder -------------------
Bluetooth status is POWERED ON
DeviceInfo: _DeviceInfo(Name: (66, 114, 97, 105, 110, 66, 105, 116, 0, -64, -71, -126, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, -127, -8, 1, 0, 0, 0, 103, 32, 102, 111, 114, 32, 0, -18, 0, -128, 111, 2, 1, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 80, -85, -57, 109, 1, 0, 0, 0, 84, 99, 92, -78, 1, 13, 41, -77, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 10, 32, 3, 1, 0, 0, 0, 0, 40, 32, 3, 1, 0, 0, 0, 80, -84, -57, 109, 1, 0, 0, 0, 76, 55, 93, -78, 1, -97, 83, 29, -96, -85, -57, 109, 1, 0, 0, 0, 40, -89, 92, -78, -127, -112, 112, 60, 22, 0, 0, 0, 0, 0, 0, 0, 103, 32, 102, 111, 114, 32, 0, -18, 24, 0, 0, 0, 0, 0, 0, 0, 80, -121, -38, -6, 1, 0, 0, 0, 88, 25, -37, -6, 1, 0, 0, 0, 0, -64, -71, -126, 2, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, -16, 0, -32, 96, 2, 1, 0, 0, 0, 88, 25, -37, -6, 1, 0, 0, 0, 0, -64, -71, -126, 2, 0, 0, 0, 0, 48, -49, -6, 1, 0, 0, 0, 0, 48, -49, -6, 1, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0), Address: (54, 57, 54, 49, 57, 53, 49, 69, 45, 55, 51, 67, 54, 45, 56, 49, 49, 56, 45, 55, 66, 69, 67, 45, 49, 50, 70, 56, 66, 68, 65, 48, 51, 49, 66, 69, 0, 0, 0, 0, 0, -64, -71, -126, 2, 0, 0, 0, 88, -82, -57, 109, 1, 0, 0, 0, 0, 0, -127, -8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 2, 1, 0, 0, 0, -128, -84, -57, 109, 1, 0, 0, 0, 40, -20, 91, -78, 1, 114, 72, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -64, -128, -8, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, -112, -84, -57, 109, 1, 0, 0, 0, -12, 125, 92, -78, 1, -35, 104, -90, -80, -84, -57, 109, 1, 0, 0, 0, 36, -42, 92, -78, 1, -104, 127, -34, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, -16, -84, -57, 109, 1, 0, 0, 0, 48, -82, 92, -78, -127, -44, 69, 56, 88, -82, -57, 109, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, -125, 86, 2, 1, 0, 0, 0, -64, 100, 5, -125, 2, 0, 0, 0, 40, -83, -57, 109, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0), SerialNumber: 0) Device Channels: [<neurosdk.NTChannelInfo: 0x2810e36c0>, <neurosdk.NTChannelInfo: 0x2810e0900>, <neurosdk.NTChannelInfo: 0x2810e2640>, <neurosdk.NTChannelInfo: 0x2810e2580>, <neurosdk.NTChannelInfo: 0x2810e24c0>, <neurosdk.NTChannelInfo: 0x2810f4180>, <neurosdk.NTChannelInfo: 0x2810f40c0>, <neurosdk.NTChannelInfo: 0x2810f43c0>, <neurosdk.NTChannelInfo: 0x2810f4480>, <neurosdk.NTChannelInfo: 0x2810f4540>] Device State: Optional(neurosdk.NTState.Disconnected) 2019-10-18 11:22:35.966443-0600 [CoreBluetooth] XPC connection invalid