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

Handle filler value for DateCode #38

Merged
merged 1 commit into from
Jan 19, 2025
Merged

Handle filler value for DateCode #38

merged 1 commit into from
Jan 19, 2025

Conversation

cottsay
Copy link
Owner

@cottsay cottsay commented Jan 19, 2025

It appears that some EMU-2 devices will fill the date code with '\xff' characters in some scenarios. We've already seen some fields use 0xff to represent a sort of 'filler' value where there is no date to give. This scenario is a little bit different because the raw representation is 0xff where before we were seeing 0xff written out in ASCII characters, but given that the number of characters still matches documentation's expected value I think we can draw the same conclusion here.

There are a few components to this change:

  1. Switch from plain ASCII to codepage 1252 extended ASCII. This is actually called out in the RAVEn protocol documentation.
  2. Set the _stash attribute earlier in the _reset method to limit the fallout of any problems feeding the XML root tag to the parser.
  3. Specifically handle an all-0xFF date code as 'None'.

@cottsay cottsay added the bug Something isn't working label Jan 19, 2025
@cottsay cottsay self-assigned this Jan 19, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.30%. Comparing base (81d3322) to head (d37ea33).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #38   +/-   ##
=======================================
  Coverage   87.30%   87.30%           
=======================================
  Files           7        7           
  Lines         819      819           
=======================================
  Hits          715      715           
  Misses        104      104           

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

It appears that some EMU-2 devices will fill the date code with '\xff'
characters in some scenarios. We've already seen some fields use 0xff to
represent a sort of 'filler' value where there is no date to give. This
scenario is a little bit different because the raw representation is
0xff where before we were seeing 0xff written out in ASCII characters,
but given that the number of characters still matches documentation's
expected value I think we can draw the same conclusion here.

There are a few components to this change:
1. Switch from plain ASCII to codepage 1252 extended ASCII. This is
   actually called out in the RAVEn protocol documentation.
2. Set the _stash attribute earlier in the connection_made method to
   limit the fallout of any problems feeding the XML root tag to the
   parser.
3. Specifically handle an all-0xFF date code as 'None'.
@cottsay cottsay force-pushed the cottsay/date-code-filler branch from 32cea09 to d37ea33 Compare January 19, 2025 19:02
@cottsay cottsay merged commit 15df28a into main Jan 19, 2025
16 checks passed
@cottsay cottsay deleted the cottsay/date-code-filler branch January 19, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants