Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Jegge authored Sep 3, 2023
1 parent 80b4eb0 commit 720b1fb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ As the OldMoofKit is using the [`CoreBluetooth`](https://developer.apple.com/doc

### From VanMoof web api

To initially get a bike, connect to the VanMoof web api and retrieve the first bike
To initially get a bike, connect to the VanMoof web api and retrieve the first bike.

```swift
let bike = try await Bike(username: "Johnny Mnemonic", password: "swordfish")
Expand Down Expand Up @@ -109,7 +109,7 @@ To retrieve the current connection state, query the bike's `state`:
let state = bike.state
```

You may also subscribe ot the `statePublisher' and be informed when the current state changes.
You may also subscribe ot the `statePublisher` and be informed when the current state changes.

```swift
let subscription: AnyCancellable = bike.statePublisher.receive(on: RunLoop.main).sink { state in
Expand Down Expand Up @@ -147,16 +147,20 @@ The bike has all kind of properties that represent the current known state of th
- `lock` (locked, unlocked)
- `alarm` (on, off, automatic)
- `lighting` (always on, automatic, off)
- `battery level` and `battery state` (charging, discharging and percent charged)
- `module state` (sleeping, off, on)
- `error code` (raw data, depending on the bike model)
- `motor assistance` (off, one, two, three, four)
- `muted sounds` (wake up sound, shutdown sound, lock sound, unlock sound)
- `batteryLevel` and `batteryState` (percent charged and charging or discharching)
- `moduleState` (sleeping, off, on)
- `errorCode` (raw data, depending on the bike model)
- `motorAssistance` (off, one, two, three, four)
- `mutedSounds` (wake up sound, shutdown sound, lock sound, unlock sound)
- `speed` (current speed in km/h)
- `distance` (distance in km)
- `region` (eu, us, japan, offroad)
- `unit` (metric, imperial)
```swift
let lighting = bike.lighting
```
> **Note**: if your bike does not support a properity, it's value will be `nil`.
For each property there is an associated `Publisher` that allows monitoring changes of value.
Expand All @@ -178,6 +182,8 @@ Each property is complemented by a setter:
try await bike.set(lighting: .alwaysOn)
```
> **Note**: setting the region of your e-bike to a value not corresponding to your country may be illegal in some jurisdictions. Use at your own risk.
## Other functions
### Play sounds
Expand Down

0 comments on commit 720b1fb

Please sign in to comment.