|
@@ -29,7 +29,7 @@ using System.Security.Authentication;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Xml.Linq;
|
|
|
-
|
|
|
+using TCC_OCPPLogModule;
|
|
|
|
|
|
namespace EVCB_OCPP.WSServer
|
|
|
{
|
|
@@ -62,6 +62,7 @@ namespace EVCB_OCPP.WSServer
|
|
|
private DateTime _CheckWeatherDt = DateTime.UtcNow;
|
|
|
private LoadingBalanceService _loadingBalanceService = new LoadingBalanceService();
|
|
|
private Dictionary<string, TCCWeatherDto> TCCStationDic = new Dictionary<string, TCCWeatherDto>();
|
|
|
+ private IOCPPLogModule _ocppLogModule = new LogModuleFactory().CreateOCPPLogModule();
|
|
|
|
|
|
private List<string> needConfirmActions = new List<string>()
|
|
|
{
|
|
@@ -368,12 +369,11 @@ namespace EVCB_OCPP.WSServer
|
|
|
var appServer = new OCPPWSServer(new List<OCPPSubProtocol>() { new OCPPSubProtocol(), new OCPPSubProtocol(" ocpp1.6"), new OCPPSubProtocol("ocpp2.0") });
|
|
|
|
|
|
List<IListenerConfig> llistener = new List<IListenerConfig>();
|
|
|
- //System.Net.IPAddress.Any.ToString()
|
|
|
- // llistener.Add(new ListenerConfig { Ip = "", Port = Convert.ToInt32(wssserverPort), Backlog = 100, Security = serverSecurity });
|
|
|
+
|
|
|
llistener.Add(new ListenerConfig { Ip = System.Net.IPAddress.Any.ToString(), Port = Convert.ToInt32(GlobalConfig.GetWS_Port()), Backlog = 100, Security = "None" });
|
|
|
llistener.Add(new ListenerConfig { Ip = System.Net.IPAddress.Any.ToString(), Port = Convert.ToInt32(GlobalConfig.GetWSS_Port()), Backlog = 100, Security = SslProtocols.Tls12.ToString() });
|
|
|
|
|
|
- // llistener.Add(new ListenerConfig { Ip = System.Net.IPAddress.Any.ToString(), Port = Convert.ToInt32(GlobalConfig.GetWSS_Port()), Backlog = 100, Security = SslProtocols.Tls11.ToString() });
|
|
|
+
|
|
|
var config = ConfigurationManager.GetSection("superSocket") as IConfigurationSource;
|
|
|
ICertificateConfig Certificate = config.Servers.ElementAt(0).Certificate;
|
|
|
IEnumerable<IListenerConfig> listeners = llistener;
|
|
@@ -2141,7 +2141,7 @@ namespace EVCB_OCPP.WSServer
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
+ var dd = DateTime.UtcNow;
|
|
|
if (clientData == null || string.IsNullOrEmpty(data)) return;
|
|
|
|
|
|
if (clientData.ChargeBoxId == null)
|
|
@@ -2152,7 +2152,7 @@ namespace EVCB_OCPP.WSServer
|
|
|
{
|
|
|
string sp = "[dbo].[uspInsertMachineConnectionLog] @CreatedOn," +
|
|
|
"@ChargeBoxId,@MessageType,@Data,@Msg,@IsSent,@EVSEEndPoint,@Session";
|
|
|
- var dd = DateTime.UtcNow;
|
|
|
+
|
|
|
SqlParameter[] parameter =
|
|
|
{
|
|
|
new SqlParameter("CreatedOn",dd),
|
|
@@ -2167,6 +2167,16 @@ namespace EVCB_OCPP.WSServer
|
|
|
|
|
|
db.Database.ExecuteSqlCommand(sp, parameter);
|
|
|
}
|
|
|
+
|
|
|
+ if (clientData.ChargeBoxId != null && _ocppLogModule != null && messageType != "Connection")
|
|
|
+ {
|
|
|
+ MessageTypeEnum messageTypeEnum = messageType.Contains("Request") ? MessageTypeEnum.CALL :
|
|
|
+ messageType.Contains("Confirmation") ? MessageTypeEnum.CALLRESULT : MessageTypeEnum.CALLERROR;
|
|
|
+
|
|
|
+ _ocppLogModule.HandleOCPPLog(messageTypeEnum, clientData.ChargeBoxId, data, dd);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|