Skip to content

Commit

Permalink
QRCodeXXX -> WebPaymentXXX. Some refactorings and improved tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahzf committed Jan 20, 2025
1 parent 4c7e636 commit 993de5f
Show file tree
Hide file tree
Showing 37 changed files with 3,640 additions and 2,248 deletions.
2 changes: 1 addition & 1 deletion WWCP_OCPP_Common/WebSockets/OCPPWebSocketServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public OCPPWebSocketServer(NetworkingNode.INetworkingNode
Boolean AutoStart = true)

: base(NetworkingNode,
HTTPServiceName,
HTTPServiceName ?? DefaultHTTPServiceName,
IPAddress,
TCPPort,
Description,
Expand Down
78 changes: 40 additions & 38 deletions WWCP_OCPPv2.1/DataStructures/Ids/EVSE_Id.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static Boolean IsNotNullOrEmpty(this EVSE_Id? EVSEId)
/// <summary>
/// The nummeric value of the EVSE identification.
/// </summary>
public readonly Byte Value;
public readonly UInt16 Value;

#endregion

Expand Down Expand Up @@ -93,15 +93,15 @@ public readonly UInt64 Length
/// Create a new EVSE identification based on the given number.
/// </summary>
/// <param name="Number">A numeric representation of a display message identification.</param>
private EVSE_Id(Byte Number)
private EVSE_Id(UInt16 Number)
{
this.Value = Number;
}

#endregion


#region (static) Parse (Text)
#region (static) Parse (Text)

/// <summary>
/// Parse the given string as an EVSE identification.
Expand All @@ -120,19 +120,7 @@ public static EVSE_Id Parse(String Text)

#endregion

#region (static) Parse (Number)

/// <summary>
/// Parse the given number as an EVSE identification.
/// </summary>
/// <param name="Number">A numeric representation of an EVSE identification.</param>
public static EVSE_Id Parse(Byte Number)

=> new (Number);

#endregion

#region (static) TryParse(Text)
#region (static) TryParse (Text)

/// <summary>
/// Try to parse the given text as an EVSE identification.
Expand All @@ -150,25 +138,7 @@ public static EVSE_Id Parse(Byte Number)

#endregion

#region (static) TryParse(Number)

/// <summary>
/// Try to parse the given number as an EVSE identification.
/// </summary>
/// <param name="Number">A numeric representation of an EVSE identification.</param>
public static EVSE_Id? TryParse(Byte Number)
{

if (TryParse(Number, out var evseId))
return evseId;

return null;

}

#endregion

#region (static) TryParse(Text, out EVSEId)
#region (static) TryParse (Text, out EVSEId)

/// <summary>
/// Try to parse the given text as an EVSE identification.
Expand All @@ -181,7 +151,7 @@ public static Boolean TryParse(String Text, out EVSE_Id EVSEId)
Text = Text.Trim();

if (Text.IsNotNullOrEmpty() &&
Byte.TryParse(Text, out var number))
UInt16.TryParse(Text, out var number))
{
EVSEId = new EVSE_Id(number);
return true;
Expand All @@ -194,14 +164,45 @@ public static Boolean TryParse(String Text, out EVSE_Id EVSEId)

#endregion

#region (static) TryParse(Number, out EVSEId)

#region (static) Parse (Number)

/// <summary>
/// Parse the given number as an EVSE identification.
/// </summary>
/// <param name="Number">A numeric representation of an EVSE identification.</param>
public static EVSE_Id Parse(UInt16 Number)

=> new (Number);

#endregion

#region (static) TryParse (Number)

/// <summary>
/// Try to parse the given number as an EVSE identification.
/// </summary>
/// <param name="Number">A numeric representation of an EVSE identification.</param>
public static EVSE_Id? TryParse(UInt16 Number)
{

if (TryParse(Number, out var evseId))
return evseId;

return null;

}

#endregion

#region (static) TryParse (Number, out EVSEId)

/// <summary>
/// Try to parse the given number as an EVSE identification.
/// </summary>
/// <param name="Number">A numeric representation of an EVSE identification.</param>
/// <param name="EVSEId">The parsed EVSE identification.</param>
public static Boolean TryParse(Byte Number, out EVSE_Id EVSEId)
public static Boolean TryParse(UInt16 Number, out EVSE_Id EVSEId)
{

EVSEId = new EVSE_Id(Number);
Expand All @@ -212,6 +213,7 @@ public static Boolean TryParse(Byte Number, out EVSE_Id EVSEId)

#endregion


#region Clone

/// <summary>
Expand Down
Loading

0 comments on commit 993de5f

Please sign in to comment.