Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firmware Status Notification #213

Closed
MattGrouchy opened this issue Jul 26, 2023 · 2 comments
Closed

Firmware Status Notification #213

MattGrouchy opened this issue Jul 26, 2023 · 2 comments

Comments

@MattGrouchy
Copy link

The OCPP 2.0.1 ID L02.FR.06:

Every FirmwareStatusNotificationRequest sent
for a firmware update SHALL contain the same
requestId as the UpdateFirmwareRequest that
started this firmware update.

How can I provide the requestId to the ChargingStation.FirmwareStatusNotification method?

@lorenzodonini
Copy link
Owner

The RequestID field is optional and may be set in one of two ways.

Option 1

cs := ocpp2.NewChargingStation(...)
someRequestID := 42
resp, err := cs.FirmwareStatusNotification(firmware.FirmwareStatusDownloading, func(request *firmware.FirmwareStatusNotificationRequest) {
    request.RequestID = &someRequestID
})
// Handle response/error

Option 2

cs := ocpp2.NewChargingStation(...)
someRequestID := 42
req := firmware.NewFirmwareStatusNotificationRequest(firmware.FirmwareStatusDownloading)
req.RequestID = &someRequestID
resp, err := cs.SendRequest(req)
// Handle response/error

The approach via variadic function paramter holds true for setting every optional field.

Does this answer your question?

@MattGrouchy
Copy link
Author

Yes, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants