bg443/BikeBridge
1
10
Fork
You've already forked BikeBridge
3

Add replay framework #14

Open
stereodreieck86 wants to merge 3 commits from stereodreieck86/BikeBridge:replay-framework into master
pull from: stereodreieck86/BikeBridge:replay-framework
merge into: bg443:master
bg443:master

This PR supersedes the previous replay framework PR (#13).

The previous PR did not update correctly after pushing the review changes.

This PR contains:

  • the original replay framework
  • the requested review fixes
This PR supersedes the previous replay framework PR (#13). The previous PR did not update correctly after pushing the review changes. This PR contains: - the original replay framework - the requested review fixes
bg443 left a comment
Copy link

Just minor changes really. Looks ok overall.

Just minor changes really. Looks ok overall.
@ -0,0 +1,22 @@
package dev.bg.bikebridge.util.replay
/**
Owner
Copy link

Please can all comments be in English?

Please can all comments be in English?
stereodreieck86 marked this conversation as resolved
@ -0,0 +7,4 @@
* arbitrary String keys in the metadata map.
*/
enum class MetadataKey(val key: String) {
Owner
Copy link

Can whitespace be minimised here?

enum class MetadataKey(val key: String) {
 BIKE_MODEL("bike_model"),
 MOTOR("motor"),
 DISPLAY("display"),
 BATTERY("battery"),
 REGION("region"),
 AUTHOR("author"),
 NOTES("notes")
}

I'm ok with it between methods in a class though.

Can whitespace be minimised here? ```kotlin enum class MetadataKey(val key: String) { BIKE_MODEL("bike_model"), MOTOR("motor"), DISPLAY("display"), BATTERY("battery"), REGION("region"), AUTHOR("author"), NOTES("notes") } ``` I'm ok with it between methods in a class though.
stereodreieck86 marked this conversation as resolved
@ -0,0 +143,4 @@
val replay = scenario ?: return null
return ReplayStatistics.calculate(replay)
Owner
Copy link

Same as above in terms of minimising whitespace. It can be like

fun statistics(): ReplayStatisticsResult? {
 val replay = scenario ?: return null
 return ReplayStatistics.calculate(replay)
}
Same as above in terms of minimising whitespace. It can be like ```kotlin fun statistics(): ReplayStatisticsResult? { val replay = scenario ?: return null return ReplayStatistics.calculate(replay) } ```
stereodreieck86 marked this conversation as resolved
@ -0,0 +95,4 @@
* Zuerst wird eine temporäre Datei geschrieben.
* Erst danach wird sie in die endgültige Datei umbenannt.
*/
private fun writeAtomically(
Owner
Copy link

I had a comment on the previous PR about this method: #13 (comment)

Do you think this should be renamed?

I had a comment on the previous PR about this method: https://codeberg.org/bg443/BikeBridge/pulls/13#issuecomment-18448538 Do you think this should be renamed?
stereodreieck86 marked this conversation as resolved
- Add Bosch helper utilities
- Extend BleConstants
- Improve BLE logging
- Prepare Bosch discovery infrastructure
Author
Contributor
Copy link

@bg443 Thanks for the review and sorry for the delay – I got completely absorbed in decoding the Bosch MCSP payloads in the meantime! 😅

I have just pushed an update addressing all your points:

Translated all remaining German KDoc/comments to English across the framework.
Removed the excessive whitespace in MetadataKey and ReplayController.
Renamed writeAtomically to writeSafely in ReplayWriter to make the intent clearer, and translated its documentation.

Let me know if anything else is needed!

@bg443 Thanks for the review and sorry for the delay – I got completely absorbed in decoding the Bosch MCSP payloads in the meantime! 😅 I have just pushed an update addressing all your points: Translated all remaining German KDoc/comments to English across the framework. Removed the excessive whitespace in MetadataKey and ReplayController. Renamed writeAtomically to writeSafely in ReplayWriter to make the intent clearer, and translated its documentation. Let me know if anything else is needed!
bg443 left a comment
Copy link

Please check whitespace and German comments

Please check whitespace and German comments
@ -0,0 +1,47 @@
# Improve Discovery Logging with Bosch GATT Names
Owner
Copy link

Is this an artifact from an LLM? Do we need it in this PR?

Is this an artifact from an LLM? Do we need it in this PR?
Author
Contributor
Copy link

Good catch. Yes, this is an internal planning artifact and was accidentally committed. It is not required for the implementation itself. I'll remove it from this PR to keep the history clean.

Good catch. Yes, this is an internal planning artifact and was accidentally committed. It is not required for the implementation itself. I'll remove it from this PR to keep the history clean.
stereodreieck86 marked this conversation as resolved
@ -178,2 +178,3 @@
with(scanResult) {
device.connectGatt(this@BluetoothGattService, false, gattCallback)
log("========== BLE CONNECT REQUEST ==========")
Owner
Copy link

I'd rather keep == logs out of the log

I'd rather keep `==` logs out of the log
Author
Contributor
Copy link

Makes sense. I'll switch to the existing logging style and remove the separator to keep the logs consistent with the rest of the project.

Makes sense. I'll switch to the existing logging style and remove the separator to keep the logs consistent with the rest of the project.
@ -656,0 +693,4 @@
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
log("Requesting ATT MTU 247")
gatt.requestMtu(247)
Owner
Copy link

Is this consistent across all Bosch bikes?

Is this consistent across all Bosch bikes?
Author
Contributor
Copy link

Most likely YES. More testing is necessry.

Most likely YES. More testing is necessry.
stereodreieck86 marked this conversation as resolved
@ -682,0 +748,4 @@
log("UUID : ${service.uuid}")
for (characteristic in service.characteristics) {
Owner
Copy link

Please remove unnecessary whitespace

Please remove unnecessary whitespace
Author
Contributor
Copy link

Sure, I'll collapse the simple cases into single-line entries to match the surrounding style.

Sure, I'll collapse the simple cases into single-line entries to match the surrounding style.
stereodreieck86 marked this conversation as resolved
@ -132,0 +147,4 @@
fun getGattName(uuid: UUID): String =
when (uuid) {
BleConstants.Characteristics.Bosch.LDI_SERVICE ->
Owner
Copy link

nit: one line this BleConstants.Characteristics.Bosch.LDI_SERVICE -> "Bosch LDI Service"

nit: one line this `BleConstants.Characteristics.Bosch.LDI_SERVICE -> "Bosch LDI Service"`
Author
Contributor
Copy link

Sure, I'll collapse the simple cases into single-line entries to match the surrounding style.

Sure, I'll collapse the simple cases into single-line entries to match the surrounding style.
stereodreieck86 marked this conversation as resolved
@ -0,0 +1,36 @@
package dev.bg.bikebridge.util.replay
/**
* Informiert über den Lebenszyklus einer Replay-Wiedergabe.
Owner
Copy link

I still see Deutsch comments :D

I still see Deutsch comments :D
Author
Contributor
Copy link

Thanks 😄 I missed this one. I'll translate the remaining comments to English for consistency.

Thanks 😄 I missed this one. I'll translate the remaining comments to English for consistency.
stereodreieck86 marked this conversation as resolved
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u replay-framework:stereodreieck86-replay-framework
git switch stereodreieck86-replay-framework

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff stereodreieck86-replay-framework
git switch stereodreieck86-replay-framework
git rebase master
git switch master
git merge --ff-only stereodreieck86-replay-framework
git switch stereodreieck86-replay-framework
git rebase master
git switch master
git merge --no-ff stereodreieck86-replay-framework
git switch master
git merge --squash stereodreieck86-replay-framework
git switch master
git merge --ff-only stereodreieck86-replay-framework
git switch master
git merge stereodreieck86-replay-framework
git push origin master
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bg443/BikeBridge!14
Reference in a new issue
bg443/BikeBridge
No description provided.
Delete branch "stereodreieck86/BikeBridge:replay-framework"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?