Search in sources :

Example 1 with ActionResponsePair

use of de.rwth.idsg.steve.ocpp.ws.data.ActionResponsePair in project steve by RWTH-i5-IDSG.

the class AbstractChargePointServiceInvoker method run.

/**
 * Actual processing
 */
private void run(String chargeBoxId, CommunicationTask task) {
    RequestType request = task.getRequest();
    String messageId = UUID.randomUUID().toString();
    ActionResponsePair pair = typeStore.findActionResponse(request);
    if (pair == null) {
        throw new SteveException("Action name is not found");
    }
    OcppJsonCall call = new OcppJsonCall();
    call.setMessageId(messageId);
    call.setPayload(request);
    call.setAction(pair.getAction());
    FutureResponseContext frc = new FutureResponseContext(task, pair.getResponseClass());
    CommunicationContext context = new CommunicationContext(endpoint.getSession(chargeBoxId), chargeBoxId);
    context.setOutgoingMessage(call);
    context.setFutureResponseContext(frc);
    outgoingCallPipeline.accept(context);
}
Also used : CommunicationContext(de.rwth.idsg.steve.ocpp.ws.data.CommunicationContext) ActionResponsePair(de.rwth.idsg.steve.ocpp.ws.data.ActionResponsePair) OcppJsonCall(de.rwth.idsg.steve.ocpp.ws.data.OcppJsonCall) FutureResponseContext(de.rwth.idsg.steve.ocpp.ws.data.FutureResponseContext) RequestType(de.rwth.idsg.steve.ocpp.RequestType) SteveException(de.rwth.idsg.steve.SteveException)

Example 2 with ActionResponsePair

use of de.rwth.idsg.steve.ocpp.ws.data.ActionResponsePair in project steve by RWTH-i5-IDSG.

the class TypeStoreTest method ocpp15Test.

@Test
public void ocpp15Test() {
    ActionResponsePair actionResponse = Ocpp15TypeStore.INSTANCE.findActionResponse(new ocpp.cp._2012._06.UpdateFirmwareRequest());
    Assert.assertNotNull(actionResponse);
    Assert.assertEquals("UpdateFirmware", actionResponse.getAction());
    Assert.assertEquals(ocpp.cp._2012._06.UpdateFirmwareResponse.class, actionResponse.getResponseClass());
}
Also used : ActionResponsePair(de.rwth.idsg.steve.ocpp.ws.data.ActionResponsePair) Test(org.junit.Test)

Example 3 with ActionResponsePair

use of de.rwth.idsg.steve.ocpp.ws.data.ActionResponsePair in project steve by RWTH-i5-IDSG.

the class TypeStoreTest method ocpp12Test.

@Test
public void ocpp12Test() {
    ActionResponsePair actionResponse = Ocpp12TypeStore.INSTANCE.findActionResponse(new ocpp.cp._2010._08.ResetRequest());
    Assert.assertNotNull(actionResponse);
    Assert.assertEquals("Reset", actionResponse.getAction());
    Assert.assertEquals(ocpp.cp._2010._08.ResetResponse.class, actionResponse.getResponseClass());
}
Also used : ActionResponsePair(de.rwth.idsg.steve.ocpp.ws.data.ActionResponsePair) Test(org.junit.Test)

Aggregations

ActionResponsePair (de.rwth.idsg.steve.ocpp.ws.data.ActionResponsePair)3 Test (org.junit.Test)2 SteveException (de.rwth.idsg.steve.SteveException)1 RequestType (de.rwth.idsg.steve.ocpp.RequestType)1 CommunicationContext (de.rwth.idsg.steve.ocpp.ws.data.CommunicationContext)1 FutureResponseContext (de.rwth.idsg.steve.ocpp.ws.data.FutureResponseContext)1 OcppJsonCall (de.rwth.idsg.steve.ocpp.ws.data.OcppJsonCall)1