Skip to content

Handle Unknown Data Pages - #134

Merged
StephenHidem merged 2 commits into
masterfrom
HandleUnknownDataPages
May 31, 2026
Merged

Handle Unknown Data Pages#134
StephenHidem merged 2 commits into
masterfrom
HandleUnknownDataPages

Conversation

@StephenHidem

Copy link
Copy Markdown
Owner

PR Classification

API enhancement to support custom/unknown ANT+ data pages and update dependencies.

PR Summary

This pull request adds the UnknownDataPageReceived event to the AntDevice class, enabling applications to handle unknown or custom data pages, and updates related parsing and tests. It also updates NuGet dependencies and documentation.

  • AntDevice.cs: Introduces the UnknownDataPageReceived event and supporting methods for raising it.
  • Device profile classes (e.g., BicyclePower, FitnessEquipment, HeartRate): Raise the event when unknown data pages are encountered during parsing.
  • CommonDataPages.cs: Changes ParseCommonDataPage to return a bool for parse success/failure.
  • Unit test files: Add and update tests to verify event raising and logging for unknown data pages.
  • Project and documentation files: Update version numbers and document the new event.

Introduce UnknownDataPageReceived event and OnUnknownDataPageReceived methods to AntDevice, enabling device profiles to notify subscribers when unrecognized data pages are received. Update all relevant Parse methods to use this event instead of direct logging. Refactor CommonDataPages to return a bool for parse success, and update tests to verify event raising and logging. Includes minor test and code cleanups for consistency.
Added UnknownDataPageReceived event to AntDevice for custom/unknown data page handling. Updated NuGet dependencies and incremented package versions. Revised documentation and version history to reflect changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the UnknownDataPageReceived event to the AntDevice class, allowing subscribers to handle unrecognized data pages. It refactors CommonDataPages.ParseCommonDataPage to return a boolean indicating success, updates various device profiles to raise the new event when parsing fails, and adds corresponding unit tests and documentation. The review feedback recommends cloning the dataPage byte array before raising the event to prevent subscribers from modifying the shared buffer, and adding defensive guard checks in ParseCommonDataPage to avoid potential null reference or index out of range exceptions.

Comment thread AntPlus/AntDevice.cs
Comment thread AntPlus/AntDevice.cs
Comment thread AntPlus/CommonDataPages.cs
@StephenHidem
StephenHidem merged commit 661cc97 into master May 31, 2026
5 checks passed
@StephenHidem
StephenHidem deleted the HandleUnknownDataPages branch May 31, 2026 20:21
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.

1 participant