Skip to content

Commit

Permalink
Merge branch 'release/v0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Apr 7, 2023
2 parents 325ff50 + 3f7399c commit 5a35d85
Show file tree
Hide file tree
Showing 41 changed files with 1,820 additions and 1,587 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# eebus-go

[![Build Status](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=main)](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=main)
[![Build Status](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=dev)](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=dev)
[![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4)](https://godoc.org/github.com/enbility/eebus-go)
[![Coverage Status](https://coveralls.io/repos/github/enbility/eebus-go/badge.svg?branch=main)](https://coveralls.io/github/enbility/eebus-go?branch=main)
[![Coverage Status](https://coveralls.io/repos/github/enbility/eebus-go/badge.svg?branch=dev)](https://coveralls.io/github/enbility/eebus-go?branch=dev)
[![Go report](https://goreportcard.com/badge/github.com/enbility/eebus-go)](https://goreportcard.com/report/github.com/enbility/eebus-go)

This library provides a complete foundation for implementing [EEBUS](https://eebus.org) use cases. The use cases define various functional scenarios for different device categories, e.g. energy management systems, charging stations, heat pumps, and more.
Expand Down
72 changes: 4 additions & 68 deletions features/deviceclassification.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@ import (
"github.com/enbility/eebus-go/spine/model"
)

type ManufacturerType struct {
BrandName string
VendorName string
VendorCode string
DeviceName string
DeviceCode string
SerialNumber string
SoftwareRevision string
HardwareRevision string
PowerSource string
ManufacturerNodeIdentification string
ManufacturerLabel string
ManufacturerDescription string
}

type DeviceClassification struct {
*FeatureImpl
}
Expand All @@ -38,22 +23,12 @@ func NewDeviceClassification(localRole, remoteRole model.RoleType, spineLocalDev
}

// request DeviceClassificationManufacturerData from a remote device entity
func (d *DeviceClassification) RequestManufacturerDetailsForEntity() (*model.MsgCounterType, error) {
// request DeviceClassificationManufacturer from a remote entity
msgCounter, err := d.requestData(model.FunctionTypeDeviceClassificationManufacturerData, nil, nil)
if err != nil {
return nil, err
}

return msgCounter, nil
func (d *DeviceClassification) RequestManufacturerDetails() (*model.MsgCounterType, error) {
return d.requestData(model.FunctionTypeDeviceClassificationManufacturerData, nil, nil)
}

// get the current manufacturer details for a remote device entity
func (d *DeviceClassification) GetManufacturerDetails() (*ManufacturerType, error) {
if d.featureRemote == nil {
return nil, ErrDataNotAvailable
}

func (d *DeviceClassification) GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) {
rData := d.featureRemote.Data(model.FunctionTypeDeviceClassificationManufacturerData)
if rData == nil {
return nil, ErrDataNotAvailable
Expand All @@ -64,44 +39,5 @@ func (d *DeviceClassification) GetManufacturerDetails() (*ManufacturerType, erro
return nil, ErrDataNotAvailable
}

details := &ManufacturerType{}

if data.BrandName != nil {
details.BrandName = string(*data.BrandName)
}
if data.VendorName != nil {
details.VendorName = string(*data.VendorName)
}
if data.VendorCode != nil {
details.VendorCode = string(*data.VendorCode)
}
if data.DeviceName != nil {
details.DeviceName = string(*data.DeviceName)
}
if data.DeviceCode != nil {
details.DeviceCode = string(*data.DeviceCode)
}
if data.SerialNumber != nil {
details.SerialNumber = string(*data.SerialNumber)
}
if data.SoftwareRevision != nil {
details.SoftwareRevision = string(*data.SoftwareRevision)
}
if data.HardwareRevision != nil {
details.HardwareRevision = string(*data.HardwareRevision)
}
if data.PowerSource != nil {
details.PowerSource = string(*data.PowerSource)
}
if data.ManufacturerNodeIdentification != nil {
details.ManufacturerNodeIdentification = string(*data.ManufacturerNodeIdentification)
}
if data.ManufacturerLabel != nil {
details.ManufacturerLabel = string(*data.ManufacturerLabel)
}
if data.ManufacturerDescription != nil {
details.ManufacturerDescription = string(*data.ManufacturerDescription)
}

return details, nil
return data, nil
}
4 changes: 2 additions & 2 deletions features/deviceclassification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func (s *DeviceClassificationSuite) BeforeTest(suiteName, testName string) {
assert.NotNil(s.T(), s.deviceClassification)
}

func (s *DeviceClassificationSuite) Test_RequestManufacturerDetailsForEntity() {
counter, err := s.deviceClassification.RequestManufacturerDetailsForEntity()
func (s *DeviceClassificationSuite) Test_RequestManufacturerDetails() {
counter, err := s.deviceClassification.RequestManufacturerDetails()
assert.Nil(s.T(), err)
assert.NotNil(s.T(), counter)
}
Expand Down
Loading

0 comments on commit 5a35d85

Please sign in to comment.