You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-1
Original file line number
Diff line number
Diff line change
@@ -37,8 +37,46 @@ For the most bleeding-edge experience - or if you plan to make and test changes
37
37
c2bluetooth:
38
38
path: ../c2bluetooth
39
39
```
40
+
40
41
## Usage
41
-
TBD
42
+
Similar to how the underlying bluetooth library works, pretty much everything begins with an instance of `ErgBleManager()`. For a complete example, see the [example app](example/)
43
+
44
+
### Creating a manager
45
+
46
+
```dart
47
+
ErgBleManager bleManager = ErgBleManager();
48
+
bleManager.init(); //ready to go!
49
+
```
50
+
### Scanning for devices
51
+
Next, you need to start scanning for available devices. This uses a Stream that returns instances of the `Ergometer` class that represent
52
+
```dart
53
+
bleManager.startErgScan().listen((erg) {
54
+
//your code for detecting an erg here
55
+
// maybe show it to the user and let them pick which one to connect to?
56
+
});
57
+
```
58
+
59
+
### Connecting to an erg
60
+
Once you have the `Ergometer` instance for the erg you want to connect to, you can call `connectAndDiscover()` on it to connect.
61
+
62
+
```dart
63
+
await myErg.connectAndDiscover();
64
+
```
65
+
66
+
### Getting workout summaries
67
+
To get data from the erg, use one of the methods available in the `Ergometer` class. Currently this is only `monitorForWorkoutSummary()`. This is a stream that returns a `WorkoutSummary` object that allows you to access the data from a completed programmed workout (i.e. not "Just Row").
0 commit comments