Skip to content

Commit

Permalink
Merge branch 'release/v0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Jun 29, 2024
2 parents 116a560 + 7e2d86a commit 0939b60
Show file tree
Hide file tree
Showing 306 changed files with 49,347 additions and 3,112 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ jobs:
uses: golangci/golangci-lint-action@master
with:
version: latest
skip-pkg-cache: true
skip-build-cache: true
skip-cache: true
skip-save-cache: true
args: --timeout=3m --issues-exit-code=0 ./...

- name: Test
run: go test -race -v -coverprofile=coverage_temp.out -covermode=atomic ./...

- name: Remove mocks and cmd from coverage
run: grep -v -e "/eebus-go/mocks/" -e "/eebus-go/cmd/" coverage_temp.out > coverage.out
run: grep -v -e "/eebus-go/mocks/" -e "/eebus-go/usecases/mocks/" -e "/eebus-go/cmd/" coverage_temp.out > coverage.out

- name: Send coverage
uses: coverallsapp/github-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ filename: "{{.InterfaceName}}.go"
all: True
packages:
github.com/enbility/eebus-go/api:
github.com/enbility/eebus-go/features:
github.com/enbility/eebus-go/usecases/api:
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ The supported functionality contains:
## Packages

- `api`: global API interface definitions and eebus service configuration
- `features`: provides feature helpers with the local SPINE feature having the client role and the remote SPINE feature being the server for easy access to commonly used functions
- `features/client`: provides feature helpers with the local SPINE feature having the client role and the remote SPINE feature being the server for easy access to commonly used functions
- `features/server`: provides feature helpers with the local SPINE feature having the server role for easy access to commonly used functions
- `service`: central package which provides access to SHIP and SPINE. Use this to create the EEBUS service, its configuration and connect to remote EEBUS services
- `util`: package with various useful helper functions
- `usecases`: containing actor and use case based implementations with use case scenario based APIs and events

## Usage

Expand Down
3 changes: 3 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type ServiceInterface interface {
// shutdown the service
Shutdown()

// add a use case to the service
AddUseCase(useCase UseCaseInterface)

// set logging interface
SetLogging(logger logging.LoggingInterface)

Expand Down
4 changes: 4 additions & 0 deletions api/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ var ErrFunctionNotSupported = errors.New("function is not supported")
var ErrOperationOnFunctionNotSupported = errors.New("operation is not supported on function")

var ErrMissingData = errors.New("missing data")

var ErrDeviceDisconnected = errors.New("device is disconnected")

var ErrNoCompatibleEntity = errors.New("no compatible entity")
244 changes: 244 additions & 0 deletions api/features.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
package api

import (
"time"

"github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)

// Feature client interface were the local feature role is client and the remote feature role is server
type FeatureClientInterface interface {
// check if there is a subscription to the remote feature
HasSubscription() bool

// subscribe to the feature of the entity
Subscribe() (*model.MsgCounterType, error)

// check if there is a binding to the remote feature
HasBinding() bool

// bind to the feature of the entity
Bind() (*model.MsgCounterType, error)

// add a callback function to be invoked once a result or reply message for a msgCounter came in
AddResponseCallback(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error

// add a callback function to be invoked once a result came in
AddResultCallback(function func(msg api.ResponseMessage))
}

// Feature server interface were the local feature role is a server
type FeatureServerInterface interface {
}

// Common interface for DeviceClassificationClientInterface and DeviceClassificationServerInterface
type DeviceClassificationCommonInterface interface {
// get the current manufacturer details for a remote device entity
GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error)
}

// Common interface for DeviceConfigurationClientInterface and DeviceConfigurationServerInterface
type DeviceConfigurationCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.DeviceConfigurationKeyValueListDataType,
// filter type will be checked for model.DeviceConfigurationKeyValueDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool

// Get the description for a given keyId
//
// Will return nil if no matching description was found
GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)

// Get the description for a given value combination
//
// Returns an error if no matching description was found
GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)

// Get the key value data for a given keyId
//
// Will return nil if no matching data was found
GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)

// Get key value data for a given filter
//
// Will return nil if no matching data was found
GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)
}

// Common interface for DeviceDiagnosisClientInterface and DeviceDiagnosisServerInterface
type DeviceDiagnosisCommonInterface interface {
// get the current diagnosis state for an device entity
GetState() (*model.DeviceDiagnosisStateDataType, error)

// check if the currently available heartbeat data is within a time duration
IsHeartbeatWithinDuration(duration time.Duration) bool
}

// Common interface for ElectricalConnectionClientInterface and ElectricalConnectionServerInterface
type ElectricalConnectionCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.ElectricalConnectionPermittedValueSetListDataType,
// filter type will be checked for model.ElectricalConnectionParameterDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool

// Get the description for a given filter
//
// Returns an error if no matching description is found
GetDescriptionsForFilter(
filter model.ElectricalConnectionDescriptionDataType,
) ([]model.ElectricalConnectionDescriptionDataType, error)

// Get the description for a given parameter description
//
// Returns an error if no matching description is found
GetDescriptionForParameterDescriptionFilter(
filter model.ElectricalConnectionParameterDescriptionDataType) (
*model.ElectricalConnectionDescriptionDataType, error)

// Get the description for a given filter
//
// Returns an error if no matching description is found
GetParameterDescriptionsForFilter(
filter model.ElectricalConnectionParameterDescriptionDataType,
) ([]model.ElectricalConnectionParameterDescriptionDataType, error)

// return permitted values for all Electrical Connections
GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
[]model.ElectricalConnectionPermittedValueSetDataType, error)

// returns minimum, maximum, default/pause limit values
GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
float64, float64, float64, error)

// Get the min, max, default current limits for each phase
GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) (
resultMin []float64, resultMax []float64, resultDefault []float64, resultErr error)

// Adjust a value to be within the permitted value range
AdjustValueToBeWithinPermittedValuesForParameterId(
value float64, parameterId model.ElectricalConnectionParameterIdType) float64

// Get the characteristics for a given filter
//
// Returns an error if no matching description is found
GetCharacteristicsForFilter(
filter model.ElectricalConnectionCharacteristicDataType,
) ([]model.ElectricalConnectionCharacteristicDataType, error)
}

// Common interface for LoadControlClientInterface and LoadControlServerInterface
type LoadControlCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.LoadControlLimitListDataType,
// filter type will be checked for model.LoadControlLimitDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool

// Get the description for a given limitId
//
// Will return nil if no matching description is found
GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (
*model.LoadControlLimitDescriptionDataType, error)

// Get the description for a given filter
//
// Returns an error if no matching description is found
GetLimitDescriptionsForFilter(
filter model.LoadControlLimitDescriptionDataType,
) ([]model.LoadControlLimitDescriptionDataType, error)

// Get the description for a given limitId
//
// Will return nil if no data is available
GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)

// Get limit data for a given filter
//
// Will return nil if no data is available
GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)
}

// Common interface for MeasurementClientInterface and MeasurementServerInterface
type MeasurementCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.MeasurementListDataType,
// filter type will be checked for model.MeasurementDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool

// Get the description for a given id
//
// Returns an error if no matching description is found
GetDescriptionForId(
measurementId model.MeasurementIdType,
) (*model.MeasurementDescriptionDataType, error)

// Get the description for a given filter
//
// Returns an error if no matching description is found
GetDescriptionsForFilter(
filter model.MeasurementDescriptionDataType,
) ([]model.MeasurementDescriptionDataType, error)

// Get the constraints for a given filter
//
// Returns an error if no matching constraint is found
GetConstraintsForFilter(
filter model.MeasurementConstraintsDataType,
) ([]model.MeasurementConstraintsDataType, error)

// Get the measuement data for a given measurementId
//
// Will return nil if no data is available
GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error)

// Get measuement data for a given filter
//
// Will return nil if no data is available
GetDataForFilter(filter model.MeasurementDescriptionDataType) (
[]model.MeasurementDataType, error)
}

// Common interface for IdentificationClientInterface and IdentificationServerInterface
type IdentificationCommonInterface interface {
// check if spine.EventPayload Data contains identification data
//
// data type will be checked for model.IdentificationListDataType
CheckEventPayloadDataForFilter(payloadData any) bool

// return current values for Identification
GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error)
}

// Common interface for IncentiveTableClientInterface and IncentiveTableServerInterface
type IncentiveTableCommonInterface interface {
// return list of descriptions for a given filter
GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)

// return list of constraints
GetConstraints() ([]model.IncentiveTableConstraintsType, error)

// return current data for Time Series
GetData() ([]model.IncentiveTableType, error)
}

// Common interface for SmartEnergyManagementPsClientInterface and SmartEnergyManagementPsServerInterface
type SmartEnergyManagementPsCommonInterface interface {
// return current data for FunctionTypeSmartEnergyManagementPsData
GetData() (*model.SmartEnergyManagementPsDataType, error)
}

// Common interface for TimeSeriesClientInterface and TimeSeriesServerInterface
type TimeSeriesCommonInterface interface {
// return list of descriptions for a given filter
GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)

// return current constraints for Time Series
GetConstraints() ([]model.TimeSeriesConstraintsDataType, error)

// return current data for Time Series for a given filter
GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)
}
Loading

0 comments on commit 0939b60

Please sign in to comment.