3.4 Diagnostics Status Notification

The DiagnosticsStatusNotification message in OCPP 1.6J reports the status of diagnostic log uploads from the charge point to the central system, such as "Uploading”, "Uploaded" or "UploadFailed". It helps track the progress and success of diagnostic data transfers.

API Syntax

Description

Input Params

Return Value

OCPPDiagnosticStatusNotificationResetGlobals

Function to reset global variables for Diagnostic Status Notification.

void

DIAGNOSTIC_STATUS_NOTIFICATION_STATE_T

Example:

	void OCPPResetAllGlobals(void) 
{
    UtilitiesGlobalVariablesReset();
    UtilitiesLocalStorageResetGlobals();
    OCPPSetChargingProfileResetGlobals();
    OCPPGetCompositeScheduleResetGlobals();
    CPPClearChargingProfileResetGlobals();
    OCPPReserveNowResetGlobals();
    OCPPCancelReservationResetGlobals();
    OCPPTriggerMessageResetGlobals();
    OCPPSendLocalListResetGlobals();
    OCPPGetLocalListVersionResetGlobals();
    OCPPUpdateFirmwareResetGlobals();
    OCPPGetDiagnosticsResetGlobals();
    OCPPFirmwareStatusNotificationResetGlobals();
    OCPPDiagnosticStatusNotificationResetGlobals();
    OCPPUnlockConnectorResetGlobals();
    OCPPStopTransactionResetGlobals();

API Syntax

Description

Input Params

Return Value

SendDiagnosticStatusNotificationRequest

This function sends a diagnostic status notification request to the server. It creates an OCPP frame for the request and sends it using sendframe.

void

DIAGNOSTIC_STATUS_NOTIFICATION_STATE_T

Example:

	 case TRIGGER_MESSAGE_TYPE_DIAGNOSTICS_STATUS_NOTIFICATION:
                SendDiagnosticStatusNotificationRequest();
                break;

API Syntax

Description

Input Params

Return Value

SetChargerDiagnosticsInfo

This function sets the diagnostic information of the charger to Idle state.

status

void

Example:

                    case 'd': /*DiagnosticsStatusNotification*/
                    {
                        uint8_t diagState = DIAGNOSTICSTATUSNOTIFICATION_IDLE; /*Idle State*/
                        LogDebug("APP_LOG", "Select the Diagnostic State\n\t0. Idle \n\t1. Uploaded\n\t2. UploadFailed\n\t3. Uploading \n\r");

                        result = scanf("%hhd",(char *)&diagState);
                        if (result != 1) 
                        {
                            LogDebug("APP_LOG", "Error reading DiagState\n");
                        }
                        if (diagState < 4U)
                        {
                            SetChargerDiagnosticsInfo(diagState);
                        }
                        else
                        {
                            LogDebug("APP_LOG", "Selected the invalid Diagnostic State\n");
                        }
                        (void)SendDiagnosticStatusNotificationRequestS();
                    }
                    break;

                    case 'F': /*FirmwareStatusNotification*/
                    {
                        TestFirmwareStatusNotification();
                    }
                    break;
                    

API Syntax

Description

Input Params

Return Value

GetChargerDiagnosticNotificationStr

This function returns the status of DiagnosticStatusNotification in string format.

DIAGNOSTICSTATUSNOTIFICATION_T status

char*

Example:

void  GetChargerDiagnosticsInfo(char *str)
{
    if (str == NULL)
    {
        /* Check for NULL pointer to avoid segmentation fault */
        OCPPLogMessage(LOG_ERROR, LOG_SENDING, "Error: NULL parameter passed to get_charger_diagnostics_info\n\r");
        return;
    }

    /* Copy the diagnostic information string to the provided destination string */
    Safestrcpy(str, (char *)GetchargerDiagnosticNotificationStr(diagnosticStatusNotification.status), DIAGNOSTIC_STATUS_STRING_SIZE);
    OCPPLogMessage(LOG_INFO, LOG_SENDING, " Get_charger_diagnostics_info: %s\n\r", str);
}

Syntax

Description

Constants/Members

DIAGNOSTICSTATUSNOTIFICATION_T

Enum: Diagnostic status notification states

DIAGNOSTICSTATUSNOTIFICATION_IDLE

DIAGNOSTICSTATUSNOTIFICATION_UPLOADED

DIAGNOSTICSTATUSNOTIFICATION_UPLOAD_FAILED

DIAGNOSTICSTATUSNOTIFICATION_UPLOADING

DIAGNOSTIC_STATUS_NOTIFICATION_STATE_T

Enum: Diagnostic status notification error states

DIAGNOSTICSTATUSNOTIFICATION_SUCCESS

DIAGNOSTICSTATUSNOTIFICATION_FAILED

DIAGNOSTICSTATUSNOTIFICATION_RESPONSE_FAILED

DIAGNOSTICSTATUSNOTIFICATION_RESPONSE_ACCEPT_FAILED

DIAGNOSTICSTATUSNOTIFICATION_RESPONSE_SUCCESS

RX_DIAGNOSTICSTATUSNOTIFICATION

DIAGNOSTICSTATUSNOTIFICATION_T status