I am using the Bluejay framework to write an app that will connect to my BLE device. I have a service that streams data the moment the firmware is done booting.
I am calling this method:
func listenLiveSignals()
{
let requestedChar = CharacteristicIdentifier(uuid: NotioModel.signalLiveData, service: ServiceIdentifier(uuid: NotioModel.SignalsService))
bluejay.listen(to: requestedChar, multipleListenOption: .replaceable) {[weak self] (result: ReadResult<NotioSignals>) in
print("Signals update")
switch result {
case .success(let signals):
self?.liveSignals = signals
case .failure(let err):
print("Error: \(err)")
}
}
}
and in the logs I get this
Queue will start Bluejay.ListenCharacteristic...
Will start listening to Characteristic: 9AFABEDB-50F5-4766-8EE1-709073D6EB08, Service: 9AFAABCD-50F5-4766-8EE1-709073D6EB08 on NOTIOFE46EEBB.
Listening to Characteristic: 9AFABEDB-50F5-4766-8EE1-709073D6EB08, Service: 9AFAABCD-50F5-4766-8EE1-709073D6EB08 on NOTIOFE46EEBB.
Queue has removed Bluejay.ListenCharacteristic because it has finished.
Queue is empty, nothing to update.
This is the code I use to connect to the peripheral.
func connect(_ peripheral: PeripheralIdentifier) {
self.bluejay.connect(peripheral, timeout: .seconds(15)) { connectionResult in
switch connectionResult {
case .success:
print("Connection attempt to: \(peripheral.description) is successful")
case .failure(let error):
print("Error: \(error)")
}
}
}
The project I have also connects to the Nordic dev board loaded with the BlinkyLed service and the same code is used to connect to the button service on it and it works great, this is a bit baffling for me.
If any one know why Bluejay does this les me know or if you need more core also let me know.
Problem is on the firmware side, the BLE device needs me to tell it to activate the data stream. XD well importante of documenting APIs even if it is a firmware.