-
Notifications
You must be signed in to change notification settings - Fork 74
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
InvalidState
after re-connecting
#256
Comments
Just did a little more investigation. This issue only appears when the host is windows. I also notice that for macOS and iOS, after the first connection and reconnection, the
Then everything goes well. When connecting to a windows host, the logs above only appear at the first connection. It seems calling |
The NRF softdevice documentation is the best source for detailed information. They have message sequence charts and descriptions of each possible error return from each API function. In the case of
Most likely the second option. One of the main things that's saved in the sys_attrs is the value of all CCCD descriptors. The GATT spec says that those values persist across connections for bonded pairs, which is why you're host only writes to the CCCD descriptor on the first connection. If your |
I believe that I did this correctly. As you can see in the log, I saved the sys_attr to flash when bonding, and at the second connection, same sys_attr was loaded and set. But I still got InvalidState when the host is Windows (it works correctly for macos/iOS). save_sys_attr was not called because I was testing the power loss situation. I'm testing cases of save_sys_attr is called. |
Yeah, when |
You can call |
It is good to use |
No, that won't work. At this point I think everything in |
thanks! |
The original issue is #237, since it's a different problem, I'm opening this new issue.
I just found I didn't really solve the reconnection problem. I called
load_sys_attrs
after connected:where my
load_sys_attrs
is:The first connection and reconnection are both good, but once I tried to send HID report, the
gatt_server::notify_value(self.conn, self.handle, report)
returns aRaw(InvalidState)
error. Here is the full log of the first and second connection:first(all good):
second(reconnection, notify value error):
And same as before, if I remove
bonder.load_sys_attrs(&conn);
, then I getRaw(BleGattsSysAttrMissing)
error.The sys_attr saved and loaded was right according to the log, but the
InvalidState
still happens when callinggatt_server::notify_value()
@alexmoon Do you have any ideas? I'll much appreciate if you can help!
Originally posted by @HaoboGu in #237 (comment)
The text was updated successfully, but these errors were encountered: