OCPP: handle firmware management events (#29507)
This commit is contained in:
parent
dad6cbb303
commit
2d2c953039
2 changed files with 14 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package ocpp
|
|||
|
||||
import (
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/core"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/firmware"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/security"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/types"
|
||||
)
|
||||
|
|
@ -125,3 +126,13 @@ func (cs *CS) OnCertificateSigned(id string, request *security.CertificateSigned
|
|||
Status: security.CertificateSignedStatusAccepted,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (cs *CS) OnFirmwareStatusNotification(id string, request *firmware.FirmwareStatusNotificationRequest) (*firmware.FirmwareStatusNotificationConfirmation, error) {
|
||||
// Acknowledge any firmware status notification
|
||||
return &firmware.FirmwareStatusNotificationConfirmation{}, nil
|
||||
}
|
||||
|
||||
func (cs *CS) OnDiagnosticsStatusNotification(id string, request *firmware.DiagnosticsStatusNotificationRequest) (*firmware.DiagnosticsStatusNotificationConfirmation, error) {
|
||||
// Acknowledge any diagnostics status notification
|
||||
return &firmware.DiagnosticsStatusNotificationConfirmation{}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/lorenzodonini/ocpp-go/ocpp"
|
||||
ocpp16 "github.com/lorenzodonini/ocpp-go/ocpp1.6"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/core"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/firmware"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/remotetrigger"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/security"
|
||||
"github.com/lorenzodonini/ocpp-go/ocpp1.6/smartcharging"
|
||||
|
|
@ -72,7 +73,7 @@ func Instance() *CS {
|
|||
dispatcher := ocppj.NewDefaultServerDispatcher(ocppj.NewFIFOQueueMap(0))
|
||||
dispatcher.SetTimeout(Timeout)
|
||||
|
||||
endpoint := ocppj.NewServer(server, dispatcher, nil, core.Profile, remotetrigger.Profile, smartcharging.Profile, security.Profile)
|
||||
endpoint := ocppj.NewServer(server, dispatcher, nil, core.Profile, remotetrigger.Profile, smartcharging.Profile, security.Profile, firmware.Profile)
|
||||
endpoint.SetInvalidMessageHook(func(client ws.Channel, err *ocpp.Error, rawMessage string, parsedFields []any) *ocpp.Error {
|
||||
log.ERROR.Printf("%v (%s)", err, rawMessage)
|
||||
return nil
|
||||
|
|
@ -92,6 +93,7 @@ func Instance() *CS {
|
|||
|
||||
cs.SetCoreHandler(instance)
|
||||
cs.SetSecurityHandler(instance)
|
||||
cs.SetFirmwareManagementHandler(instance)
|
||||
cs.SetNewChargePointHandler(instance.NewChargePoint)
|
||||
cs.SetChargePointDisconnectedHandler(instance.ChargePointDisconnected)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue