3.12 Change Availability
The ChangeAvailability message in OCPP 1.6J is sent by the central system to change the availability status of a charge point or its connectors. It includes a connector ID and the new status (such as Available, Occupied, Faulted or Unavailable). The charge point responds to acknowledge the status change. This message allows the central system to manage the operational state of the charge point.
|
API Syntax |
Description |
Input Params |
Return Value |
|---|---|---|---|
SetChangeAvailabilityStatus | This function updates the status of the Change Availability response based on the provided status and triggers the sending of the response. | CHANGEAVAILABILITY_STATUS_T status | void |
Example:
if ((CHANGEAVAILABILITY_CODE)responsecode == CHANGEAVAILABILITY_RECEIVED)
{
uint8_t connectorId;
char type[CHANGEAVAILABILITY_RECEIVED_TYPE];
GetChangeAvailabilityParms(&connectorId, type, CHANGEAVAILABILITY_RECEIVED_TYPE);
LogDebug("APP_LOG", " OCPPCallBackFn ChangeAvailability: %d %s\n\r", connectorId, type);
if (CheckConnectorIdValid(connectorId))
{
HandleChangeAvailability(connectorId, type);
}
else
{
LogDebug("APP_LOG", "Incorrect connectorId in change availability request\n\n");
SetChangeAvailabilityStatus(CHANGEAVAILABILITY_REJECTED);
}
}
else
{
LogDebug("APP_LOG", "Incorrect response code in change availability request\n\n");
SetChangeAvailabilityStatus(CHANGEAVAILABILITY_REJECTED);
}
|
API Syntax |
Description |
Input Params |
Return Value |
|---|---|---|---|
GetChangeAvailabilityParms | This function copies the connector ID and type from the Change Availability request into the provided pointers. It ensures that the pointers are valid before accessing them. | uint8_t *ConnectorId, char *type, size_t typeSize | void |
Example:
case CHANGE_AVAILABILITY:
{
if (responsecode == CHANGEAVAILABILITY_RECEIVED)
{
uint8_t connectorId;
char type[CHANGEAVAILABILITY_RECEIVED_TYPE];
GetChangeAvailabilityParms(&connectorId, type, CHANGEAVAILABILITY_RECEIVED_TYPE);
LogDebug("APP_LOG", " OCPPCallBackFn ChangeAvailability: %d %s\n\r", connectorId, type);
|
API Syntax |
Description |
Input Params |
Return Value |
|---|---|---|---|
ChangeAvailabilityInit | This function sets the initial status of the Change Availability response to “no status”, indicating that no decision has been made yet. | 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();
}
|
Syntax |
Description |
Constants/Members |
|---|---|---|
CHANGEAVAILABILITY_RESPONSE_T | This structure holds the status of the Change Availability response. | CHANGEAVAILABILITY_STATUS_T status; |
RX_CHANGEAVAILABILITY_T | This structure holds the details of the Change Availability request. | char uuid[]; uint8_t connectorId; AVAILABILITYTYPE_T type; bool receiveError; |
char *ChangeAvailabilityStatusType[] | Array of status strings corresponding to the CHANGEAVAILABILITY_STATUS_T values | Accepted Rejected Scheduled |
CHANGEAVAILABILITY_STATUS_T | This enumeration defines the possible statuses for Change Availability. | CHANGEAVAILABILITY_NOSTATUS CHANGEAVAILABILITY_ACCEPTED CHANGEAVAILABILITY_REJECTED CHANGEAVAILABILITY_SCHEDULED |
CHANGEAVAILABILITY_CODE | This enumeration defines the possible processing outcomes for Change Availability. | CHANGEAVAILABILITY_RECEIVED CHANGEAVAILABILITY_MISSING_TYPE CHANGEAVAILABILITY_MISSING_CONNECTORID |
