|
@@ -78,17 +78,19 @@ public class WsClientData : WsSession
|
|
|
public event EventHandler<string> m_ReceiveData;
|
|
|
|
|
|
private string stringBuffer = string.Empty;
|
|
|
-
|
|
|
+ private readonly ILogger<WsClientData> logger;
|
|
|
|
|
|
public WsClientData(ILogger<WsClientData> logger) : base(logger)
|
|
|
{
|
|
|
ChargeBoxId = SessionID;
|
|
|
MachineId = SessionID;
|
|
|
+ this.logger = logger;
|
|
|
}
|
|
|
|
|
|
internal override void HandleReceivedData(string data)
|
|
|
{
|
|
|
stringBuffer += data;
|
|
|
+ //logger.LogInformation("{StringBuffer}", stringBuffer);
|
|
|
while (TryGetOCPPMsg(ref stringBuffer, out var msg))
|
|
|
{
|
|
|
m_ReceiveData?.Invoke(this, msg);
|
|
@@ -128,7 +130,7 @@ public class WsClientData : WsSession
|
|
|
if (startIndex is not null && stopIndex is not null)
|
|
|
{
|
|
|
msg = buffer.Substring(startIndex.Value, stopIndex.Value - startIndex.Value);
|
|
|
- buffer = buffer.Substring(stopIndex.Value);
|
|
|
+ buffer = buffer.Substring(stopIndex.Value + 1);
|
|
|
return true;
|
|
|
}
|
|
|
|