From c12c095c9432d4fc8152af50c0196410846f862c Mon Sep 17 00:00:00 2001 From: dwibudut Date: Wed, 18 Sep 2024 09:07:58 +0700 Subject: [PATCH] add required field on GetInstalledCertificateIdsRequest constructor --- ocpp1.6/central_system.go | 4 ++-- ocpp1.6/certificates/get_installed_certificates.go | 4 ++-- ocpp1.6/v16.go | 3 ++- ocppj/server.go | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ocpp1.6/central_system.go b/ocpp1.6/central_system.go index ef032021..d6818fec 100644 --- a/ocpp1.6/central_system.go +++ b/ocpp1.6/central_system.go @@ -383,8 +383,8 @@ func (cs *centralSystem) SignedUpdateFirmware(clientId string, callback func(*se return cs.SendRequestAsync(clientId, request, genericCallback) } -func (cs *centralSystem) GetInstalledCertificateIds(clientId string, callback func(*certificates.GetInstalledCertificateIdsResponse, error), props ...func(request *certificates.GetInstalledCertificateIdsRequest)) error { - request := certificates.NewGetInstalledCertificateIdsRequest() +func (cs *centralSystem) GetInstalledCertificateIds(clientId string, callback func(*certificates.GetInstalledCertificateIdsResponse, error), certificateType types.CertificateUse, props ...func(request *certificates.GetInstalledCertificateIdsRequest)) error { + request := certificates.NewGetInstalledCertificateIdsRequest(certificateType) for _, fn := range props { fn(request) } diff --git a/ocpp1.6/certificates/get_installed_certificates.go b/ocpp1.6/certificates/get_installed_certificates.go index 136958e8..fd494a2f 100644 --- a/ocpp1.6/certificates/get_installed_certificates.go +++ b/ocpp1.6/certificates/get_installed_certificates.go @@ -66,8 +66,8 @@ func (c GetInstalledCertificateIdsResponse) GetFeatureName() string { } // Creates a new GetInstalledCertificateIdsRequest, containing all required fields. There are no optional fields for this message. -func NewGetInstalledCertificateIdsRequest() *GetInstalledCertificateIdsRequest { - return &GetInstalledCertificateIdsRequest{} +func NewGetInstalledCertificateIdsRequest(certificateType types.CertificateUse) *GetInstalledCertificateIdsRequest { + return &GetInstalledCertificateIdsRequest{CertificateType: certificateType} } // Creates a new NewGetInstalledCertificateIdsResponse, containing all required fields. Additional optional fields may be set afterwards. diff --git a/ocpp1.6/v16.go b/ocpp1.6/v16.go index 5395db2c..46421cb3 100644 --- a/ocpp1.6/v16.go +++ b/ocpp1.6/v16.go @@ -271,13 +271,14 @@ type CentralSystem interface { ClearChargingProfile(clientId string, callback func(*smartcharging.ClearChargingProfileConfirmation, error), props ...func(request *smartcharging.ClearChargingProfileRequest)) error // Queries a charge point to the composite smart charging schedules and rules for a specified time interval. GetCompositeSchedule(clientId string, callback func(*smartcharging.GetCompositeScheduleConfirmation, error), connectorId int, duration int, props ...func(request *smartcharging.GetCompositeScheduleRequest)) error + TriggerMessageExtended(clientId string, callback func(*extendedtriggermessage.ExtendedTriggerMessageResponse, error), requestedMessage extendedtriggermessage.ExtendedTriggerMessageType, props ...func(request *extendedtriggermessage.ExtendedTriggerMessageRequest)) error CertificateSigned(clientId string, callback func(*security.CertificateSignedResponse, error), csr string, props ...func(request *security.CertificateSignedRequest)) error InstallCertificate(clientId string, callback func(*certificates.InstallCertificateResponse, error), certificateType types.CertificateUse, certificate string, props ...func(request *certificates.InstallCertificateRequest)) error - GetInstalledCertificateIds(clientId string, callback func(*certificates.GetInstalledCertificateIdsResponse, error), props ...func(request *certificates.GetInstalledCertificateIdsRequest)) error + GetInstalledCertificateIds(clientId string, callback func(*certificates.GetInstalledCertificateIdsResponse, error), certificateType types.CertificateUse, props ...func(request *certificates.GetInstalledCertificateIdsRequest)) error DeleteCertificate(clientId string, callback func(*certificates.DeleteCertificateResponse, error), certificateHashData types.CertificateHashData, props ...func(request *certificates.DeleteCertificateRequest)) error diff --git a/ocppj/server.go b/ocppj/server.go index 09abf63a..1653e9cb 100644 --- a/ocppj/server.go +++ b/ocppj/server.go @@ -226,6 +226,7 @@ func (s *Server) SendError(clientID string, requestId string, errorCode ocpp.Err return ocpp.NewError(GenericError, err.Error(), requestId) } log.Debugf("sent CALL ERROR [%s] for %s", callError.UniqueId, clientID) + log.Debugf("sent JSON message to %s: %s", clientID, string(jsonMessage)) return nil }