Skip to content
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

GATT ERROR #74

Closed
Baniares opened this issue Oct 12, 2017 · 8 comments
Closed

GATT ERROR #74

Baniares opened this issue Oct 12, 2017 · 8 comments

Comments

@Baniares
Copy link

I'm facing this problem in an LG phone and I'm also facing problems with some samsung galaxy s8 any ideas on what is going on?

(I don't have access to a samsung galaxy s8 at the moment but soon I will and I'll be posting stack trace for those too)

I: Connecting to the device...
D: connect() - device: CC:67:14:BB:7A:C1, auto: false
D: registerApp()
D: registerApp() - UUID=13c0e951-8504-4841-bd05-8f779c3cafca
D: onClientRegistered() - status=0 clientIf=6
W: update focus... 
D: onClientConnectionState() - status=0 clientIf=6 device=CC:67:14:BB:7A:C1
I: Connected to GATT server
D: discoverServices() - device: CC:67:14:BB:7A:C1
I: Attempting to start service discovery... succeed
I: Action received: android.bluetooth.device.action.ACL_CONNECTED
D: onSearchComplete() = Device=CC:67:14:BB:7A:C1 Status=0
I: Services discovered
D: Connected to monitor
D: Starting DFU process
I: Reading DFU version number...
I: Version number read: 0.6 -> Bootloader from SDK 8.0 or newer. Bond sharing supported
W: Legacy DFU bootloader found
I: Enabling notifications...
D: setCharacteristicNotification() - uuid: 00001531-1212-efde-1523-785feabcd123 enable: true
E: Descriptor write error: 133
E: Unable to set notifications state (error 133)
I: Disconnecting from the device...
D: cancelOpen() - device: CC:67:14:BB:7A:C1
D: onClientConnectionState() - status=8 clientIf=6 device=CC:67:14:BB:7A:C1
E: Connection state change error: 8 newState: 0
D: refresh() - device: CC:67:14:BB:7A:C1
D: Disconnecting from monitor
I: Action received: android.bluetooth.device.action.ACL_DISCONNECTED
I: Refreshing result: true
I: Cleaning up...
D: close()
D: unregisterApp() - mClientIf=6
D: Disconnected from monitor
D: GATT ERROR
@philips77
Copy link
Member

Try restarting the Bluetooth adapter on your phone, or the whole phone. It may be some non-released resources in the Bluetooth stack. But I would say it is something wrong with your peripheral. Looks like it doesn't handle the descriptor write request properly. Error 133 is thrown when the phone didn't get an expected reply or got something unexpected (a device behaved incorrectly).
It's not an issue in this DFU library.

@veonua
Copy link

veonua commented Dec 3, 2017

have the same error due to service list cache, we need to force refresh service cache (it's hidden API)

@philips77
Copy link
Member

Let me close the issue, as it's a year old now. If you still are facing the problem, feel free to create a new one.

@veonua
Copy link

veonua commented Oct 24, 2018

Let me close the issue, as it's a year old now.
Have you done something?

Android 7+ caches BT service list, but Nordic changes service set when DFU starts.
so when application tries to connect to DFU service it fails.

@philips77
Copy link
Member

That's why we use address +1 in bootloader mode (for bonded devices, when you use Buttonless service with bonds, it relies on Service Changed indication instead), to avoid cache problems.

@veonua
Copy link

veonua commented Oct 24, 2018

it would be nice to attach commit # when it was changed before closing this issue

@philips77
Copy link
Member

Sorry, I wasn't clear enough. There was no any change in the DFU library. It is the bootloader that is using incremented address. It has been like that since the beginning, or at least some very old SDK. Bootloader uses address +1 to avoid caching issues (although it is not required in my opinion, as there is this hidden refresh() method, which could be used if we know that services are to be changed). In Secure DFU with bonds, and Legacy DFU when bonding is used, starting from SDK 8 (afair) the same address is used and cache is refreshed based on Service Changed indication.

But as you are facing this problem (and refreshing the cache does help), that means that you either are using the same address in app and bootloader mode, or are connecting to the secondary address with some other services. But, to be honest, the 133 on enabling notifications doesn't look like caching issue for me. It would rather send INVALID HANDLE error instead, I think.

@veonua
Copy link

veonua commented Oct 24, 2018

to fix this issue I had to add

refreshDeviceCache() to

sendLogBroadcast(LOG_LEVEL_DEBUG, "gatt.discoverServices()");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants