Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Options based configuration into CLI and Examples for BlueGiga #155

Closed
2 tasks done
tthiery opened this issue Mar 31, 2021 · 6 comments
Closed
2 tasks done

Add Options based configuration into CLI and Examples for BlueGiga #155

tthiery opened this issue Mar 31, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@tthiery
Copy link
Member

tthiery commented Mar 31, 2021

  • Create a construction-injectable Options object for BlueGiga
  • Refactor the CLI service provider builder process to better incorporate the command line (and maybe a json file ... so user can spare the arguments). Use Microsoft.Extensions.Configuration.CommandLine features maybe.

BlueGiga in focus because currently the only one needing configuration

See details in #154

@rickjansen-dev
Copy link
Contributor

An options object would be useful for BlueZ implementation too. Mainly to specify a specific bluetooth adapter (eg hci0) instead of simply using the first available one. Kind of optional since multiple available bluetooth adapters seems like a bit of a edge case.

Maybe best to open a separate issue to complete if this one is done?

@tthiery
Copy link
Member Author

tthiery commented Apr 1, 2021

Let us focus on finishing bluez first. We see which delivery beat which and then we adjust :)

@dkurok
Copy link
Contributor

dkurok commented Apr 4, 2021

I've tested today with BlueGiga on a RaspberryPi with the actual Master-branch - works like a charme!
The BleuGiga-adapter gets recognized on the Pi without any additional installation and is just a SerialPort:

./SharpBrick.PoweredUp.Examples --usebluegiga /dev/ttyACM0

..and it works. Also with two Hubs in parallel (ExampleTwoHubsMotorControl) 😄
Surley I had to remove the dependency on the SharpBrick.PoweredUp.WinRT from SharpBrick.PoweredUp.Examples because WinRT cannot build for linux-arm target. Also instead of net5.0-windows10.0.19041.0 just only use net5.0 in the TargetFramework
for Examples and BleuGigaBLE. And some small changes in BaseExample.cs(comment line 97 which is calling AddWinRTBluetooth() and Program.cs (just for making sure the options are given over to InitHostandDiscoveryasync(); line 82 instead of 80)
publish for Raspberry Pi:

cd GitHub\sharpbrick\powered-up\examples\SharpBrick.PoweredUp.Examples
dotnet publish -r linux-arm -o bin\\linux-arm\\publish --no-self-contained

Why do I mention it here?
Because we need to think about how to separte the different BLE-implementations into different independent Nuget-packages later, so it gets easy to build for differnt platforms. With Bluez-implementation in near future it will be an additional candidat which probably will not compile for windows-target.
So it should be in mind also here...

@tthiery
Copy link
Member Author

tthiery commented Apr 5, 2021

Oh that is nice. Create a PR updating the README

second: Yes, I agree. We need to decouple the dependency to the bluetooth stacks in the tools etc. There is a "plugin"-like concept called AssemblyLoadContext which can load assemblies at runtime. With a small generic helper, all the CLI, Examples, TestScript Runner can dynamically load an adapter. The only thing I am not sure is, does it work with the -windows target when called from a command line part. To be tested. In doubt, we can multi-target.

@dkurok
Copy link
Contributor

dkurok commented Apr 6, 2021

I've tested on a Raspberry Pi 4. I will do another test on a Raspi 3 and also on an Ubuntu 20.0 LTS (PC-based). As soon as I have finished these tests, I will update the README. Shall I go for an own file BlueGigaReadme.md for bringing all the information for BlueGiga centralized or put it into the big README? It's more a question of wanted style from your side.

@tthiery
Copy link
Member Author

tthiery commented Apr 6, 2021

That is indeed a good idea. Put it somewhere reasonable in the docs folder and link it from the main readme. That declutters the project start page.

tthiery pushed a commit that referenced this issue Apr 9, 2021
- Add separate BlueGiga documentation
- stripped down README a so that BlueGiga is just referenced

#155 non-breaking
tthiery added a commit that referenced this issue Apr 11, 2021
- Enable usage of Configuration JSON file / command line input
- Add Plugin Infrastructure for BLE adapters for CLIs
- Enable VS Code Debugger to run .NET 5 builds
- Add CliBase project to unify DI container creation for CLI projects
- Rewrote SharpBrick.PoweredUp.WinRT/BlueGigaBLE into plugins and
  dereference from Examples and CLI
- Add selection by command line of execute example

#155 non-breaking
tthiery added a commit that referenced this issue Apr 16, 2021
- Remove referenced dlls from published output
- Fixed loading of JSON

#155 non-breaking
tthiery added a commit that referenced this issue Apr 17, 2021
tthiery added a commit that referenced this issue Apr 22, 2021
- Fixed Examples, CLI, TestScript Projects
- Fixed the documentation

#155 breaking
@tthiery tthiery closed this as completed Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants