/** * Creates a new PushChargeDetailRecord request. * * @param ChargeDetailRecord the charge detail record for this request. * @return a new PushChargeDetailRecord request builder object. */publicPushChargeDetailRecordRequestPushChargeDetailRecord(finalChargeDetailRecordChargeDetailRecord){...}/** * Creates a new ChargeDetailRecordBuilder request builder object. * * @param SessionId the unique identification of the EV charging session for this request. * @param SessionId the OICP session identification from the Authorize Start request. * @param PartnerSessionId The OICP session identification from the Authorize Start request. * @param PartnerProductId The ev charging product identification. * @param EVSEId The EVSE identification. * @param AuthToken An optional (RFID) user identification. * @param QRCode_EVCOId An optional EVCO user identification. * @param QRCode_PIN An optional EVCO user identification PIN. * @param PnC_EVCOId An optional plug-and-charge EVCO user identification. * @param Remote_EVCOId An optional remote EVCO user identification. * @param ChargingStart An optional charging start timestamp. * @param ChargingEnd An optional charging end timestamp. * @param SessionStart The session start timestamp. * @param SessionEnd The session end timestamp. * @param MeterValueStart An optional initial value of the energy meter. * @param MeterValueEnd An optional final value of the energy meter. * @param MeterValuesInBetween An optional stream of meter values during the charging session. * @param ConsumedEnergy The optional amount of consumed energy. * @param MeteringSignature An optional signature for the metering values. * @param HubOperatorId An optional identification of the hub operator. * @param HubProviderId An optional identification of the hub provider. */publicChargeDetailRecord(finalChargingSession_IdSessionId,finalChargingSession_IdPartnerSessionId,finalChargingProduct_IdPartnerProductId,finalEVSE_IdEVSEId,finalAuth_TokenAuthToken,finalEVCO_IdQRCode_EVCOId,finalPINQRCode_PIN,finalEVCO_IdPnC_EVCOId,finalEVCO_IdRemote_EVCOId,finalInstantChargingStart,finalInstantChargingEnd,finalInstantSessionStart,finalInstantSessionEnd,finalDoubleMeterValueStart,finalDoubleMeterValueEnd,finalStream<Double>MeterValuesInBetween,finalDoubleConsumedEnergy,finalStringMeteringSignature,finalHubOperator_IdHubOperatorId,finalHubProvider_IdHubProviderId){...}/** * Creates a new ChargeDetailRecordBuilder request builder object. * * @param SessionId the unique identification of the EV charging session for this request. */publicChargeDetailRecordBuilder(finalChargingSession_IdSessionId){...}
EVSEOperator_IdEVSEOperatorId=EVSEOperator_Id.Parse("DE*GEF");EVSE_IdEVSEId=EVSE_Id.Parse("DE*GEF*E123456789*1");Auth_TokenAuthToken=Auth_Token.Parse("12345678");CPOClientHubjectCPO=newCPOClient("api.playground.hubject.com").CompletableFuturereq=HubjectCPO.AuthorizeStart(EVSEOperatorId,EVSEId,AuthToken).Run(StartResult->{if(StartResult.getAuthorizationStatus()==AuthorizationStatus.Authorized){System.out.println("AuthorizeStart: success!");try{Thread.sleep(1000);HubjectCPO.AuthorizeStop(EVSEOperatorId,StartResult.getSessionId(),AuthToken).Run(StopResult->{if(StopResult.getAuthorizationStatus()==AuthorizationStatus.Authorized){System.out.println("AuthorizeStop: success!");try{Thread.sleep(1000);ChargeDetailRecordCDR=ChargeDetailRecord.Create(StartResult.getSessionId()).setEVSEId(EVSEId).setPartnerProductId(ChargingProduct_Id.Parse("AC1")).setAuthToken(AuthToken).setSessionStart(Instant.now().minus(Duration.ofHours(3))).setChargingStart(Instant.now().minus(Duration.ofHours(3))).setChargingEnd(Instant.now()).setMeterValueStart(1.0).setMeterValueEnd(5.1).setMeterValuesInBetween(1.0,2.1,3.4,4.8,5.1,5.1,5.1).setConsumedEnergy(4.1).setSessionEnd(Instant.now()).build();HubjectCPO.PushChargeDetailRecord(CDR).Run(ack->{if(ack.hasResult())System.out.println("PushChargeDetailRecord: success!");else{System.out.println(ack.getStatusCode().getCode());System.out.println(ack.getStatusCode().getDescription());System.out.println(ack.getStatusCode().getAdditionalInfo());}});}catch(Exceptione){System.out.println(e.getMessage());}}else{System.out.println(StopResult.getStatusCode().getCode());System.out.println(StopResult.getStatusCode().getDescription());System.out.println(StopResult.getStatusCode().getAdditionalInfo());}});}catch(Exceptione){System.out.println(e.getMessage());}}else{System.out.println(StartResult.getStatusCode().getCode());System.out.println(StartResult.getStatusCode().getDescription());System.out.println(StartResult.getStatusCode().getAdditionalInfo());}});// Wait for the future to complete...req.get();
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.