Skip to content

Commit

Permalink
Add new OCPP v2.1 SEND message support. New TestChargingStation partl…
Browse files Browse the repository at this point in the history
…y wired
  • Loading branch information
ahzf committed Jul 18, 2024
1 parent ac74dde commit 679060b
Show file tree
Hide file tree
Showing 22 changed files with 9,494 additions and 151 deletions.
84 changes: 84 additions & 0 deletions WWCP_OCPPv2.1/Messages/IMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2014-2024 GraphDefined GmbH <[email protected]>
* This file is part of WWCP OCPP <https://github.com/OpenChargingCloud/WWCP_OCPP>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#region Usings

using org.GraphDefined.Vanaheimr.Illias;

using cloud.charging.open.protocols.OCPPv2_1.NetworkingNode;

#endregion

namespace cloud.charging.open.protocols.OCPPv2_1
{

/// <summary>
/// The common interface of all "send" messages.
/// </summary>
public interface IMessage : ISignableMessage
{

/// <summary>
/// The networking node identification of the message sender or destination.
/// </summary>
[Mandatory]
NetworkingNode_Id DestinationId { get; }

/// <summary>
/// The network path of the request.
/// </summary>
[Mandatory]
NetworkPath NetworkPath { get; }

/// <summary>
/// The message identification.
/// </summary>
[Mandatory]
Request_Id MessageId { get; }

/// <summary>
/// The timestamp of the message creation.
/// </summary>
[Mandatory]
DateTime SentTimestamp { get; }

/// <summary>
/// The event tracking identification for correlating this message with other events.
/// </summary>
[Mandatory]
EventTracking_Id EventTrackingId { get; }

/// <summary>
/// The OCPP HTTP Web Socket action.
/// </summary>
[Mandatory]
String Action { get; }

/// <summary>
/// The custom data object to allow to store any kind of customer specific data.
/// </summary>
[Optional]
CustomData? CustomData { get; }

/// <summary>
/// An optional token to cancel this message.
/// </summary>
CancellationToken CancellationToken { get; }

}

}
4 changes: 2 additions & 2 deletions WWCP_OCPPv2.1/Messages/IRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface IRequest : ISignableMessage
/// The networking node identification of the message sender or destination.
/// </summary>
[Mandatory]
NetworkingNode_Id DestinationId { get; }
NetworkingNode_Id DestinationId { get; }

/// <summary>
/// The network path of the request.
Expand All @@ -63,7 +63,7 @@ public interface IRequest : ISignableMessage
TimeSpan RequestTimeout { get; }

/// <summary>
/// An event tracking identification for correlating this request with other events.
/// The event tracking identification for correlating this request with other events.
/// </summary>
[Mandatory]
EventTracking_Id EventTrackingId { get; }
Expand Down
2 changes: 2 additions & 0 deletions WWCP_OCPPv2.1/NetworkingNode/IOCPPAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,12 @@ public interface IOCPPAdapter
Task<SendMessageResult> SendJSONResponse (OCPP_JSONResponseMessage JSONResponseMessage);
Task<SendMessageResult> SendJSONRequestError (OCPP_JSONRequestErrorMessage JSONRequestErrorMessage);
Task<SendMessageResult> SendJSONResponseError (OCPP_JSONResponseErrorMessage JSONResponseErrorMessage);
Task<SendMessageResult> SendJSONSendMessage (OCPP_JSONSendMessage JSONSendMessage);

Task<SendMessageResult> SendBinaryRequest (OCPP_BinaryRequestMessage BinaryRequestMessage);
Task<SendRequestState> SendBinaryRequestAndWait (OCPP_BinaryRequestMessage BinaryRequestMessage, Action<SendMessageResult>? SendMessageResultDelegate = null);
Task<SendMessageResult> SendBinaryResponse (OCPP_BinaryResponseMessage BinaryResponseMessage);
Task<SendMessageResult> SendBinarySendMessage (OCPP_BinarySendMessage BinarySendMessage);


Boolean ReceiveJSONResponse (OCPP_JSONResponseMessage JSONResponseMessage);
Expand Down
8 changes: 5 additions & 3 deletions WWCP_OCPPv2.1/NetworkingNode/IOCPPWebSocketAdapterFORWARD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public interface IOCPPWebSocketAdapterFORWARD

#region Properties

ForwardingResults DefaultForwardingResult { get; set; }
ForwardingResults DefaultForwardingResult { get; set; }

HashSet<NetworkingNode_Id> AnycastIdsAllowed { get; }
HashSet<NetworkingNode_Id> AnycastIdsAllowed { get; }

HashSet<NetworkingNode_Id> AnycastIdsDenied { get; }
HashSet<NetworkingNode_Id> AnycastIdsDenied { get; }

#endregion

Expand Down Expand Up @@ -513,10 +513,12 @@ public interface IOCPPWebSocketAdapterFORWARD
Task ProcessJSONResponseMessage (OCPP_JSONResponseMessage JSONResponseMessage, IWebSocketConnection WebSocketConnection);
Task ProcessJSONRequestErrorMessage (OCPP_JSONRequestErrorMessage JSONRequestErrorMessage, IWebSocketConnection WebSocketConnection);
Task ProcessJSONResponseErrorMessage (OCPP_JSONResponseErrorMessage JSONResponseErrorMessage, IWebSocketConnection WebSocketConnection);
Task ProcessJSONSendMessage (OCPP_JSONSendMessage JSONSendMessage, IWebSocketConnection WebSocketConnection);


Task ProcessBinaryRequestMessage (OCPP_BinaryRequestMessage BinaryRequestMessage, IWebSocketConnection WebSocketConnection);
Task ProcessBinaryResponseMessage (OCPP_BinaryResponseMessage BinaryResponseMessage, IWebSocketConnection WebSocketConnection);
Task ProcessBinarySendMessage (OCPP_BinarySendMessage BinarySendMessage, IWebSocketConnection WebSocketConnection);


#region Common
Expand Down
8 changes: 8 additions & 0 deletions WWCP_OCPPv2.1/NetworkingNode/IOCPPWebSocketAdapterIN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public delegate Task OnJSONResponseErrorMessageReceivedDelegate (DateTime
IOCPPWebSocketAdapterIN Server,
OCPP_JSONResponseErrorMessage JSONResponseErrorMessage);

public delegate Task OnJSONSendMessageReceivedDelegate (DateTime Timestamp,
IOCPPWebSocketAdapterIN Server,
OCPP_JSONSendMessage JSONSendMessage);



public delegate Task OnBinaryRequestMessageReceivedDelegate (DateTime Timestamp,
Expand All @@ -62,6 +66,10 @@ public delegate Task OnBinaryResponseMessageReceivedDelegate (DateTime
// IOCPPWebSocketAdapterIN Server,
// OCPP_BinaryErrorMessage BinaryErrorMessage);

public delegate Task OnBinarySendMessageReceivedDelegate (DateTime Timestamp,
IOCPPWebSocketAdapterIN Server,
OCPP_BinarySendMessage BinarySendMessage);

#endregion


Expand Down
Loading

0 comments on commit 679060b

Please sign in to comment.