-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drv/bluetooth_stm32_cc2640: fix remote_lwp3_char_handle being written…
… over ATT_EVENT_READ_BY_TYPE_RSP is called multiple times. We were assuming that the last call contained the LWP3 hub characteristic. However, this is a bad assumption. The last call contains an empty event with the status set to bleProcedureComplete. This was causing remote_lwp3_char_handle to be written over with junk data and subsequent calls to write to this handle would fail. Since the task thread was just waiting for remote_lwp3_char_handle to be set instead of waiting for bleProcedureComplete, another side effect was that the next command (i.e. a write with response) would have to be retried many times due to blePending because the previous request had not been completed yet. This solves both issues by properly waiting for bleProcedureComplete. An extra check is added to make sure remote_lwp3_char_handle is not written over by this event. The assignment of remote_lwp3_char_handle is moved out of the event handler and into the task thread to make it easier to follow the logic. Also, remote_lwp3_char_handle now holds the value attribute handle instead of the uuid handle. This saves a few +1s when using this handle elsewhere.
- Loading branch information
Showing
1 changed file
with
45 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters