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

fix(coap-server): add missing cov:observe subprotocol #1214

Merged
merged 3 commits into from
Jan 14, 2024

Conversation

JKRhb
Copy link
Member

@JKRhb JKRhb commented Jan 10, 2024

Trying to interact with a test thing using CoAP, I noticed that the forms provided in the Thing Descriptions do not include the subprotocol value cov:observe for observable properties and events. This PR tries to fix the issue by adding logic to determine if a subprotocol should be added to a form.

The implementation got a bit more complicated than initially expected because I noticed that you probably should not simply add the subprotocol to all property forms, but only those containing the op values observeproperty and/or unobserveproperty. Furthermore, I got the feeling that you should not use cov:observe with readproperty or writeproperty (which I think is currently not clearly stated in the CoAP Binding Template).

Therefore, during the TD generation process, I split the op values for read/write operations and observe/unobserve operations, and generated separate forms for the two kinds of operations. There might be some more discussion and clarification in the protocol binding document needed to decide whether cov:observe should or should not be used with forms containing readproperty and/or writeproperty. In general, the approach in this PR should work regardless of the eventual decision, though.

Besides the actual implementation, I performed some minor refactoring of the process of assigning the forms to affordances and added a test to cover all changes made.

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8adf840) 77.57% compared to head (5a58d39) 77.74%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1214      +/-   ##
==========================================
+ Coverage   77.57%   77.74%   +0.16%     
==========================================
  Files          83       84       +1     
  Lines       17332    17443     +111     
  Branches     1751     1761      +10     
==========================================
+ Hits        13446    13561     +115     
+ Misses       3850     3846       -4     
  Partials       36       36              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JKRhb JKRhb force-pushed the coap-observe branch 2 times, most recently from 402878d to 04064c5 Compare January 12, 2024 14:20
@JKRhb JKRhb marked this pull request as ready for review January 12, 2024 14:23
@JKRhb JKRhb added the binding-coap Issues related to coap protocol binding label Jan 12, 2024
Copy link
Member

@relu91 relu91 left a comment

Choose a reason for hiding this comment

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

I have some questions below before approving the PR.

Copy link
Member

@relu91 relu91 left a comment

Choose a reason for hiding this comment

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

Good to go now.

@JKRhb
Copy link
Member Author

JKRhb commented Jan 12, 2024

Good to go now.

Thank you! I incorporated the latest change into 55e197c, squashing the commits. Hope that was fine.

@relu91 relu91 merged commit 6901b5a into eclipse-thingweb:master Jan 14, 2024
11 checks passed
@JKRhb JKRhb deleted the coap-observe branch January 14, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding-coap Issues related to coap protocol binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants