Skip to content

Fix getOutputReport, getInputReport and getFeatureReport: not being able to create more than one report + temporal coupling - #812

Merged
h2zero merged 5 commits into
h2zero:masterfrom
afpineda:master
Dec 19, 2024
Merged

h2zero merged 5 commits into
h2zero:masterfrom
afpineda:master

Conversation

@afpineda

Copy link
Copy Markdown
Contributor

This fix is related to Issue #805 in the NimBLEHIDDevice class.

What fixes:

  • The user can call getXXXXXReport() in any order.
  • The user gets a different characteristic for each different reportID.
  • The user gets the same characteristic for the same reportID.

Fix description:

A new private method is introduced: locateReportCharacteristicById(): given a reportID, it returns the characteristic if already created, nullptr otherwise.
getXXXXXReport() tries to locate the characteristic. If found, it is returned "as is". If not found, it is created and returned.

Drawbacks:
There is a computational overhead. The user should store/cache the value returned by getXXXXXReport() instead of repeating the calls. Perhaps we should warn about this in the documentation.

@h2zero

h2zero commented Dec 17, 2024

Copy link
Copy Markdown
Owner

#805 (comment)

@h2zero h2zero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a minor comment. Also can you please check the formatting, if in vscode you can just right click and format document.

Comment thread .gitignore Resolved
@afpineda

Copy link
Copy Markdown
Contributor Author

Also can you please check the formatting, if in vscode you can just right click and format document.

Done.

@h2zero
h2zero merged commit 462f918 into h2zero:master Dec 19, 2024
@h2zero

h2zero commented Dec 19, 2024

Copy link
Copy Markdown
Owner

Thank you @afpineda !

h2zero pushed a commit that referenced this pull request Dec 22, 2024
…ture report + temporal coupling (#812)

* Add ".development" to gitignore

Arduino IDE requires this file when developing an Arduino library, but that file must not be included in the release.

* Fix get Input/Output/Feature Report
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

Successfully merging this pull request may close these issues.

2 participants