-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c93c384
commit d6ecada
Showing
2 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Michal Laskowski | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,71 @@ | ||
# FTMSTrainer | ||
|
||
A description of this package. | ||
## About the project | ||
|
||
An implementation of an FTMS protocol client. Could be useful for apps that would like to communicate with FTMSTrainers. | ||
Mine does and it works. Will post a link here once it is published. | ||
|
||
### Built with | ||
|
||
FTMSModels - no libraries, but honorable mentions to other sources on GitHub: | ||
|
||
* https://github.com/gamma/FTMS-Bluetooth/blob/master/Sources/FTMS%20Bluetooth/Utils/Fields.swift | ||
* https://github.com/oesmith/gatt-xml/blob/master/org.bluetooth.characteristic.indoor_bike_data.xml | ||
* https://github.com/gamma/FTMS-Bluetooth/blob/master/Sources/FTMS%20Bluetooth/FTMSUUIDs.swift | ||
|
||
FTMSTrainer - uses FTMSModels and: | ||
|
||
* [RxBluetoothKit](https://github.com/Polidea/RxBluetoothKit) | ||
* [RxSwift](https://github.com/ReactiveX/RxSwift) | ||
|
||
## Getting started | ||
|
||
To use the decoders in your project, add this Swift Package in your project. You can choose the model layer only `FTMSModels`, or classes to communicate with the trainer `FTMSTrainer`. | ||
|
||
## Usage | ||
|
||
Simple example for demonstration: | ||
|
||
``` | ||
import FTMSModels | ||
import FTMSTrainer | ||
let scanner = TrainerScanner() | ||
let trainer = scanner.scan() | ||
.filter { $0.count > 0 } | ||
.take(1) | ||
.flatMap { trainers -> FTMSConnectedTrainer in | ||
trainers[0].connect() | ||
} | ||
let disposeBag = DisposeBag() | ||
trainer.controlPointError | ||
.subscribe(onNext: { error in | ||
print("Control point error: %@", error) | ||
}).disposed(by: disposeBag) | ||
let command = TrainingCommand.resume // check Commands.swift for a list of commands | ||
trainer.send(command: command) | ||
.subscribe() | ||
.disposed(by: disposeBag) | ||
``` | ||
|
||
## Roadmap | ||
|
||
1. Need to add tests. The project was written quickly, trying with a real trainer what works and what doesn't when communicating with turbo trainer. | ||
2. Improving together with my own app, as needed. | ||
3. Awaiting potential requests/bug fixes. | ||
|
||
## Contributing | ||
|
||
1. Fork the Project | ||
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) | ||
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) | ||
4. Push to the Branch (`git push origin feature/AmazingFeature`) | ||
5. Open a Pull Request | ||
|
||
|
||
## License | ||
|
||
Distributed under the MIT License. See `LICENSE` for more information. |