using EVCB_OCPP.Packet.Features; using EVCB_OCPP.Packet.Messages.Core; using Microsoft.Extensions.Logging; namespace EVCB_OCPP.WSServer.Service; public class ServerMessageService { public ServerMessageService( IMainDbService mainDbService , ILogger logger) { this.mainDbService = mainDbService; this.logger = logger; } private readonly IMainDbService mainDbService; private readonly ILogger logger; internal async Task SendGetEVSEConfigureRequest(string chargeBoxId) { if (string.IsNullOrEmpty(chargeBoxId)) return; await mainDbService.AddServerMessage( ChargeBoxId: chargeBoxId, OutAction: Actions.GetConfiguration.ToString(), OutRequest: new GetConfigurationRequest() { key = new List() } ); } internal Task SendChangeConfigurationRequest(string chargeBoxId, string key, string value) { return mainDbService.AddServerMessage( ChargeBoxId: chargeBoxId, OutAction: Actions.ChangeConfiguration.ToString(), OutRequest: new ChangeConfigurationRequest() { key = key, value = value }); } internal Task SendDataTransferRequest(string chargeBoxId, string messageId, string vendorId, string data) { return mainDbService.AddServerMessage( ChargeBoxId: chargeBoxId, OutAction: Actions.DataTransfer.ToString(), OutRequest: new DataTransferRequest() { messageId = messageId, vendorId = vendorId, data = data } ); } }