-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Characteristic write without request does not return #282
Comments
Here are some loglines for two cases. First call returns, second not. 2018-09-03 12:35:59.070885+0200 ErDemoApp[363:117921] start writing of item = 971 with canSendWriteWithoutResponse = false 2018-09-03 12:35:59.091440+0200 ErDemoApp[363:117921] start writing of item = 972 with canSendWriteWithoutResponse = false Seems that readiness callback happens but was not used. |
Another problem is that sometimes the peripheralIsReady delegate is never called maybe cause of iOS bug. -write char with timeout (50ms)
|
I have the same problem on OSX. My write without response are not sent (and received). That's because 5.1.3 relies on canSendWriteWithoutResponse which is broken. See https://forums.developer.apple.com/thread/80376 |
So this started happening around April when the candSendWriteWithoutResponse availability check was added for macOS 10.13 and tvOS. |
@c0diq We will look into it and introduce availability check until Apple will fix it on their side. |
…heck fixes Characteristic writeWithoutResponse request does not return #282
Thanks for discussion. I am closing this issue since availability check was introduced in 5.1.4 version. |
Thanks a bunch! |
Hallo,
first, many thanks for this great library. I appreciate all the efforts you put into this work.
In my code I am sending fragments (20bytes) to a peripheral as fast as possible using
write without request which itself is using the iOS property canSendWriteWithoutResponse and the corresponding delegate callback to avoid driver congestion.
Sometimes, lets say once in 20000 tries the call does not return. I know that are there are issues with iOS not setting the property right: https://forums.developer.apple.com/thread/80376
But i am using lates iOS 11.4.1 and this is supposed to work right now.
If I am looking into the code, I am wondering if there is the slightest possibility, that this delegate callback peripheralIsReadyToSendWriteWithoutResponse calls once before the observer is setup and after the property is queried (master code snippet in https://github.com/Polidea/RxBluetoothKit/blob/master/Source/Peripheral.swift):
return Observable.deferred { [weak self] in
guard let strongSelf = self else { throw BluetoothError.destroyed }
return strongSelf.observeWriteWithoutResponseReadiness()
.map { _ in true }
.startWith(strongSelf.canSendWriteWithoutResponse)
.filter { $0 }
.take(1)
.flatMap { _ in
writeOperationPerformingAndListeningObservable(Observable.just(characteristic))
}
}.asSingle()
I see that this is deferred but is it really assured that the observer for Readiness is setup before the flag strongSelf.canSendWriteWithoutResponse is evaluated?
Maybe this is still a bug in iOS Framework?
I am grateful, for any help solving this matter.
To Reproduce
Steps to reproduce the behavior:
Send 20 bytes per write without request as fast as possible until response is missing.
Expected behavior
I expect that onSuccess or onError subscription is called
Environment:
The text was updated successfully, but these errors were encountered: