ChargeTimeEU / Java-OCA-OCPP

Open source client and server library of Open Charge-Point Protocol (OCPP) defined by openchargealliance.org (OCA)
MIT License
274 stars 176 forks source link

How to send the CALLERROR message from server to client in handleStatusNotificationRequest() function #350

Open lgc1993-CN opened 5 months ago

lgc1993-CN commented 5 months ago

In the official document, as shown in the image, there is a situation where the server needs to return CALLERROR:SecurityError. However, I found the only type of handleStatusNotificationRequest() function is StatusNotificationResponse. Can someone show me an example of callerror response implement? image

robert-s-ubi commented 4 months ago

This pull request should close the gap. In your handleStatusNotificationRequest() implementation, add:

throw new SecurityErrorException("The charging station has not been accepted yet.");

at the point where you determine that it is not in the correct registration state, and the library will take care of sending that back as a CALLERROR.