Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f25c9e9
begin de-future-ifying the values
MoralCode May 10, 2022
8ebba12
add and use classes for Time and Duration-stamped packets
MoralCode May 10, 2022
44870e5
split workout summary into a second class for the part 2 data
MoralCode May 10, 2022
e19cc7b
remove completer fields and split into appropriate classes
MoralCode May 10, 2022
20f45e7
syntax and stuff
MoralCode May 10, 2022
aaf75d7
use fromBytes in super call
MoralCode May 10, 2022
8518ee8
remove IdempotentCompleter helper
MoralCode May 19, 2022
e8f8cb7
remove Futures Docs
MoralCode Apr 20, 2025
4fa22e6
automatic android update from flutter
MoralCode Apr 19, 2025
0fe350c
finish reverting WorkoutSummary away from futures
MoralCode Apr 20, 2025
3e2a4a4
start using some dynamic values from the flutter SDK for build targets
MoralCode Apr 20, 2025
4ddc3eb
bump some versions to get the build to work
MoralCode Apr 20, 2025
575c18a
Updating Manifest according to current state of flutter_reactive_ble
MonsieurRz Apr 6, 2025
7c4487f
splash screen is deprecated and provided through style resources on a…
MoralCode Apr 20, 2025
c1ec5ea
Fixed all iOS errors in example
Aldaniee Nov 7, 2022
312a98a
adjust unit tests for new WorkoutSummary Structure
MoralCode Apr 21, 2025
7235101
ensure that warnings and infos don't cause the analysis to fail
MoralCode Apr 21, 2025
1526456
fix analysis warning by constraining lower end of compatibility
MoralCode Apr 21, 2025
06a884d
is it checking out something wrong?
MoralCode Apr 21, 2025
69ded72
try specific versions
MoralCode Apr 22, 2025
dca6ab0
Revert "update example for new futures api"
MoralCode Apr 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Note: This workflow uses the latest stable version of the Dart SDK.
# You can specify other versions if desired, see documentation here:
# https://github.com/dart-lang/setup-dart/blob/main/README.md
# - uses: dart-lang/setup-dart@v1
- uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.1.3

- uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: 3.13.0

- name: Install dependencies
run: flutter pub get
Expand All @@ -37,7 +39,7 @@ jobs:

# Consider passing '--fatal-infos' for slightly stricter analysis.
- name: Analyze project source
run: flutter analyze
run: flutter analyze --no-fatal-infos --no-fatal-warnings

# Your project will need to have tests in test/ and a dependency on
# package:test for this step to succeed. Note that Flutter projects will
Expand Down
30 changes: 19 additions & 11 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 64 additions & 21 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 22 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,32 +109,28 @@ myErg.monitorForWorkoutSummary().listen((workoutSummary) {
```

Each workout summary is a flutter object that contains the following fields:
- `Future<DateTime> timestamp`
- `Future<double> workTime`
- `Future<double> workDistance`
- `Future<int> avgSPM`
- `Future<int> endHeartRate`
- `Future<int> avgHeartRate`
- `Future<int> minHeartRate`
- `Future<int> maxHeartRate`
- `Future<int> avgDragFactor`
- `Future<int> recoveryHeartRate`
- `Future<WorkoutType> workoutType`
- `Future<double> avgPace`
- `Future<IntervalType> intervalType`
- `Future<int> intervalSize`
- `Future<int> intervalCount`
- `Future<int> totalCalories`
- `Future<int> watts`
- `Future<int> totalRestDistance`
- `Future<int> intervalRestTime`
- `Future<int> avgCalories`

Futures are handy here since the erg can send back different data at different times. The primary reason for this is the `recoveryHeartRate` field which the erg sends after the user has been resting for 1 minute. If the workout is cancelled or the erg is turned off before the end of this minute, the data may never arrive. See #10.

Overall this method of accessing workout summary data is not the most ideal, and is likely to change later if a better solution is found. See #11.


- `timestamp`
- `workTime`
- `workDistance`
- `avgSPM`
- `endHeartRate`
- `avgHeartRate`
- `minHeartRate`
- `maxHeartRate`
- `avgDragFactor`
- `recoveryHeartRate`
- `workoutType`
- `avgPace`
- `intervalType`
- `intervalSize`
- `intervalCount`
- `totalCalories`
- `watts`
- `totalRestDistance`
- `intervalRestTime`
- `avgCalories`

The `recoveryHeartRate` field is one that the erg sends after the rower has been resting for 1 minute. If the workout is cancelled or the erg is turned off before the end of this minute, the data may never arrive. See #10. This is likely to change later if a better solution is found. See #11.



Expand Down
9 changes: 9 additions & 0 deletions c2bluetooth.iml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_ble_lib_ios_15/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_ble_lib_ios_15/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_ble_lib_ios_15/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_ble_lib_ios_15/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_ble_lib_ios_15/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_ble_lib_ios_15/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
10 changes: 7 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
// Any value starting with "flutter." get its value from
// the Flutter Gradle plugin.
compileSdk flutter.compileSdkVersion

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -35,8 +37,10 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.fresh_example"
minSdkVersion 18
targetSdkVersion 30
// You can update the following value to match your application needs.
minSdk flutter.minSdkVersion
targetSdk flutter.targetSdkVersion
// You can set these values in the property declaration or use a variable
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
18 changes: 8 additions & 10 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.fresh_example">
<!-- https://developer.android.com/guide/topics/connectivity/bluetooth/permissions -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />

<application
android:label="fresh_example"
android:icon="@mipmap/ic_launcher">
Expand All @@ -9,7 +15,8 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:exported="true">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
Expand All @@ -18,15 +25,6 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
8 changes: 4 additions & 4 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.5.20'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>11.0</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
Loading