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

Provide additional details to data processor #538

Merged
merged 4 commits into from
Sep 26, 2023
Merged

Provide additional details to data processor #538

merged 4 commits into from
Sep 26, 2023

Conversation

twyatt
Copy link
Member

@twyatt twyatt commented Jul 26, 2023

Logging.DataProcessor now has 4 additional parameters:

  • operation: Operation? (either: Write, Read or Change)
  • service: Uuid?
  • characteristic: Uuid?
  • descriptor: Uuid?

These appear after the existing data: ByteArray parameter:

DataProcessor { data, operation, service, characteristic, descriptor ->
  // todo: process data
}

This allows library consumers to change their data processing behavior based on the characteristic or descriptor that the data was associated with.

For library consumers that don't need the new parameters, they'll need to update their custom data processors as follows:

DataProcessor { data, _, _, _, _ ->
  // todo: process data
}

Closes #532


Unit tests were added because the logging message builder had to go through an overhaul to add this support, so the unit tests provided some confidence that the output remained as expected.

@twyatt twyatt added the major Changes that should bump the MAJOR version number label Jul 26, 2023
@twyatt twyatt marked this pull request as ready for review July 26, 2023 09:21
@twyatt twyatt requested a review from a team as a code owner July 26, 2023 09:21
@twyatt twyatt marked this pull request as draft July 26, 2023 16:53
@twyatt twyatt changed the title Provide service, characteristic and/or descriptor UUIDs to data processor Provide additional details to data processor Jul 26, 2023
Comment on lines 47 to 50
data: ByteArray,
serviceUuid: Uuid?,
characteristicUuid: Uuid?,
descriptorUuid: Uuid?,
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is likely to get more fields added in the future, would be nice to wrap these up in a class of some sort. Would still be breaking now, but would make it non-breaking to add fields in the future.

Copy link
Member Author

@twyatt twyatt Jul 26, 2023

Choose a reason for hiding this comment

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

Admittedly I'm taking a "move fast and break things" mindset with this, partly because it feels warranted while pre-1.x — but mostly because I want to eventually ditch the data processor entirely in favor of #539. 🤷

Copy link
Member Author

@twyatt twyatt Jul 27, 2023

Choose a reason for hiding this comment

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

Added @ObsoleteKableApi to help warn consumers that this API will likely experience churn.

@twyatt twyatt marked this pull request as ready for review July 26, 2023 20:30
@twyatt twyatt requested a review from cedrickcooke July 26, 2023 20:30
@twyatt twyatt modified the milestone: 0.25.0 Jul 26, 2023
@twyatt twyatt added this to the 0.28.0 milestone Sep 6, 2023
@twyatt twyatt enabled auto-merge (squash) September 26, 2023 18:58
@twyatt twyatt merged commit 3bfd9bc into main Sep 26, 2023
2 checks passed
@twyatt twyatt deleted the twyatt/logging branch September 26, 2023 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Changes that should bump the MAJOR version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging.DataProcessor should be provided with details about the data
4 participants