3.11 Cancel Reservation
The CancelReservation message in OCPP 1.6J is sent by the central system to cancel a reservation at the charge point using a specific ReservationId. It ensures that the reserved connector is freed up, making it available for other users. The charge point responds to acknowledge the cancellation.
|
API Syntax |
Description |
Input Params |
Return Value |
|---|---|---|---|
SetCancelReservationStatus | Sets the status of the CancelReservation response. This function updates the response status based on the outcome of the cancellation request. | CANCEL_RESERVATION_STATUS_T Status | void |
Example:
if ((CANCEL_RESERVATION_STATUS_T)responsecode == CANCEL_RESERVATION_MISSING_RESERVATION_ID)
{
LogDebug("APP_LOG", " CancelReservation request missing Reservation Id\n");
SetCancelReservationStatus(CANCEL_RESERVATION_REJECTED); /* Set for testing */
(void)SendCancelReservationResponse();
}
|
API Syntax |
Description |
Input Params |
Return Value |
|---|---|---|---|
CancelReservationInit | Initializes the CancelReservation response structure with default values. | void | void |
Example:
void OCPPMessagesInit(void)
{
DataTransferInit();
ResetInit();
MeterValueStructInit();
SetLocalListVersionNumber(DEFAULT_SEND_LOCAL_LIST_VERSION);
SetChargePointConnectorId(CHARGEPOINT_DEFAULT_CONTROLLER);
SetChargePointError(NOERROR);
SetChargePointStatus(AVAILABLE);
SetAuthorizeStatus(AUTHORIZE_INVALID);
SetRemoteStartTransactionStatus(REMOTE_START_STOP_REJECTED);
SetOCPPWebsocketOnlineMode();
UnlockConnectorInit();
ReserveNowInit();
ChangeAvailabilityInit();
ClearCacheInit();
ChangeConfigurationInit();
CancelReservationInit();
GetAllIDsFromDB();
CheckAndStartClockAlignedMeterValueTimer();
}
|
API Syntax |
Description |
Input Params |
Return Value |
|---|---|---|---|
GetCancelReservationParams | Retrieves the reservation ID from the CancelReservation request. The reservation ID is provided through the function's parameter. | uint16_t *reservationId | void |
Example:
if (responsecode == CANCEL_RESERVATION_MISSING_RESERVATION_ID)
{
LogDebug("APP_LOG", " CancelReservation request missing Reservation Id\n");
SetCancelReservationStatus(CANCEL_RESERVATION_REJECTED); /* Set for testing */
SendCancelReservationResponse();
}
else
{
uint16_t reservationId;
uint8_t connectorId = GetChargePointConnectorId();
GetCancelReservationParams(&reservationId);
GetReserveNowParams(¶ms);
LogDebug("APP_LOG", " CancelReservationId:%d ReserveNowRservationId: %d\n", reservationId, params.reservationId);
if (reservationId == params.reservationId)
{
SetCancelReservationStatus(CANCEL_RESERVATION_ACCEPTED); /* Set for testing */
SendCancelReservationResponse();
UpdateAndSendStatusNotification(AVAILABLE, NOERROR, connectorId);
}
else
{
SetCancelReservationStatus(CANCEL_RESERVATION_REJECTED); /* Set for testing */
SendCancelReservationResponse();
}
}
|
Syntax |
Description |
Constants/Members |
|---|---|---|
CANCELRESERVATION_RESPONSE_T | This structure represents the response to a CancelReservation request. It includes the status of the cancellation request. | CANCEL_RESERVATION_STATUS_T status; |
RX_CANCELRESERVATION_T | This structure represents a CancelReservation request. It includes fields for the unique identifier of the request and the reservation ID to be cancelled. | char uuid[]; uint16_t reservationId; |
CANCEL_RESERVATION_STATUS_T | This enumeration defines the possible statuses for a CancelReservation response. The status indicates the outcome of the reservation cancellation process. | CANCEL_RESERVATION_ACCEPTED CANCEL_RESERVATION_REJECTED CANCEL_RESERVATION_MISSING_RESERVATION_ID |
