3.18 Get Diagnostics

The GetDiagnostics message in OCPP 1.6J is used by the central system to request diagnostic logs from the charge point. It specifies the location of the logs, and the charge point responds with the requested diagnostic file, either as a URL or file content. This helps with troubleshooting and maintaining the charge point's health.

API Syntax

Description

Input Params

Return Value

SetGetDiagnosticsFileName

This function sets the file name to be included in the GetDiagnostics response.

char *fileName

void

Example:


  case GET_DIAGNOSTICS:
  {
    if (responsecode == GETDIAGNOSTICS_LOCATION_RECEIVED)
    {
      RX_GETDIAGNOSTICS_T params;
      GetGetDiagnosticsParms(&params);
      LogDebug("APP_LOG", " GetDiagnostics Params location: %s startTime: %s stopTime: %s retryInterval: %d retries: %d\n", params.location, params.startTime, params.stopTime, params.retryInterval, params.retries);

      /* Check for Diagnostics Info */
      SetGetDiagnosticsHasInfo(1);
      SetGetDiagnosticsFileName(DIAG_TEST_FILE);
    }

API Syntax

Description

Input Params

Return Value

SetGetDiagnosticsHasInfo

This function sets the flag indicating whether diagnostic information is available.

uint8_t hasInfo

void

Example:

case GET_DIAGNOSTICS:
  {
    if (responsecode == GETDIAGNOSTICS_LOCATION_RECEIVED)
    {
      RX_GETDIAGNOSTICS_T params;
      GetGetDiagnosticsParms(&params);
      LogDebug("APP_LOG", " GetDiagnostics Params location: %s startTime: %s stopTime: %s retryInterval: %d retries: %d\n", params.location, params.startTime, params.stopTime, params.retryInterval, params.retries);

      /* Check for Diagnostics Info */
      SetGetDiagnosticsHasInfo(1);
      SetGetDiagnosticsFileName(DIAG_TEST_FILE);
    }
    else if (responsecode == GETDIAGNOSTICS_LOCATION_MISSING)
    {
      LogDebug("APP_LOG", " GetDiagnostics Missing Location Parameter");
    }

API Syntax

Description

Input Params

Return Value

GetGetDiagnosticsParms

This function retrieves the parameters from the received GetDiagnostics request and copies them into the provided structure.

RX_GETDIAGNOSTICS_T *params

void

Example:

  case GET_DIAGNOSTICS:
  {
    if (responsecode == GETDIAGNOSTICS_LOCATION_RECEIVED)
    {
      RX_GETDIAGNOSTICS_T params;
      GetGetDiagnosticsParms(&params);
      LogDebug("APP_LOG", " GetDiagnostics Params location: %s startTime: %s stopTime: %s retryInterval: %d retries: %d\n", params.location, params.startTime, params.stopTime, params.retryInterval, params.retries);

      /* Check for Diagnostics Info */
      SetGetDiagnosticsHasInfo(1);
      SetGetDiagnosticsFileName(DIAG_TEST_FILE);
    }

Syntax

Description

Constants/Members

GETDIAGNOSTICS_RESPONSE_T

This structure holds the data to be sent in a GetDiagnostics response.

char fileName[];

uint8_t hasDiagnosticInfo;

RX_GETDIAGNOSTICS_T

This structure holds the parameters received in a GetDiagnostics request.

char uuid[];

char location[];

char startTime[];

char stopTime[];

uint16_t retryInterval;

uint16_t retries;

GETDIAGNOSTICS_CODE

This enum defines the possible response codes for the GetDiagnostics process.

GETDIAGNOSTICS_LOCATION_RECEIVED

GETDIAGNOSTICS_LOCATION_MISSING