Skip to content

Commit 1f6198a

Browse files
authored
Rename PoweredUpProtocol (#85)
#61 (breaking)
1 parent 83b0b4c commit 1f6198a

84 files changed

Lines changed: 179 additions & 179 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ using (var scope = serviceProvider.CreateScope()) // create a scoped DI containe
171171
// init BT layer with right bluetooth address
172172
scope.ServiceProvider.GetService<BluetoothKernel>().BluetoothAddress = bluetoothAddress;
173173

174-
var protocol = scope.GetService<IPoweredUpProtocol>();
174+
var protocol = scope.GetService<ILegoWirelessProtocol>();
175175

176176
await protocol.ConnectAsync(); // also connects underlying BT connection
177177
@@ -209,11 +209,11 @@ Basic Architecture within the SDK
209209
+---------+
210210
| |
211211
| Devices | <-+
212-
| | | +-------------------+ +-------------+ +-----+
213-
+---------+ +-> | | | | | |
214-
| PoweredUpProtocol | <-> | BLE Adapter | <-> | BLE |
215-
+---------+ +-> | (w/ Knowlege) | | | | |
216-
| | | +-------------------+ +-------------+ +-----+
212+
| | | +-----------------------+ +-------------+ +-----+
213+
+---------+ +-> | | | | | |
214+
| ILegoWirelessProtocol | <-> | BLE Adapter | <-> | BLE |
215+
+---------+ +-> | (w/ Knowlege) | | | | |
216+
| | | +-----------------------+ +-------------+ +-----+
217217
| Hub | <-+
218218
| |
219219
+---------+
@@ -223,20 +223,20 @@ Basic Architecture within the SDK
223223
DI Container Elements
224224

225225
````
226-
PoweredUpHost +----+
227-
+ |
228-
| |
229-
+-------------------- Scoped Service Provider ---------------------+
230-
| | | |
231-
| v +--->IPoweredUp
232-
| LinearMidCalibration + HubFactory | | BluetoothAdapter
233-
| | | |
234-
| TechnicMediumHub +---+-> PoweredUpProtocol +-> BluetoothKernel + |
235-
| + + |
236-
| | | |
237-
| +-----------------------+--------> DeviceFactory |
238-
| |
239-
+------------------------------------------------------------------+
226+
PoweredUpHost +-------+
227+
+ |
228+
| |
229+
+-------------------- Scoped Service Provider ------------------------+
230+
| | | |
231+
| v +--->IPoweredUp
232+
| LinearMidCalibration + HubFactory | | BluetoothAdapter
233+
| | | |
234+
| TechnicMediumHub +---+-> LegoWirelessProtocol +-> BluetoothKernel + |
235+
| + + |
236+
| | | |
237+
| +-----------------------+--------> DeviceFactory |
238+
| |
239+
+---------------------------------------------------------------------+
240240
````
241241

242242
## Implementation Status

docs/arch/breaking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Supported Namespaces
88

9-
- `SharpBrick.PoweredUp` (all devices, all hubs, PoweredUpHost, IPoweredUpProtocol)
9+
- `SharpBrick.PoweredUp` (all devices, all hubs, PoweredUpHost, ILegoWirelessProtocol)
1010
- `SharpBrick.PoweredUp.Deployment` (builder and model verifer)
1111

1212
# Internal Namespaces

docs/development/adding-new-device.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
1. Create new device in namespace `SharpBrick.PoweredUp` and folder `src/SharpBrick.PoweredUp/Devices`
44
2. Derive from `Device`
5-
3. Create empty constructor (for non-interactive purposes) and `ctr(IPoweredUpProtocol protocol, byte hubId, byte portId)` (for interactive connected purposes)
5+
3. Create empty constructor (for non-interactive purposes) and `ctr(ILegoWirelessProtocol protocol, byte hubId, byte portId)` (for interactive connected purposes)
66
4. Dervice from interface `IPoweredUpDevice`
77
5. Execute `poweredup device dump-static-port -p <port number>` to retrieve static port information.
88
6. Add dump to method `IPoweredUpDevice.GetStaticPortInfoMessages` (this method improves startup performance since protocol knowledge can be initialized without lenthly querying the actual devices)

examples/SharpBrick.PoweredUp.Examples/ExampleDynamicDevice.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class EmptyDeviceFactory : IDeviceFactory
1515
public IPoweredUpDevice Create(DeviceType deviceType)
1616
=> null;
1717

18-
public IPoweredUpDevice CreateConnected(DeviceType deviceType, IPoweredUpProtocol protocol, byte hubId, byte portId)
18+
public IPoweredUpDevice CreateConnected(DeviceType deviceType, ILegoWirelessProtocol protocol, byte hubId, byte portId)
1919
=> new DynamicDevice(protocol, hubId, portId);
2020
}
2121
public class ExampleDynamicDevice : BaseExample

src/SharpBrick.PoweredUp.Cli/Commands/DevicesList.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ namespace SharpBrick.PoweredUp.Cli
1212
{
1313
public class DevicesList
1414
{
15-
private readonly IPoweredUpProtocol protocol;
15+
private readonly ILegoWirelessProtocol protocol;
1616
private readonly DiscoverPorts discoverPorts;
1717

18-
public DevicesList(IPoweredUpProtocol protocol, DiscoverPorts discoverPorts)
18+
public DevicesList(ILegoWirelessProtocol protocol, DiscoverPorts discoverPorts)
1919
{
2020
this.protocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
2121
this.discoverPorts = discoverPorts ?? throw new ArgumentNullException(nameof(discoverPorts));

src/SharpBrick.PoweredUp.Cli/Commands/DumpStaticPortInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace SharpBrick.PoweredUp.Cli
1010
{
1111
public class DumpStaticPortInfo
1212
{
13-
private readonly IPoweredUpProtocol protocol;
13+
private readonly ILegoWirelessProtocol protocol;
1414
private readonly DiscoverPorts discoverPorts;
1515

16-
public DumpStaticPortInfo(IPoweredUpProtocol protocol, DiscoverPorts discoverPorts)
16+
public DumpStaticPortInfo(ILegoWirelessProtocol protocol, DiscoverPorts discoverPorts)
1717
{
1818
this.protocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
1919
this.discoverPorts = discoverPorts ?? throw new ArgumentNullException(nameof(discoverPorts));

src/SharpBrick.PoweredUp/Deployment/DeploymentModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public DeploymentModel(DeploymentHubModel[] hubs)
2828
/// </summary>
2929
/// <param name="protocols"></param>
3030
/// <returns></returns>
31-
public DeploymentModelError[] Verify(params IPoweredUpProtocol[] protocols)
31+
public DeploymentModelError[] Verify(params ILegoWirelessProtocol[] protocols)
3232
{
3333
//TODO: match best hub with best protocol
3434

@@ -42,7 +42,7 @@ public DeploymentModelError[] Verify(params IPoweredUpProtocol[] protocols)
4242
/// <param name="hubId"></param>
4343
/// <param name="hubModel"></param>
4444
/// <returns></returns>
45-
public DeploymentModelError[] Verify(IPoweredUpProtocol protocol, byte hubId, DeploymentHubModel hubModel)
45+
public DeploymentModelError[] Verify(ILegoWirelessProtocol protocol, byte hubId, DeploymentHubModel hubModel)
4646
{
4747
if (protocol is null)
4848
{

src/SharpBrick.PoweredUp/Devices/AbsoluteMotor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public abstract class AbsoluteMotor : TachoMotor
1818
public AbsoluteMotor()
1919
{ }
2020

21-
protected AbsoluteMotor(IPoweredUpProtocol protocol, byte hubId, byte portId)
21+
protected AbsoluteMotor(ILegoWirelessProtocol protocol, byte hubId, byte portId)
2222
: base(protocol, hubId, portId)
2323
{
2424
_absoluteMode = SingleValueMode<short>(ModeIndexAbsolutePosition);

src/SharpBrick.PoweredUp/Devices/BasicMotor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public abstract class BasicMotor : Device
1717
public BasicMotor()
1818
{ }
1919

20-
public BasicMotor(IPoweredUpProtocol protocol, byte hubId, byte portId)
20+
public BasicMotor(ILegoWirelessProtocol protocol, byte hubId, byte portId)
2121
: base(protocol, hubId, portId)
2222
{
2323
_powerMode = SingleValueMode<sbyte>(ModeIndexPower);

src/SharpBrick.PoweredUp/Devices/Current.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class Current : Device, IPoweredUpDevice
2424
public Current()
2525
{ }
2626

27-
public Current(IPoweredUpProtocol protocol, byte hubId, byte portId)
27+
public Current(ILegoWirelessProtocol protocol, byte hubId, byte portId)
2828
: base(protocol, hubId, portId)
2929
{
3030
_currentLMode = SingleValueMode<short>(ModeIndexCurrentL);

0 commit comments

Comments
 (0)