|
| 1 | +package de.rwth.idsg.steve.ocpp; |
| 2 | + |
| 3 | +import de.rwth.idsg.steve.ocpp.soap.ClientProvider; |
| 4 | +import de.rwth.idsg.steve.ocpp.task.CancelReservationTask; |
| 5 | +import de.rwth.idsg.steve.ocpp.task.ChangeAvailabilityTask; |
| 6 | +import de.rwth.idsg.steve.ocpp.task.ChangeConfigurationTask; |
| 7 | +import de.rwth.idsg.steve.ocpp.task.ClearCacheTask; |
| 8 | +import de.rwth.idsg.steve.ocpp.task.DataTransferTask; |
| 9 | +import de.rwth.idsg.steve.ocpp.task.GetConfigurationTask; |
| 10 | +import de.rwth.idsg.steve.ocpp.task.GetDiagnosticsTask; |
| 11 | +import de.rwth.idsg.steve.ocpp.task.GetLocalListVersionTask; |
| 12 | +import de.rwth.idsg.steve.ocpp.task.RemoteStartTransactionTask; |
| 13 | +import de.rwth.idsg.steve.ocpp.task.RemoteStopTransactionTask; |
| 14 | +import de.rwth.idsg.steve.ocpp.task.ReserveNowTask; |
| 15 | +import de.rwth.idsg.steve.ocpp.task.ResetTask; |
| 16 | +import de.rwth.idsg.steve.ocpp.task.SendLocalListTask; |
| 17 | +import de.rwth.idsg.steve.ocpp.task.UnlockConnectorTask; |
| 18 | +import de.rwth.idsg.steve.ocpp.task.UpdateFirmwareTask; |
| 19 | +import de.rwth.idsg.steve.ocpp.ws.AbstractChargePointServiceInvoker; |
| 20 | +import de.rwth.idsg.steve.ocpp.ws.ocpp12.Ocpp12TypeStore; |
| 21 | +import de.rwth.idsg.steve.ocpp.ws.ocpp12.Ocpp12WebSocketEndpoint; |
| 22 | +import de.rwth.idsg.steve.ocpp.ws.pipeline.OutgoingCallPipeline; |
| 23 | +import de.rwth.idsg.steve.repository.dto.ChargePointSelect; |
| 24 | +import ocpp.cp._2012._06.ChargePointService; |
| 25 | +import org.springframework.beans.factory.annotation.Autowired; |
| 26 | +import org.springframework.stereotype.Service; |
| 27 | + |
| 28 | +/** |
| 29 | + * @author Sevket Goekay <goekay@dbis.rwth-aachen.de> |
| 30 | + * @since 10.03.2018 |
| 31 | + */ |
| 32 | +@Service |
| 33 | +public class ChargePointService15_InvokerImpl |
| 34 | + extends AbstractChargePointServiceInvoker |
| 35 | + implements ChargePointService15_Invoker { |
| 36 | + |
| 37 | + @Autowired |
| 38 | + public ChargePointService15_InvokerImpl(OutgoingCallPipeline pipeline, Ocpp12WebSocketEndpoint endpoint) { |
| 39 | + super(pipeline, endpoint, Ocpp12TypeStore.INSTANCE); |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + public void reset(ChargePointSelect cp, ResetTask task) { |
| 44 | + if (cp.isSoap()) { |
| 45 | + create(cp).resetAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 46 | + } else { |
| 47 | + runPipeline(cp, task); |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + @Override |
| 52 | + public void clearCache(ChargePointSelect cp, ClearCacheTask task) { |
| 53 | + if (cp.isSoap()) { |
| 54 | + create(cp).clearCacheAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 55 | + } else { |
| 56 | + runPipeline(cp, task); |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + @Override |
| 61 | + public void getDiagnostics(ChargePointSelect cp, GetDiagnosticsTask task) { |
| 62 | + if (cp.isSoap()) { |
| 63 | + create(cp).getDiagnosticsAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 64 | + } else { |
| 65 | + runPipeline(cp, task); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + @Override |
| 70 | + public void updateFirmware(ChargePointSelect cp, UpdateFirmwareTask task) { |
| 71 | + if (cp.isSoap()) { |
| 72 | + create(cp).updateFirmwareAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 73 | + } else { |
| 74 | + runPipeline(cp, task); |
| 75 | + } |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + public void unlockConnector(ChargePointSelect cp, UnlockConnectorTask task) { |
| 80 | + if (cp.isSoap()) { |
| 81 | + create(cp).unlockConnectorAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 82 | + |
| 83 | + } else { |
| 84 | + runPipeline(cp, task); |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public void changeAvailability(ChargePointSelect cp, ChangeAvailabilityTask task) { |
| 90 | + if (cp.isSoap()) { |
| 91 | + create(cp).changeAvailabilityAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 92 | + } else { |
| 93 | + runPipeline(cp, task); |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + @Override |
| 98 | + public void changeConfiguration(ChargePointSelect cp, ChangeConfigurationTask task) { |
| 99 | + if (cp.isSoap()) { |
| 100 | + create(cp).changeConfigurationAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 101 | + } else { |
| 102 | + runPipeline(cp, task); |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | + @Override |
| 107 | + public void remoteStartTransaction(ChargePointSelect cp, RemoteStartTransactionTask task) { |
| 108 | + if (cp.isSoap()) { |
| 109 | + create(cp).remoteStartTransactionAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 110 | + } else { |
| 111 | + runPipeline(cp, task); |
| 112 | + } |
| 113 | + } |
| 114 | + |
| 115 | + @Override |
| 116 | + public void remoteStopTransaction(ChargePointSelect cp, RemoteStopTransactionTask task) { |
| 117 | + if (cp.isSoap()) { |
| 118 | + create(cp).remoteStopTransactionAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 119 | + } else { |
| 120 | + runPipeline(cp, task); |
| 121 | + } |
| 122 | + } |
| 123 | + |
| 124 | + @Override |
| 125 | + public void dataTransfer(ChargePointSelect cp, DataTransferTask task) { |
| 126 | + if (cp.isSoap()) { |
| 127 | + create(cp).dataTransferAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 128 | + } else { |
| 129 | + runPipeline(cp, task); |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + @Override |
| 134 | + public void getConfiguration(ChargePointSelect cp, GetConfigurationTask task) { |
| 135 | + if (cp.isSoap()) { |
| 136 | + create(cp).getConfigurationAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 137 | + } else { |
| 138 | + runPipeline(cp, task); |
| 139 | + } |
| 140 | + } |
| 141 | + |
| 142 | + @Override |
| 143 | + public void getLocalListVersion(ChargePointSelect cp, GetLocalListVersionTask task) { |
| 144 | + if (cp.isSoap()) { |
| 145 | + create(cp).getLocalListVersionAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 146 | + } else { |
| 147 | + runPipeline(cp, task); |
| 148 | + } |
| 149 | + } |
| 150 | + |
| 151 | + @Override |
| 152 | + public void sendLocalList(ChargePointSelect cp, SendLocalListTask task) { |
| 153 | + if (cp.isSoap()) { |
| 154 | + create(cp).sendLocalListAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 155 | + } else { |
| 156 | + runPipeline(cp, task); |
| 157 | + } |
| 158 | + } |
| 159 | + |
| 160 | + @Override |
| 161 | + public void reserveNow(ChargePointSelect cp, ReserveNowTask task) { |
| 162 | + if (cp.isSoap()) { |
| 163 | + create(cp).reserveNowAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 164 | + } else { |
| 165 | + runPipeline(cp, task); |
| 166 | + } |
| 167 | + } |
| 168 | + |
| 169 | + @Override |
| 170 | + public void cancelReservation(ChargePointSelect cp, CancelReservationTask task) { |
| 171 | + if (cp.isSoap()) { |
| 172 | + create(cp).cancelReservationAsync(task.getOcpp15Request(), cp.getChargeBoxId(), task.getOcpp15Handler(cp.getChargeBoxId())); |
| 173 | + } else { |
| 174 | + runPipeline(cp, task); |
| 175 | + } |
| 176 | + } |
| 177 | + |
| 178 | + private static ChargePointService create(ChargePointSelect cp) { |
| 179 | + return ClientProvider.getForOcpp15(cp.getEndpointAddress()); |
| 180 | + } |
| 181 | +} |
0 commit comments