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

🪠 Plumb through notify_charging_limit as a NOP #1

Open
wants to merge 1 commit into
base: set_charging_profile
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions manager/handlers/ocpp201/notify_charging_limit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0

package ocpp201

import (
"context"
"github.com/thoughtworks/maeve-csms/manager/ocpp"
"github.com/thoughtworks/maeve-csms/manager/ocpp/ocpp201"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)

type NotifyChargingLimitHandler struct{}

func (h NotifyChargingLimitHandler) HandleCall(ctx context.Context, chargeStationId string, request ocpp.Request) (response ocpp.Response, err error) {
req := request.(*ocpp201.NotifyChargingLimitRequestJson)

span := trace.SpanFromContext(ctx)

span.SetAttributes(
attribute.String("notify_charging_limit.charging_limit_source", string(req.ChargingLimit.ChargingLimitSource)),
attribute.Int("notify_charging_limit.evse_id", req.EvseId))

return &ocpp201.NotifyChargingLimitResponseJson{}, nil
}
6 changes: 6 additions & 0 deletions manager/handlers/ocpp201/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ func NewRouter(emitter transport.Emitter,
ResponseSchema: "ocpp201/NotifyReportResponse.json",
Handler: NotifyReportHandler{},
},
"NotifyChargingLimit": {
NewRequest: func() ocpp.Request { return new(ocpp201.NotifyChargingLimitRequestJson) },
RequestSchema: "ocpp201/NotifyChargingLimitRequest.json",
ResponseSchema: "ocpp201/NotifyChargingLimitResponse.json",
Handler: NotifyChargingLimitHandler{},
},
"StatusNotification": {
NewRequest: func() ocpp.Request { return new(ocpp201.StatusNotificationRequestJson) },
RequestSchema: "ocpp201/StatusNotificationRequest.json",
Expand Down
34 changes: 34 additions & 0 deletions manager/ocpp/ocpp201/notify_charging_limit_request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: Apache-2.0

package ocpp201

type NotifyChargingLimitRequestJson struct {
// CustomData corresponds to the JSON schema field "customData".
CustomData *CustomDataType `json:"customData,omitempty" yaml:"customData,omitempty" mapstructure:"customData,omitempty"`

// Number of the EVSE on which the limit has been applied.
EvseId int `json:"evseId,omitempty" yaml:"evseId,omitempty" mapstructure:"evseId,omitempty"`
// Number of the EVSE on which the limit has been applied.
ChargingLimit ChargingLimitType `json:"chargingLimit,omitempty" yaml:"chargingLimit,omitempty" mapstructure:"chargingLimit,omitempty"`

// ChargingSchedule corresponds to the JSON schema field "chargingSchedule".
ChargingSchedule []ChargingScheduleType `json:"chargingSchedule" yaml:"chargingSchedule" mapstructure:"chargingSchedule"`
}

func (*NotifyChargingLimitRequestJson) IsRequest() {}

type ChargingLimitSourceEnumType string

const ChargingLimitSourceEnumEMS ChargingLimitSourceEnumType = "EMS"
const ChargingLimitSourceEnumOther ChargingLimitSourceEnumType = "Other"
const ChargingLimitSourceEnumSO ChargingLimitSourceEnumType = "SO"
const ChargingLimitSourceEnumCSO ChargingLimitSourceEnumType = "CSO"

type ChargingLimitType struct {
// CustomData corresponds to the JSON schema field "customData".
CustomData *CustomDataType `json:"customData,omitempty" yaml:"customData,omitempty" mapstructure:"customData,omitempty"`

ChargingLimitSource BootReasonEnumType `json:"chargingLimitSource" yaml:"chargingLimitSource" mapstructure:"chargingLimitSource"`

IsGridCritical bool `json:"isGridCritical,omitempty" yaml:"isGridCritical,omitempty" mapstructure:"isGridCritical,omitempty"`
}
11 changes: 11 additions & 0 deletions manager/ocpp/ocpp201/notify_charging_limit_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: Apache-2.0

package ocpp201

type NotifyChargingLimitResponseJson struct {
// CustomData corresponds to the JSON schema field "customData".
CustomData *CustomDataType `json:"customData,omitempty" yaml:"customData,omitempty" mapstructure:"customData,omitempty"`
}

func (*NotifyChargingLimitResponseJson) IsResponse() {}