3.27 Unlock Connector

The UnlockConnector message in OCPP 1.6J is sent by the central system to remotely unlock a specific connector, allowing the user to safely disconnect the charging cable. It specifies the connector ID of the connector to be unlocked. The charge point responds to confirm whether the unlock operation was successful. This feature is essential for user convenience and safety after a charging session.

API Syntax

Description

Input Params

Return Value

SetUnlockConnectorStatus

Sets the status for the UnlockConnector operation.

UNLOCK_CONNECTOR_STATUS_T status

void

Example:

            if(connectorDetails.connectorStatus == GOOD_CONNECTION)
            {
                char ChargePointStatus[CHARGE_POINT_STATUS_SIZE];
                static char IdTag[CISTRING_20TYPE_LENGTH]={NULL_VALUE};
                SetUnlockConnectorStatus(UNLOCK_CONNECTOR_UNLOCKED);
                (void)SendUnlockConnectorResponse();
                GetAuthorizeIdTag(IdTag);
                GetChargePointStatus(ChargePointStatus);
                LogDebug("APP_LOG", " charge point status:%s\n\r",ChargePointStatus);
                if((strncmp(ChargePointStatus, "Charging", strlen(ChargePointStatus)) == 0) )
                {
                    int  transactionId;
                    LogDebug("APP_LOG", " UnlockConnector: Stop charging\n\r");
                    transactionId = GetStartTransactionResponseTransactionId();
                    UpdateAndSendStopTransaction(IdTag, OCPP_METER_READING, transactionId, UNLOCKCOMMAND, OCPP_KWH);
                }
            }
            else
            {
              LogDebug("APP_LOG", " UnlockConnector: Bad connector connection\n\r");
              SetUnlockConnectorStatus(UNLOCK_CONNECTOR_UNLOCKFAILED);
              SendUnlockConnectorResponse();
            }

API Syntax

Description

Input Params

Return Value

UnlockConnectorInit

Initializes the UnlockConnector response parameters.

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

GetUnlockConnectorParms

Retrieves the connector ID from the UnlockConnector request.

uint8_t *connectorId

void

Example:

void UnlockConnector(uint16_t responsecode)
{
    (void)responsecode;
    uint8_t connectorId;
    CONNECTOR_DETAILS connectorDetails;
    
    GetUnlockConnectorParms(&connectorId);
    LogDebug("APP_LOG", " UnlockConnector requested connectorId:%d\n\r",connectorId);

Syntax

Description

Constants/Members

UNLOCKCONNECTOR_RESPONSE_T

Structure representing the response data for an UnlockConnector request

UNLOCK_CONNECTOR_STATUS_T status

RX_UNLOCKCONNECTOR_T

Structure representing the request data for unlocking a connector

char uuid[];

uint8_t connectorId;

UNLOCK_CONNECTOR_STATUS_T

Enumeration of possible statuses for the UnlockConnector operation

UNLOCK_CONNECTOR_UNLOCKED

UNLOCK_CONNECTOR_UNLOCKFAILED

UNLOCK_CONNECTOR_NOTSUPPORTED