firmware

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: 4 Imported by: 0

Documentation

Overview

The firmware functional block contains OCPP 2.0 features that enable firmware updates on a charging station.

Index

Constants

View Source
const FirmwareStatusNotificationFeatureName = "FirmwareStatusNotification"
View Source
const ProfileName = "firmware"
View Source
const PublishFirmwareFeatureName = "PublishFirmware"
View Source
const PublishFirmwareStatusNotificationFeatureName = "PublishFirmwareStatusNotification"
View Source
const UnpublishFirmwareFeatureName = "UnpublishFirmware"
View Source
const UpdateFirmwareFeatureName = "UpdateFirmware"

Variables

Functions

This section is empty.

Types

type CSMSHandler

type CSMSHandler interface {
	// OnFirmwareStatusNotification is called on the CSMS whenever a FirmwareStatusNotificationRequest is received from a charging station.
	OnFirmwareStatusNotification(chargingStationID string, request *FirmwareStatusNotificationRequest) (response *FirmwareStatusNotificationResponse, err error)
	// OnPublishFirmwareStatusNotification is called on the CSMS whenever a PublishFirmwareStatusNotificationRequest is received from a local controller.
	OnPublishFirmwareStatusNotification(chargingStationID string, request *PublishFirmwareStatusNotificationRequest) (response *PublishFirmwareStatusNotificationResponse, err error)
}

Needs to be implemented by a CSMS for handling messages part of the OCPP 2.0 Firmware profile.

type ChargingStationHandler

type ChargingStationHandler interface {
	// OnPublishFirmware is called on a charging station whenever a PublishFirmwareRequest is received from the CSMS.
	OnPublishFirmware(request *PublishFirmwareRequest) (response *PublishFirmwareResponse, err error)
	// OnUnpublishFirmware is called on a charging station whenever a UnpublishFirmwareRequest is received from the CSMS.
	OnUnpublishFirmware(request *UnpublishFirmwareRequest) (response *UnpublishFirmwareResponse, err error)
	// OnUpdateFirmware is called on a charging station whenever a UpdateFirmwareRequest is received from the CSMS.
	OnUpdateFirmware(request *UpdateFirmwareRequest) (response *UpdateFirmwareResponse, err error)
}

Needs to be implemented by Charging stations for handling messages part of the OCPP 2.0 Firmware profile.

type Firmware

type Firmware struct {
	Location           string          `json:"location" validate:"required,max=512,uri"`         // URI defining the origin of the firmware.
	RetrieveDateTime   *types.DateTime `json:"retrieveDateTime" validate:"required"`             // Date and time at which the firmware shall be retrieved.
	InstallDateTime    *types.DateTime `json:"installDateTime,omitempty" validate:"omitempty"`   // Date and time at which the firmware shall be installed.
	SigningCertificate string          `json:"signingCertificate,omitempty" validate:"max=5500"` // Certificate with which the firmware was signed. PEM encoded X.509 certificate.
	Signature          string          `json:"signature,omitempty" validate:"max=800"`           // Base64 encoded firmware signature.
}

Represents a copy of the firmware that can be loaded/updated on the Charging Station.

type FirmwareStatus

type FirmwareStatus string

Status reported in FirmwareStatusNotificationRequest.

const (
	FirmwareStatusDownloaded                FirmwareStatus = "Downloaded"
	FirmwareStatusDownloadFailed            FirmwareStatus = "DownloadFailed"
	FirmwareStatusDownloading               FirmwareStatus = "Downloading"
	FirmwareStatusDownloadScheduled         FirmwareStatus = "DownloadScheduled"
	FirmwareStatusDownloadPaused            FirmwareStatus = "DownloadPaused"
	FirmwareStatusIdle                      FirmwareStatus = "Idle"
	FirmwareStatusInstallationFailed        FirmwareStatus = "InstallationFailed"
	FirmwareStatusInstalling                FirmwareStatus = "Installing"
	FirmwareStatusInstalled                 FirmwareStatus = "Installed"
	FirmwareStatusInstallRebooting          FirmwareStatus = "InstallRebooting"
	FirmwareStatusInstallScheduled          FirmwareStatus = "InstallScheduled"
	FirmwareStatusInstallVerificationFailed FirmwareStatus = "InstallVerificationFailed"
	FirmwareStatusInvalidSignature          FirmwareStatus = "InvalidSignature"
	FirmwareStatusSignatureVerified         FirmwareStatus = "SignatureVerified"
)

type FirmwareStatusNotificationFeature

type FirmwareStatusNotificationFeature struct{}

The Charging Station sends a notification to inform the CSMS about the progress of the downloading and installation of a firmware update. The Charging Station SHALL only send the status Idle after receipt of a TriggerMessage for a Firmware Status Notification, when it is not busy downloading/installing firmware. The FirmwareStatusNotification requests SHALL be sent to keep the CSMS updated with the status of the update process.

func (FirmwareStatusNotificationFeature) GetFeatureName

func (f FirmwareStatusNotificationFeature) GetFeatureName() string

func (FirmwareStatusNotificationFeature) GetRequestType

func (f FirmwareStatusNotificationFeature) GetRequestType() reflect.Type

func (FirmwareStatusNotificationFeature) GetResponseType

func (f FirmwareStatusNotificationFeature) GetResponseType() reflect.Type

type FirmwareStatusNotificationRequest

type FirmwareStatusNotificationRequest struct {
	Status    FirmwareStatus `json:"status" validate:"required,firmwareStatus201"`
	RequestID *int           `json:"requestId,omitempty" validate:"omitempty,gte=0"`
}

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

func NewFirmwareStatusNotificationRequest

func NewFirmwareStatusNotificationRequest(status FirmwareStatus) *FirmwareStatusNotificationRequest

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

func (FirmwareStatusNotificationRequest) GetFeatureName

func (r FirmwareStatusNotificationRequest) GetFeatureName() string

type FirmwareStatusNotificationResponse

type FirmwareStatusNotificationResponse struct {
}

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

func NewFirmwareStatusNotificationResponse

func NewFirmwareStatusNotificationResponse() *FirmwareStatusNotificationResponse

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

func (FirmwareStatusNotificationResponse) GetFeatureName

func (c FirmwareStatusNotificationResponse) GetFeatureName() string

type PublishFirmwareFeature

type PublishFirmwareFeature struct{}

The CSMS sends a PublishFirmwareRequest to instruct the Local Controller to download and publish the firmware, including an MD5 checksum of the firmware file. Upon receipt of PublishFirmwareRequest, the Local Controller responds with PublishFirmwareResponse.

The local controller will download the firmware out-of-band and publish the URI of the updated firmware to the CSMS via a PublishFirmwareStatusNotificationRequest.

Whenever the CSMS instructs charging stations to update their firmware, it will instruct to download the firmware form the local controller instead of from the CSMS, saving data and bandwidth on the WAN interface.

func (PublishFirmwareFeature) GetFeatureName

func (f PublishFirmwareFeature) GetFeatureName() string

func (PublishFirmwareFeature) GetRequestType

func (f PublishFirmwareFeature) GetRequestType() reflect.Type

func (PublishFirmwareFeature) GetResponseType

func (f PublishFirmwareFeature) GetResponseType() reflect.Type

type PublishFirmwareRequest

type PublishFirmwareRequest struct {
	Location      string `json:"location" validate:"required,max=512"`               // This contains a string containing a URI pointing to a location from which to retrieve the firmware.
	Retries       *int   `json:"retries,omitempty" validate:"omitempty,gte=0"`       // This specifies how many times Charging Station must try to download the firmware before giving up. If this field is not present, it is left to Charging Station to decide how many times it wants to retry.
	Checksum      string `json:"checksum" validate:"required,max=32"`                // The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
	RequestID     int    `json:"requestId" validate:"gte=0"`                         // The Id of the request.
	RetryInterval *int   `json:"retryInterval,omitempty" validate:"omitempty,gte=0"` // The interval in seconds after which a retry may be attempted. If this field is not present, it is left to Charging Station to decide how long to wait between attempts.
}

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

func NewPublishFirmwareRequest

func NewPublishFirmwareRequest(location string, checksum string, requestID int) *PublishFirmwareRequest

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

func (PublishFirmwareRequest) GetFeatureName

func (r PublishFirmwareRequest) GetFeatureName() string

type PublishFirmwareResponse

type PublishFirmwareResponse struct {
	Status     types.GenericStatus `json:"status" validate:"required,genericStatus"`
	StatusInfo *types.StatusInfo   `json:"statusInfo,omitempty" validate:"omitempty"`
}

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

func NewPublishFirmwareResponse

func NewPublishFirmwareResponse(status types.GenericStatus) *PublishFirmwareResponse

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

func (PublishFirmwareResponse) GetFeatureName

func (c PublishFirmwareResponse) GetFeatureName() string

type PublishFirmwareStatus

type PublishFirmwareStatus string

Status reported in PublishFirmwareStatusNotificationRequest.

const (
	PublishFirmwareStatusIdle              PublishFirmwareStatus = "Idle"
	PublishFirmwareStatusDownloadScheduled PublishFirmwareStatus = "DownloadScheduled"
	PublishFirmwareStatusDownloading       PublishFirmwareStatus = "Downloading"
	PublishFirmwareStatusDownloaded        PublishFirmwareStatus = "Downloaded"
	PublishFirmwareStatusPublished         PublishFirmwareStatus = "Published"
	PublishFirmwareStatusDownloadFailed    PublishFirmwareStatus = "DownloadFailed"
	PublishFirmwareStatusDownloadPaused    PublishFirmwareStatus = "DownloadPaused"
	PublishFirmwareStatusInvalidChecksum   PublishFirmwareStatus = "InvalidChecksum"
	PublishFirmwareStatusChecksumVerified  PublishFirmwareStatus = "ChecksumVerified"
	PublishFirmwareStatusPublishFailed     PublishFirmwareStatus = "PublishFailed"
)

type PublishFirmwareStatusNotificationFeature

type PublishFirmwareStatusNotificationFeature struct{}

The local controller sends a PublishFirmwareStatusNotificationRequest to inform the CSMS about the current PublishFirmware status. If the firmware was published correctly, the request will contain the location(s) URI(s) where the firmware was published at.

The CSMS responds to each request with a PublishFirmwareStatusNotificationResponse.

func (PublishFirmwareStatusNotificationFeature) GetFeatureName

func (PublishFirmwareStatusNotificationFeature) GetRequestType

func (PublishFirmwareStatusNotificationFeature) GetResponseType

type PublishFirmwareStatusNotificationRequest

type PublishFirmwareStatusNotificationRequest struct {
	Status PublishFirmwareStatus `json:"status" validate:"required,publishFirmwareStatus"` // This contains the progress status of the publishfirmware installation.
	//TODO: add required_if validation tag after upgrade to govalidator v10
	Location  []string `json:"location,omitempty" validate:"omitempty,dive,max=512"` // Can be multiple URI’s, if the Local Controller supports e.g. HTTP, HTTPS, and FTP.
	RequestID *int     `json:"requestId,omitempty" validate:"omitempty,gte=0"`       // The request id that was provided in the PublishFirmwareRequest which triggered this action.
}

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

func NewPublishFirmwareStatusNotificationRequest

func NewPublishFirmwareStatusNotificationRequest(status PublishFirmwareStatus) *PublishFirmwareStatusNotificationRequest

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

func (PublishFirmwareStatusNotificationRequest) GetFeatureName

type PublishFirmwareStatusNotificationResponse

type PublishFirmwareStatusNotificationResponse struct {
}

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

func NewPublishFirmwareStatusNotificationResponse

func NewPublishFirmwareStatusNotificationResponse() *PublishFirmwareStatusNotificationResponse

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

func (PublishFirmwareStatusNotificationResponse) GetFeatureName

type UnpublishFirmwareFeature

type UnpublishFirmwareFeature struct{}

Allows to stop a Local Controller from publishing a firmware update to connected Charging Stations. The CSMS sends an UnpublishFirmwareRequest to instruct the local controller to unpublish the firmware. The local controller unpublishes the firmware, then responds with an UnpublishFirmwareResponse.

func (UnpublishFirmwareFeature) GetFeatureName

func (f UnpublishFirmwareFeature) GetFeatureName() string

func (UnpublishFirmwareFeature) GetRequestType

func (f UnpublishFirmwareFeature) GetRequestType() reflect.Type

func (UnpublishFirmwareFeature) GetResponseType

func (f UnpublishFirmwareFeature) GetResponseType() reflect.Type

type UnpublishFirmwareRequest

type UnpublishFirmwareRequest struct {
	Checksum string `json:"checksum" validate:"required,max=32"` // The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
}

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

func NewUnpublishFirmwareRequest

func NewUnpublishFirmwareRequest(checksum string) *UnpublishFirmwareRequest

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

func (UnpublishFirmwareRequest) GetFeatureName

func (r UnpublishFirmwareRequest) GetFeatureName() string

type UnpublishFirmwareResponse

type UnpublishFirmwareResponse struct {
	Status UnpublishFirmwareStatus `json:"status" validate:"required,unpublishFirmwareStatus"`
}

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

func NewUnpublishFirmwareResponse

func NewUnpublishFirmwareResponse(status UnpublishFirmwareStatus) *UnpublishFirmwareResponse

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

func (UnpublishFirmwareResponse) GetFeatureName

func (c UnpublishFirmwareResponse) GetFeatureName() string

type UnpublishFirmwareStatus

type UnpublishFirmwareStatus string

Status for when stopping to publish a Firmware.

const (
	UnpublishFirmwareStatusDownloadOngoing UnpublishFirmwareStatus = "DownloadOngoing" // Intermediate state. Firmware is being downloaded.
	UnpublishFirmwareStatusNoFirmware      UnpublishFirmwareStatus = "NoFirmware"      // There is no published file.
	UnpublishFirmwareStatusUnpublished     UnpublishFirmwareStatus = "Unpublished"     // Successful end state. Firmware file no longer being published.
)

type UpdateFirmwareFeature

type UpdateFirmwareFeature struct{}

A CSMS may instruct a Charging Station to update its firmware, by downloading and installing a new version. The CSMS sends an UpdateFirmwareRequest message that contains the location of the firmware, the time after which it should be retrieved, and information on how many times the Charging Station should retry downloading the firmware.

The Charging station responds with an UpdateFirmwareResponse and then starts downloading the firmware. During the download/install procedure, the charging station shall notify the CSMS of its current status by sending FirmwareStatusNotification messages.

func (UpdateFirmwareFeature) GetFeatureName

func (f UpdateFirmwareFeature) GetFeatureName() string

func (UpdateFirmwareFeature) GetRequestType

func (f UpdateFirmwareFeature) GetRequestType() reflect.Type

func (UpdateFirmwareFeature) GetResponseType

func (f UpdateFirmwareFeature) GetResponseType() reflect.Type

type UpdateFirmwareRequest

type UpdateFirmwareRequest struct {
	Retries       *int     `json:"retries,omitempty" validate:"omitempty,gte=0"`       // This specifies how many times Charging Station must try to download the firmware before giving up. If this field is not present, it is left to Charging Station to decide how many times it wants to retry.
	RetryInterval *int     `json:"retryInterval,omitempty" validate:"omitempty,gte=0"` // The interval in seconds after which a retry may be attempted. If this field is not present, it is left to Charging Station to decide how long to wait between attempts.
	RequestID     int      `json:"requestId" validate:"gte=0"`                         // The Id of the request.
	Firmware      Firmware `json:"firmware" validate:"required"`                       // Specifies the firmware to be updated on the Charging Station.
}

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

func NewUpdateFirmwareRequest

func NewUpdateFirmwareRequest(requestID int, firmware Firmware) *UpdateFirmwareRequest

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

func (UpdateFirmwareRequest) GetFeatureName

func (r UpdateFirmwareRequest) GetFeatureName() string

type UpdateFirmwareResponse

type UpdateFirmwareResponse struct {
	Status     UpdateFirmwareStatus `json:"status" validate:"required,updateFirmwareStatus"`
	StatusInfo *types.StatusInfo    `json:"statusInfo,omitempty" validate:"omitempty"`
}

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

func NewUpdateFirmwareResponse

func NewUpdateFirmwareResponse(status UpdateFirmwareStatus) *UpdateFirmwareResponse

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

func (UpdateFirmwareResponse) GetFeatureName

func (c UpdateFirmwareResponse) GetFeatureName() string

type UpdateFirmwareStatus

type UpdateFirmwareStatus string

Indicates whether the Charging Station was able to accept the request.

const (
	UpdateFirmwareStatusAccepted           UpdateFirmwareStatus = "Accepted"
	UpdateFirmwareStatusRejected           UpdateFirmwareStatus = "Rejected"
	UpdateFirmwareStatusAcceptedCanceled   UpdateFirmwareStatus = "AcceptedCanceled"
	UpdateFirmwareStatusInvalidCertificate UpdateFirmwareStatus = "InvalidCertificate"
	UpdateFirmwareStatusRevokedCertificate UpdateFirmwareStatus = "RevokedCertificate"
)

Jump to

Keyboard shortcuts

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