Skip to content

Commit

Permalink
NotifyNetworkTopology message refactored to make use of new OCPP v2.1…
Browse files Browse the repository at this point in the history
… SEND message (without response). Added the possibility to broadcast SEND messages to all connected HTTP Web Socket clients/servers.
  • Loading branch information
ahzf committed Aug 23, 2024
1 parent 8bdac4e commit f416cee
Show file tree
Hide file tree
Showing 47 changed files with 3,342 additions and 2,191 deletions.
21 changes: 1 addition & 20 deletions WWCP_OCPPv2.1/Messages/Common/DataTransferRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public JSONLDContext Context
/// <param name="Data">Optional vendor-specific message data (a JSON token).</param>
///
/// <param name="Signatures">An optional enumeration of cryptographic signatures for this message.</param>
/// <param name="CustomData">The custom data object to allow to store any kind of customer specific data.</param>
///
/// <param name="RequestId">An optional request identification.</param>
/// <param name="RequestTimestamp">An optional request timestamp.</param>
Expand All @@ -102,8 +101,6 @@ public DataTransferRequest(SourceRouting Destination,
IEnumerable<SignInfo>? SignInfos = null,
IEnumerable<Signature>? Signatures = null,

CustomData? CustomData = null,

Request_Id? RequestId = null,
DateTime? RequestTimestamp = null,
TimeSpan? RequestTimeout = null,
Expand All @@ -119,7 +116,7 @@ public DataTransferRequest(SourceRouting Destination,
SignInfos,
Signatures,

CustomData,
null,

RequestId,
RequestTimestamp,
Expand Down Expand Up @@ -346,20 +343,6 @@ public static Boolean TryParse(JObject

#endregion

#region CustomData [optional]

if (JSON.ParseOptionalJSON("customData",
"custom data",
OCPPv2_1.CustomData.TryParse,
out CustomData? CustomData,
out ErrorResponse))
{
if (ErrorResponse is not null)
return false;
}

#endregion


DataTransferRequest = new DataTransferRequest(

Expand All @@ -372,8 +355,6 @@ public static Boolean TryParse(JObject
null,
Signatures,

CustomData,

RequestId,
RequestTimestamp,
RequestTimeout,
Expand Down
49 changes: 15 additions & 34 deletions WWCP_OCPPv2.1/Messages/Common/MessageTransferMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,27 @@ public JSONLDContext Context
/// <param name="Data">Optional vendor-specific message data (a JSON token).</param>
///
/// <param name="Signatures">An optional enumeration of cryptographic signatures for this message.</param>
/// <param name="CustomData">The custom data object to allow to store any kind of customer specific data.</param>
///
/// <param name="RequestId">An optional request identification.</param>
/// <param name="RequestTimestamp">An optional request timestamp.</param>
/// <param name="EventTrackingId">An event tracking identification for correlating this request with other events.</param>
/// <param name="NetworkPath">The network path of the request.</param>
/// <param name="CancellationToken">An optional token to cancel this request.</param>
public MessageTransferMessage(SourceRouting Destination,
Vendor_Id VendorId,
Message_Id? MessageId = null,
JToken? Data = null,
Vendor_Id VendorId,
Message_Id? MessageId = null,
JToken? Data = null,

IEnumerable<KeyPair>? SignKeys = null,
IEnumerable<SignInfo>? SignInfos = null,
IEnumerable<Signature>? Signatures = null,
IEnumerable<KeyPair>? SignKeys = null,
IEnumerable<SignInfo>? SignInfos = null,
IEnumerable<Signature>? Signatures = null,

CustomData? CustomData = null,

Request_Id? RequestId = null,
DateTime? RequestTimestamp = null,
EventTracking_Id? EventTrackingId = null,
NetworkPath? NetworkPath = null,
SerializationFormats? SerializationFormat = null,
CancellationToken CancellationToken = default)
Request_Id? RequestId = null,
DateTime? RequestTimestamp = null,
EventTracking_Id? EventTrackingId = null,
NetworkPath? NetworkPath = null,
SerializationFormats? SerializationFormat = null,
CancellationToken CancellationToken = default)

: base(Destination,
nameof(MessageTransferMessage)[..^7],
Expand All @@ -117,7 +114,7 @@ public MessageTransferMessage(SourceRouting Destination,
SignInfos,
Signatures,

CustomData,
null,

RequestId,
RequestTimestamp,
Expand Down Expand Up @@ -281,20 +278,6 @@ public static Boolean TryParse(JObject

#endregion

#region CustomData [optional]

if (JSON.ParseOptionalJSON("customData",
"custom data",
OCPPv2_1.CustomData.TryParse,
out CustomData? CustomData,
out ErrorResponse))
{
if (ErrorResponse is not null)
return false;
}

#endregion


MessageTransferMessage = new MessageTransferMessage(

Expand All @@ -307,8 +290,6 @@ public static Boolean TryParse(JObject
null,
Signatures,

CustomData,

MessageId,
MessageTimestamp,
EventTrackingId,
Expand All @@ -318,15 +299,15 @@ public static Boolean TryParse(JObject

if (CustomMessageTransferMessageParser is not null)
MessageTransferMessage = CustomMessageTransferMessageParser(JSON,
MessageTransferMessage);
MessageTransferMessage);

return true;

}
catch (Exception e)
{
MessageTransferMessage = null;
ErrorResponse = "The given JSON representation of a Datagram request is invalid: " + e.Message;
ErrorResponse = "The given JSON representation of a Datagram request is invalid: " + e.Message;
return false;
}

Expand Down
Loading

0 comments on commit f416cee

Please sign in to comment.