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

Move and update api.ManufacturerData #139

Merged
merged 1 commit into from
Nov 6, 2024
Merged
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
15 changes: 0 additions & 15 deletions api/usecases.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,3 @@ type UseCaseInterface interface {
// add the features
AddFeatures()
}

type ManufacturerData struct {
DeviceName string `json:"deviceName,omitempty"`
DeviceCode string `json:"deviceCode,omitempty"`
SerialNumber string `json:"serialNumber,omitempty"`
SoftwareRevision string `json:"softwareRevision,omitempty"`
HardwareRevision string `json:"hardwareRevision,omitempty"`
VendorName string `json:"vendorName,omitempty"`
VendorCode string `json:"vendorCode,omitempty"`
BrandName string `json:"brandName,omitempty"`
PowerSource string `json:"powerSource,omitempty"`
ManufacturerNodeIdentification string `json:"manufacturerNodeIdentification,omitempty"`
ManufacturerLabel string `json:"manufacturerLabel,omitempty"`
ManufacturerDescription string `json:"manufacturerDescription,omitempty"`
}
2 changes: 1 addition & 1 deletion usecases/api/cem_evcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type CemEVCCInterface interface {
//
// parameters:
// - entity: the entity of the EV
ManufacturerData(entity spineapi.EntityRemoteInterface) (api.ManufacturerData, error)
ManufacturerData(entity spineapi.EntityRemoteInterface) (ManufacturerData, error)

// Scenario 6

Expand Down
2 changes: 1 addition & 1 deletion usecases/api/cem_evsecc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type CemEVSECCInterface interface {
// - entity: the entity of the EV
//
// returns deviceName, serialNumber, error
ManufacturerData(entity spineapi.EntityRemoteInterface) (api.ManufacturerData, error)
ManufacturerData(entity spineapi.EntityRemoteInterface) (ManufacturerData, error)

// the operating state data of an EVSE
//
Expand Down
16 changes: 16 additions & 0 deletions usecases/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ const (
EVChargeStateTypeFinished EVChargeStateType = "finished"
)

// manufacturer data type
type ManufacturerData struct {
DeviceName string
DeviceCode string
SerialNumber string
SoftwareRevision string
HardwareRevision string
VendorName string
VendorCode string
BrandName string
PowerSource string
ManufacturerNodeIdentification string
ManufacturerLabel string
ManufacturerDescription string
}

// Defines a phase specific limit data set
type LoadLimitsPhase struct {
Phase model.ElectricalConnectionPhaseNameType // the phase
Expand Down
4 changes: 2 additions & 2 deletions usecases/cem/evcc/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ func (e *EVCC) Identifications(entity spineapi.EntityRemoteInterface) ([]ucapi.I
func (e *EVCC) ManufacturerData(
entity spineapi.EntityRemoteInterface,
) (
api.ManufacturerData,
ucapi.ManufacturerData,
error,
) {
if !e.IsCompatibleEntityType(entity) {
return api.ManufacturerData{}, api.ErrNoCompatibleEntity
return ucapi.ManufacturerData{}, api.ErrNoCompatibleEntity
}

return internal.ManufacturerData(e.LocalEntity, entity)
Expand Down
5 changes: 3 additions & 2 deletions usecases/cem/evsecc/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package evsecc
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/client"
ucapi "github.com/enbility/eebus-go/usecases/api"
"github.com/enbility/eebus-go/usecases/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
Expand All @@ -13,11 +14,11 @@ import (
func (e *EVSECC) ManufacturerData(
entity spineapi.EntityRemoteInterface,
) (
api.ManufacturerData,
ucapi.ManufacturerData,
error,
) {
if !e.IsCompatibleEntityType(entity) {
return api.ManufacturerData{}, api.ErrNoCompatibleEntity
return ucapi.ManufacturerData{}, api.ErrNoCompatibleEntity
}

return internal.ManufacturerData(e.LocalEntity, entity)
Expand Down
10 changes: 5 additions & 5 deletions usecases/internal/manufacturerdata.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package internal

import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/client"
ucapi "github.com/enbility/eebus-go/usecases/api"
spineapi "github.com/enbility/spine-go/api"
)

Expand All @@ -11,18 +11,18 @@ import (
// possible errors:
// - ErrNoCompatibleEntity if entity is not compatible
// - and others
func ManufacturerData(localEntity spineapi.EntityLocalInterface, entity spineapi.EntityRemoteInterface) (api.ManufacturerData, error) {
func ManufacturerData(localEntity spineapi.EntityLocalInterface, entity spineapi.EntityRemoteInterface) (ucapi.ManufacturerData, error) {
deviceClassification, err := client.NewDeviceClassification(localEntity, entity)
if err != nil {
return api.ManufacturerData{}, err
return ucapi.ManufacturerData{}, err
}

data, err := deviceClassification.GetManufacturerDetails()
if err != nil {
return api.ManufacturerData{}, err
return ucapi.ManufacturerData{}, err
}

ret := api.ManufacturerData{
ret := ucapi.ManufacturerData{
DeviceName: Deref((*string)(data.DeviceName)),
DeviceCode: Deref((*string)(data.DeviceCode)),
SerialNumber: Deref((*string)(data.SerialNumber)),
Expand Down
16 changes: 8 additions & 8 deletions usecases/mocks/CemEVCCInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions usecases/mocks/CemEVSECCInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading