3.14 Clear Cache

The ClearCache message in OCPP 1.6J is sent by the central system to instruct the charge point to clear its locally stored data, such as cached configuration. The charge point acknowledges the request, confirming whether the cache was cleared successfully or if an error occurred.

API Syntax

Description

Input Params

Return Value

SetClearCacheStatus

This function sets the status of the Clear Cache response based on the provided status value.

CLEAR_CACHE_STATUS_T Status

void

Example:

void ClearAuthorizationCacheHandler(uint16_t responsecode)
{
   if(responsecode == CLEAR_CACHE_ACCEPTED) 
   {
     if(ClearAuthorizationCache() == AUTHORIZATION_CACHE_SUCCESS)
     {
        SetClearCacheStatus(CLEAR_CACHE_ACCEPTED);
     }
     else
     {
        SetClearCacheStatus(CLEAR_CACHE_REJECTED);
     }    
   }
   else
   {
     SetClearCacheStatus(CLEAR_CACHE_REJECTED);
   }
}

API Syntax

Description

Input Params

Return Value

ClearCacheInit

This function initializes the Clear Cache response status to "Rejected" by default.

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

CLEARCACHE_RESPONSE_T

This structure contains the status of the Clear Cache response.

CLEAR_CACHE_STATUS_T status;

RX_CLEARCACHE_T

This structure contains the UUID for the Clear Cache request.

char uuid[];

CLEAR_CACHE_STATUS_T

This enum defines the possible statuses for a Clear Cache response.

CLEAR_CACHE_ACCEPTED

CLEAR_CACHE_REJECTED