From d6ecada3959bea2605fc9063c9588b0510ae764a Mon Sep 17 00:00:00 2001 From: Michal Laskowski Date: Mon, 1 Mar 2021 20:26:39 +0100 Subject: [PATCH] Update README and add LICENSE --- LICENSE | 21 +++++++++++++++++ README.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..dd289b3 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md index 66745b8..2e3aca2 100644 --- a/README.md +++ b/README.md @@ -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.