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

RFCOMM: Slightly refactor and correct constants #418

Merged
merged 1 commit into from Jan 31, 2024
Merged

Conversation

zxzxwu
Copy link
Collaborator

@zxzxwu zxzxwu commented Jan 31, 2024

  • Correct PN window size (max/mask: 16 -> 7)
  • Convert constants to enums
  • Convert packet types to dataclasses
  • Add basic connection test for RFCOMM

@@ -350,23 +322,13 @@ def __bytes__(self) -> bytes:
self.max_frame_size & 0xFF,
(self.max_frame_size >> 8) & 0xFF,
self.max_retransmissions & 0xFF,
self.window_size & 0xFF,
self.window_size & 0x07,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The parser on line 312 should also me modified to have window_size=data[7] & 0x07. Maybe even have a check in the constructor to raise ValueError if window_size is not > 0 and < 8.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@zxzxwu zxzxwu marked this pull request as ready for review January 31, 2024 17:20
@zxzxwu zxzxwu merged commit e4364d1 into google:main Jan 31, 2024
51 checks passed
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.

None yet

2 participants