Skip to content

Commit

Permalink
BlueGiga Cleanup (#158)
Browse files Browse the repository at this point in the history
- Minor Updates to reduce changed lines & README.
- Cleanup README and whitespace changes

#77
  • Loading branch information
tthiery authored Mar 31, 2021
1 parent c16fa29 commit 13be270
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SharpBrick.PoweredUp is a .NET implementation of the Bluetooth Low Energy Protoc
- **Virtual Port Creation**: Combine multiple devices of the same type into a virtual combined port. This allows synchronous access to multiple devices using the same message (e.g. using two motors for driving).
- **Deployment Model Verification**: The SDK includes a model builder and a verification method to ensure that the wired devies are correctly reflecting the expectations in the program.
- **Tools**: The `poweredup` CLI includes a device list feature, enumerating the metadata properties of the LEGO Wireless Protocol.
- **BlueGiga Bluetooth-Adapter Support**: With the SharpBrick.PoweredUp.BlueGigaBLE-package you can use a Silicon's Lab BlueGiga-adapter (for example BLED112) to talk to your Lego-Hubs. By default the WinRT-implementation for build-in bluetooth-adapters is used.
- **Support for multiple Bluetooth Stacks**: Use any of Microsoft WinRT, BlueGiga Bluetooth (Silicon's Lab BlueGiga-adapter (for example BLED112) and Xamarin using BLE.Plugin to talk to your Lego hubs.

# Examples

Expand Down Expand Up @@ -237,12 +237,12 @@ The `poweredup` command line utility intends to allow the inspection of LEGO Wir
````
- **Pretty Print Binary Dumps**: Help to convert a binary dump in a nice representation.

***Note**: Currently per default on Windows the WinRT Bluetooth drivers are used. Work is on the way to support bluez to run the utility also on Linux. If you've got a BlueGiga-Bluetooth-adapter, you can use the following additional options (not yet tested under Linux, but Windows).*
````
- **Use of other Bluetooth LE stack (default is WinRT on Windows)
````
poweredup device list --usebluegiga COM4 --tracebluegiga
````
Use the COM-port of your Windows-instance where the BlueGiga-adapter is attached to; so replace ````COM4```` with COMx whatever x is used on your system.
````--tracebluegiga```` emmits a lot of additional trace-information of the BleuGiga-implementation.
````
Use the COM-port of your Windows-instance where the BlueGiga-adapter is attached to; so replace `COM4` with COMx whatever x is used on your system. `--tracebluegiga` emits a lot of additional trace-information of the BleuGiga-implementation.

## Installation Instruction

1. Install the [latest .NET](https://dotnet.microsoft.com/download) on your machine (e.g. .NET 5).
Expand All @@ -255,7 +255,6 @@ Use the COM-port of your Windows-instance where the BlueGiga-adapter is attached
poweredup device list
````


# SDK Status, Hardware Support, Contributions, ..

Basic Architecture within the SDK
Expand Down Expand Up @@ -297,8 +296,8 @@ DI Container Elements

- Bluetooth Adapter
- [X] .NET Core 3.1 (on Windows 10 using WinRT Bluetooth). Please use version v3.4.0 and consider upgrading to .NET 5
- [X] .NET 5 (on Windows 10 using WinRT Bluetooth)(⚠ v4.0 or later)
- [X] .NET 5 (on Windows 10 using BlueGiga-adapter)(⚠ v4.0 or later)
- [X] .NET 5 (on Windows 10 using WinRT Bluetooth) (⚠ v4.0 or later)
- [X] .NET 5 (on Windows 10 using BlueGiga-adapter) (⚠ v4.0 or later)
- [ ] UWP (most likely December 2021; UWP currently does not support .NET Standard 2.1 and C# 8.0+)
- [ ] .NET Framework 4.8 (will never be supported; .NET Framework does not and will never support .NET Standard 2.1 and C# 8.0+)
- [X] Xamarin 5 (on Android using BLE.Plugin) (⚠ v4.0 or later)
Expand Down
8 changes: 4 additions & 4 deletions examples/SharpBrick.PoweredUp.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static async Task Main(string[] args)
bool enableTraceBlueGiga = false;
if (args.Any(x => x.Equals("--usebluegiga", StringComparison.OrdinalIgnoreCase)))
{
for(int i=0; i<args.Length; i++)
for (int i = 0; i < args.Length; i++)
{
if (args[i].Equals("--usebluegiga", StringComparison.OrdinalIgnoreCase))
{
Expand All @@ -34,7 +34,7 @@ static async Task Main(string[] args)
// NOTE: Examples are in their own root namespace to make namespace usage clear
Example.BaseExample example;

example = new Example.ExampleColors();
//example = new Example.ExampleColors();
//example = new Example.ExampleMotorControl();
//example = new Example.ExampleMotorInputAbsolutePosition();
//example = new Example.ExampleMotorVirtualPort();
Expand Down Expand Up @@ -77,9 +77,9 @@ static async Task Main(string[] args)

// NOTE: Examples are programmed object oriented style. Base class implements methods Configure, DiscoverAsync and ExecuteAsync to be overwriten on demand.
// this uses the WinRT-bluetooth-implementation by default
//await example.InitHostAndDiscoverAsync(enableTrace);
await example.InitHostAndDiscoverAsync(enableTrace);
//for using BlueGiga-Bluetoothadapter:
await example.InitHostAndDiscoverAsync(enableTrace, bluetoothStackPort, enableTraceBlueGiga);
//await example.InitHostAndDiscoverAsync(enableTrace, bluetoothStackPort, enableTraceBlueGiga);

if (example.SelectedHub is not null)
{
Expand Down
2 changes: 0 additions & 2 deletions src/SharpBrick.PoweredUp/Functions/DiscoverPorts.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using SharpBrick.PoweredUp.Protocol;
Expand Down Expand Up @@ -61,7 +60,6 @@ private async Task RequestPortProperties(PortInfo port)

private async Task RequestPortModePropertiesAsync(PortInfo port)
{

var knowledge = _protocol.Knowledge;

foreach (var modeIndex in port.Modes.Values.Select(m => m.ModeIndex))
Expand Down
1 change: 0 additions & 1 deletion src/SharpBrick.PoweredUp/Hubs/Hub_Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ private IObservable<T> BuildObservableForProperty<T>(IObservable<LegoWirelessMes
.Cast<HubPropertyMessage<T>>()
.Select(msg => msg.Payload);


private async Task InitialHubPropertiesQueryAsync()
{
foreach (var property in _knownProperties)
Expand Down

0 comments on commit 13be270

Please sign in to comment.