Skip to content

Commit 389bd01

Browse files
committed
Applied common naming, inheritance and TPL usage
1 parent 5654b22 commit 389bd01

File tree

11 files changed

+97
-95
lines changed

11 files changed

+97
-95
lines changed

src/Moryx.AbstractionLayer/Drivers/Axis/AxisMovement.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
22
// Licensed under the Apache License, Version 2.0
33

4-
using Moryx.AbstractionLayer.Hardware;
5-
64
namespace Moryx.AbstractionLayer.Drivers.Axis;
75

86
/// <summary>
@@ -23,7 +21,7 @@ public class AxisMovement
2321
/// <summary>
2422
/// Predefined position of the axis to move to
2523
/// </summary>
26-
public AxisPosition? PredefinedPosition { get; set; }
24+
public AxisPosition? PredefinedPosition { get; }
2725

2826
/// <summary>
2927
/// Creates a new instance of <see cref="AxisMovement"/> with a target position

src/Moryx.AbstractionLayer/Drivers/Axis/IAxesController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public interface IAxesController : IDriver
1212
/// Will move the axes of the system to the given position
1313
/// </summary>
1414
/// <param name="movement">Array of axes which should be moved</param>
15-
Task<AxisMovementResponse> MoveAxes(params AxisMovement[] movement);
15+
Task<AxisMovementResponse> MoveAxesAsync(params AxisMovement[] movement);
1616
}
1717
}

src/Moryx.AbstractionLayer/Drivers/Axis/NumberedAxis.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public struct NumberedAxis : IEquatable<NumberedAxis>
1212
/// Axis
1313
/// </summary>
1414
public Axes Axis { get; }
15+
1516
/// <summary>
1617
/// Number
1718
/// </summary>

src/Moryx.AbstractionLayer/Drivers/Camera/ICameraDriver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface ICameraDriver<TImage> : IDriver where TImage : class
2020
/// The image that was captured or null in case no image
2121
/// could be retrieved
2222
/// </returns>
23-
Task<TImage> CaptureImage();
23+
Task<TImage> CaptureImageAsync();
2424
}
2525
}
2626

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
22
// Licensed under the Apache License, Version 2.0
33

4-
namespace Moryx.AbstractionLayer.Drivers.Rfid
4+
using Moryx.AbstractionLayer.Drivers.InOut;
5+
6+
namespace Moryx.AbstractionLayer.Drivers.Rfid;
7+
8+
/// <summary>
9+
/// Driver API of the RFID driver
10+
/// </summary>
11+
public interface IRfidDriver : IInputDriver<RfidTag>
512
{
6-
/// <summary>
7-
/// Driver API of the RFID driver
8-
/// </summary>
9-
public interface IRfidDriver : IDriver
10-
{
11-
/// <summary>
12-
/// Event raised when tags are read by the antenna
13-
/// </summary>
14-
event EventHandler<RfidTag[]> TagsRead;
15-
}
13+
1614
}
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
22
// Licensed under the Apache License, Version 2.0
33

4+
using Moryx.AbstractionLayer.Drivers.InOut;
5+
46
namespace Moryx.AbstractionLayer.Drivers.Scales
57
{
68
/// <summary>
79
/// Interface for weight scales to request a weight
810
/// </summary>
9-
public interface IWeightScaleDriver : IDriver
11+
public interface IWeightScaleDriver : IInputDriver<MeasuredWeight>
1012
{
11-
/// <summary>
12-
/// Requests the weight from the scale.
13-
/// </summary>
14-
Task<WeightResult> GetCurrentWeight();
1513

16-
/// <summary>
17-
/// Occurs when the weight scale weight was read.
18-
/// </summary>
19-
event EventHandler<WeightResult> WeightRead;
2014
}
2115
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
2+
// Licensed under the Apache License, Version 2.0
3+
4+
using System.Diagnostics;
5+
6+
namespace Moryx.AbstractionLayer.Drivers.Scales;
7+
8+
/// <summary>
9+
/// Result weight scales
10+
/// </summary>
11+
[DebuggerDisplay("Weight = {Weight}, Unit = {Unit}")]
12+
public class MeasuredWeight
13+
{
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="MeasuredWeight"/> class.
16+
/// </summary>
17+
public MeasuredWeight(double weight, string unit)
18+
{
19+
Weight = weight;
20+
Unit = unit;
21+
}
22+
23+
/// <summary>
24+
/// The read weight
25+
/// </summary>
26+
public double Weight { get; }
27+
28+
/// <summary>
29+
/// Gets or sets the unit.
30+
/// </summary>
31+
public string Unit { get; }
32+
}

src/Moryx.AbstractionLayer/Drivers/Scales/WeightResult.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
22
// Licensed under the Apache License, Version 2.0
33

4-
namespace Moryx.AbstractionLayer.Drivers.Scanner
4+
#nullable enable
5+
6+
using Moryx.AbstractionLayer.Drivers.InOut;
7+
8+
namespace Moryx.AbstractionLayer.Drivers.Scanner;
9+
10+
/// <summary>
11+
/// Common interface for barcode / QR-Code scanners
12+
/// </summary>
13+
public interface IScannerDriver : IInputDriver<ScannerResult>
514
{
6-
/// <summary>
7-
/// Common interface for barcode / QR-Code scanners
8-
/// </summary>
9-
public interface IScannerDriver : IDriver
10-
{
11-
/// <summary>
12-
/// Event raised when a code was read
13-
/// </summary>
14-
event EventHandler<string> CodeRead;
15-
}
1615
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
2+
// Licensed under the Apache License, Version 2.0
3+
4+
#nullable enable
5+
using System.Diagnostics;
6+
7+
namespace Moryx.AbstractionLayer.Drivers.Scanner;
8+
9+
/// <summary>
10+
/// Result of the <see cref="IScannerDriver"/>
11+
/// </summary>
12+
[DebuggerDisplay("Code = {Code}")]
13+
public class ScannerResult
14+
{
15+
/// <summary>
16+
/// A read code from a barcode / qr-code scanner
17+
/// </summary>
18+
public string? Code { get; set; }
19+
20+
/// <summary>
21+
/// Optional binary data of the scanned content
22+
/// </summary>
23+
public byte? BinaryData { get; set; }
24+
}

0 commit comments

Comments
 (0)