logging

package
v0.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

The diagnostics functional block contains OCPP 2.0 features than enable remote diagnostics of problems with a charging station.

Index

Constants

View Source
const (
	LogTypeDiagnostics        LogType   = "DiagnosticsLog"   // This contains the field definition of a diagnostics log file
	LogTypeSecurity           LogType   = "SecurityLog"      // Sent by the CSMS to the Charging Station to request that the Charging Station uploads the security log
	LogStatusAccepted         LogStatus = "Accepted"         // Accepted this log upload. This does not mean the log file is uploaded is successfully, the Charging Station will now start the log file upload.
	LogStatusRejected         LogStatus = "Rejected"         // Log update request rejected.
	LogStatusAcceptedCanceled LogStatus = "AcceptedCanceled" // Accepted this log upload, but in doing this has canceled an ongoing log file upload.
)
View Source
const GetLogFeatureName = "GetLog"
View Source
const LogStatusNotificationFeatureName = "LogStatusNotification"
View Source
const ProfileName = "Log"

Variables

Functions

This section is empty.

Types

type CentralSystemHandler

type CentralSystemHandler interface {
	// OnLogStatusNotification is called on the CSMS whenever a LogStatusNotificationRequest is received from a Charging Station.
	OnLogStatusNotification(chargingStationID string, request *LogStatusNotificationRequest) (response *LogStatusNotificationResponse, err error)
}

Needs to be implemented by a CSMS for handling messages part of the OCPP 1.6j security extension.

type ChargePointHandler

type ChargePointHandler interface {
	// OnGetLog is called on a charging station whenever a GetLogRequest is received from the CSMS.
	OnGetLog(request *GetLogRequest) (response *GetLogResponse, err error)
}

Needs to be implemented by Charging stations for handling messages part of the OCPP 1.6j security extension.

type GetLogFeature

type GetLogFeature struct{}

The CSMS can request a Charging Station to upload a file with log information to a given location (URL). The format of this log file is not prescribed. The Charging Station responds with GetLogResponse. It then attempts to upload a log file asynchronously and gives information about the status of the upload by sending status notifications to the CSMS.

func (GetLogFeature) GetFeatureName

func (f GetLogFeature) GetFeatureName() string

func (GetLogFeature) GetRequestType

func (f GetLogFeature) GetRequestType() reflect.Type

func (GetLogFeature) GetResponseType

func (f GetLogFeature) GetResponseType() reflect.Type

type GetLogRequest

type GetLogRequest struct {
	LogType       LogType       `json:"logType" validate:"required,logType16"`
	RequestID     int           `json:"requestId" validate:"gte=0"`
	Retries       *int          `json:"retries,omitempty" validate:"omitempty,gte=0"`
	RetryInterval *int          `json:"retryInterval,omitempty" validate:"omitempty,gte=0"`
	Log           LogParameters `json:"log" validate:"required"`
}

The field definition of the GetLog request payload sent by the CSMS to the Charging Station.

func NewGetLogRequest

func NewGetLogRequest(logType LogType, requestID int, logParameters LogParameters) *GetLogRequest

Creates a new GetLogRequest, containing all required fields. Optional fields may be set afterwards.

func (GetLogRequest) GetFeatureName

func (r GetLogRequest) GetFeatureName() string

type GetLogResponse

type GetLogResponse struct {
	Status   LogStatus `json:"status" validate:"required,logStatus16"`          // This field indicates whether the Charging Station was able to accept the request.
	Filename string    `json:"filename,omitempty" validate:"omitempty,max=256"` // This contains the name of the log file that will be uploaded. This field is not present when no logging information is available.
}

This field definition of the GetLog response payload, sent by the Charging Station to the CSMS in response to a GetLogRequest. In case the request was invalid, or couldn't be processed, an error will be sent instead.

func NewGetLogResponse

func NewGetLogResponse(status LogStatus) *GetLogResponse

Creates a new GetLogResponse, containing all required fields. Optional fields may be set afterwards.

func (GetLogResponse) GetFeatureName

func (c GetLogResponse) GetFeatureName() string

type LogParameters

type LogParameters struct {
	RemoteLocation  string          `json:"remoteLocation" validate:"required,max=512,url"`
	OldestTimestamp *types.DateTime `json:"oldestTimestamp,omitempty" validate:"omitempty"`
	LatestTimestamp *types.DateTime `json:"latestTimestamp,omitempty" validate:"omitempty"`
}

LogParameters specifies the requested log and the location to which the log should be sent. It is used in GetLogRequest.

type LogStatus

type LogStatus string

LogStatus represents the status returned by a Charging Station in a GetLogResponse.

type LogStatusNotificationFeature

type LogStatusNotificationFeature struct{}

A Charging Station shall send LogStatusNotification requests to update the CSMS with the current status of a log-upload procedure. The CSMS shall respond with a LogStatusNotificationResponse acknowledging the status update request.

After a successful log upload, the The Charging Station returns to Idle status.

func (LogStatusNotificationFeature) GetFeatureName

func (f LogStatusNotificationFeature) GetFeatureName() string

func (LogStatusNotificationFeature) GetRequestType

func (f LogStatusNotificationFeature) GetRequestType() reflect.Type

func (LogStatusNotificationFeature) GetResponseType

func (f LogStatusNotificationFeature) GetResponseType() reflect.Type

type LogStatusNotificationRequest

type LogStatusNotificationRequest struct {
	Status    UploadLogStatus `json:"status" validate:"required,uploadLogStatus16"`
	RequestID int             `json:"requestId" validate:"gte=0"`
}

The field definition of the LogStatusNotification request payload sent by a Charging Station to the CSMS.

func NewLogStatusNotificationRequest

func NewLogStatusNotificationRequest(status UploadLogStatus, requestID int) *LogStatusNotificationRequest

Creates a new LogStatusNotificationRequest, containing all required fields. There are no optional fields for this message.

func (LogStatusNotificationRequest) GetFeatureName

func (r LogStatusNotificationRequest) GetFeatureName() string

type LogStatusNotificationResponse

type LogStatusNotificationResponse struct {
}

This field definition of the LogStatusNotification response payload, sent by the CSMS to the Charging Station in response to a LogStatusNotificationRequest. In case the request was invalid, or couldn't be processed, an error will be sent instead.

func NewLogStatusNotificationResponse

func NewLogStatusNotificationResponse() *LogStatusNotificationResponse

Creates a new LogStatusNotificationResponse, which doesn't contain any required or optional fields.

func (LogStatusNotificationResponse) GetFeatureName

func (c LogStatusNotificationResponse) GetFeatureName() string

type LogType

type LogType string

LogType represents the type of log file that the Charging Station should send. It is used in GetLogRequest.

type UploadLogStatus

type UploadLogStatus string

UploadLogStatus represents the current status of the log-upload procedure, reported by a Charging Station in a LogStatusNotificationRequest.

const (
	UploadLogStatusBadMessage       UploadLogStatus = "BadMessage"            // A badly formatted packet or other protocol incompatibility was detected.
	UploadLogStatusIdle             UploadLogStatus = "Idle"                  // The Charging Station is not uploading a log file. Idle SHALL only be used when the message was triggered by a TriggerMessageRequest.
	UploadLogStatusNotSupportedOp   UploadLogStatus = "NotSupportedOperation" // The server does not support the operation.
	UploadLogStatusPermissionDenied UploadLogStatus = "PermissionDenied"      // Insufficient permissions to perform the operation.
	UploadLogStatusUploaded         UploadLogStatus = "Uploaded"              // File has been uploaded successfully.
	UploadLogStatusUploadFailure    UploadLogStatus = "UploadFailure"         // Failed to upload the requested file.
	UploadLogStatusUploading        UploadLogStatus = "Uploading"             // File is being uploaded.
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL