Skip to content

Commit 0939b60

Browse files
committed
Merge branch 'release/v0.6.0'
2 parents 116a560 + 7e2d86a commit 0939b60

File tree

306 files changed

+49347
-3112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+49347
-3112
lines changed

.github/workflows/default.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ jobs:
3232
uses: golangci/golangci-lint-action@master
3333
with:
3434
version: latest
35-
skip-pkg-cache: true
36-
skip-build-cache: true
35+
skip-cache: true
36+
skip-save-cache: true
3737
args: --timeout=3m --issues-exit-code=0 ./...
3838

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

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

4545
- name: Send coverage
4646
uses: coverallsapp/github-action@v2

.mockery.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ filename: "{{.InterfaceName}}.go"
77
all: True
88
packages:
99
github.com/enbility/eebus-go/api:
10-
github.com/enbility/eebus-go/features:
10+
github.com/enbility/eebus-go/usecases/api:

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ The supported functionality contains:
2424
## Packages
2525

2626
- `api`: global API interface definitions and eebus service configuration
27-
- `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
27+
- `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
28+
- `features/server`: provides feature helpers with the local SPINE feature having the server role for easy access to commonly used functions
2829
- `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
29-
- `util`: package with various useful helper functions
30+
- `usecases`: containing actor and use case based implementations with use case scenario based APIs and events
3031

3132
## Usage
3233

api/api.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ type ServiceInterface interface {
2424
// shutdown the service
2525
Shutdown()
2626

27+
// add a use case to the service
28+
AddUseCase(useCase UseCaseInterface)
29+
2730
// set logging interface
2831
SetLogging(logger logging.LoggingInterface)
2932

api/errors.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ var ErrFunctionNotSupported = errors.New("function is not supported")
2323
var ErrOperationOnFunctionNotSupported = errors.New("operation is not supported on function")
2424

2525
var ErrMissingData = errors.New("missing data")
26+
27+
var ErrDeviceDisconnected = errors.New("device is disconnected")
28+
29+
var ErrNoCompatibleEntity = errors.New("no compatible entity")

api/features.go

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
package api
2+
3+
import (
4+
"time"
5+
6+
"github.com/enbility/spine-go/api"
7+
"github.com/enbility/spine-go/model"
8+
)
9+
10+
// Feature client interface were the local feature role is client and the remote feature role is server
11+
type FeatureClientInterface interface {
12+
// check if there is a subscription to the remote feature
13+
HasSubscription() bool
14+
15+
// subscribe to the feature of the entity
16+
Subscribe() (*model.MsgCounterType, error)
17+
18+
// check if there is a binding to the remote feature
19+
HasBinding() bool
20+
21+
// bind to the feature of the entity
22+
Bind() (*model.MsgCounterType, error)
23+
24+
// add a callback function to be invoked once a result or reply message for a msgCounter came in
25+
AddResponseCallback(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error
26+
27+
// add a callback function to be invoked once a result came in
28+
AddResultCallback(function func(msg api.ResponseMessage))
29+
}
30+
31+
// Feature server interface were the local feature role is a server
32+
type FeatureServerInterface interface {
33+
}
34+
35+
// Common interface for DeviceClassificationClientInterface and DeviceClassificationServerInterface
36+
type DeviceClassificationCommonInterface interface {
37+
// get the current manufacturer details for a remote device entity
38+
GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error)
39+
}
40+
41+
// Common interface for DeviceConfigurationClientInterface and DeviceConfigurationServerInterface
42+
type DeviceConfigurationCommonInterface interface {
43+
// check if spine.EventPayload Data contains data for a given filter
44+
//
45+
// data type will be checked for model.DeviceConfigurationKeyValueListDataType,
46+
// filter type will be checked for model.DeviceConfigurationKeyValueDescriptionDataType
47+
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
48+
49+
// Get the description for a given keyId
50+
//
51+
// Will return nil if no matching description was found
52+
GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)
53+
54+
// Get the description for a given value combination
55+
//
56+
// Returns an error if no matching description was found
57+
GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)
58+
59+
// Get the key value data for a given keyId
60+
//
61+
// Will return nil if no matching data was found
62+
GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)
63+
64+
// Get key value data for a given filter
65+
//
66+
// Will return nil if no matching data was found
67+
GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)
68+
}
69+
70+
// Common interface for DeviceDiagnosisClientInterface and DeviceDiagnosisServerInterface
71+
type DeviceDiagnosisCommonInterface interface {
72+
// get the current diagnosis state for an device entity
73+
GetState() (*model.DeviceDiagnosisStateDataType, error)
74+
75+
// check if the currently available heartbeat data is within a time duration
76+
IsHeartbeatWithinDuration(duration time.Duration) bool
77+
}
78+
79+
// Common interface for ElectricalConnectionClientInterface and ElectricalConnectionServerInterface
80+
type ElectricalConnectionCommonInterface interface {
81+
// check if spine.EventPayload Data contains data for a given filter
82+
//
83+
// data type will be checked for model.ElectricalConnectionPermittedValueSetListDataType,
84+
// filter type will be checked for model.ElectricalConnectionParameterDescriptionDataType
85+
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
86+
87+
// Get the description for a given filter
88+
//
89+
// Returns an error if no matching description is found
90+
GetDescriptionsForFilter(
91+
filter model.ElectricalConnectionDescriptionDataType,
92+
) ([]model.ElectricalConnectionDescriptionDataType, error)
93+
94+
// Get the description for a given parameter description
95+
//
96+
// Returns an error if no matching description is found
97+
GetDescriptionForParameterDescriptionFilter(
98+
filter model.ElectricalConnectionParameterDescriptionDataType) (
99+
*model.ElectricalConnectionDescriptionDataType, error)
100+
101+
// Get the description for a given filter
102+
//
103+
// Returns an error if no matching description is found
104+
GetParameterDescriptionsForFilter(
105+
filter model.ElectricalConnectionParameterDescriptionDataType,
106+
) ([]model.ElectricalConnectionParameterDescriptionDataType, error)
107+
108+
// return permitted values for all Electrical Connections
109+
GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
110+
[]model.ElectricalConnectionPermittedValueSetDataType, error)
111+
112+
// returns minimum, maximum, default/pause limit values
113+
GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
114+
float64, float64, float64, error)
115+
116+
// Get the min, max, default current limits for each phase
117+
GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) (
118+
resultMin []float64, resultMax []float64, resultDefault []float64, resultErr error)
119+
120+
// Adjust a value to be within the permitted value range
121+
AdjustValueToBeWithinPermittedValuesForParameterId(
122+
value float64, parameterId model.ElectricalConnectionParameterIdType) float64
123+
124+
// Get the characteristics for a given filter
125+
//
126+
// Returns an error if no matching description is found
127+
GetCharacteristicsForFilter(
128+
filter model.ElectricalConnectionCharacteristicDataType,
129+
) ([]model.ElectricalConnectionCharacteristicDataType, error)
130+
}
131+
132+
// Common interface for LoadControlClientInterface and LoadControlServerInterface
133+
type LoadControlCommonInterface interface {
134+
// check if spine.EventPayload Data contains data for a given filter
135+
//
136+
// data type will be checked for model.LoadControlLimitListDataType,
137+
// filter type will be checked for model.LoadControlLimitDescriptionDataType
138+
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
139+
140+
// Get the description for a given limitId
141+
//
142+
// Will return nil if no matching description is found
143+
GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (
144+
*model.LoadControlLimitDescriptionDataType, error)
145+
146+
// Get the description for a given filter
147+
//
148+
// Returns an error if no matching description is found
149+
GetLimitDescriptionsForFilter(
150+
filter model.LoadControlLimitDescriptionDataType,
151+
) ([]model.LoadControlLimitDescriptionDataType, error)
152+
153+
// Get the description for a given limitId
154+
//
155+
// Will return nil if no data is available
156+
GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)
157+
158+
// Get limit data for a given filter
159+
//
160+
// Will return nil if no data is available
161+
GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)
162+
}
163+
164+
// Common interface for MeasurementClientInterface and MeasurementServerInterface
165+
type MeasurementCommonInterface interface {
166+
// check if spine.EventPayload Data contains data for a given filter
167+
//
168+
// data type will be checked for model.MeasurementListDataType,
169+
// filter type will be checked for model.MeasurementDescriptionDataType
170+
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
171+
172+
// Get the description for a given id
173+
//
174+
// Returns an error if no matching description is found
175+
GetDescriptionForId(
176+
measurementId model.MeasurementIdType,
177+
) (*model.MeasurementDescriptionDataType, error)
178+
179+
// Get the description for a given filter
180+
//
181+
// Returns an error if no matching description is found
182+
GetDescriptionsForFilter(
183+
filter model.MeasurementDescriptionDataType,
184+
) ([]model.MeasurementDescriptionDataType, error)
185+
186+
// Get the constraints for a given filter
187+
//
188+
// Returns an error if no matching constraint is found
189+
GetConstraintsForFilter(
190+
filter model.MeasurementConstraintsDataType,
191+
) ([]model.MeasurementConstraintsDataType, error)
192+
193+
// Get the measuement data for a given measurementId
194+
//
195+
// Will return nil if no data is available
196+
GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error)
197+
198+
// Get measuement data for a given filter
199+
//
200+
// Will return nil if no data is available
201+
GetDataForFilter(filter model.MeasurementDescriptionDataType) (
202+
[]model.MeasurementDataType, error)
203+
}
204+
205+
// Common interface for IdentificationClientInterface and IdentificationServerInterface
206+
type IdentificationCommonInterface interface {
207+
// check if spine.EventPayload Data contains identification data
208+
//
209+
// data type will be checked for model.IdentificationListDataType
210+
CheckEventPayloadDataForFilter(payloadData any) bool
211+
212+
// return current values for Identification
213+
GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error)
214+
}
215+
216+
// Common interface for IncentiveTableClientInterface and IncentiveTableServerInterface
217+
type IncentiveTableCommonInterface interface {
218+
// return list of descriptions for a given filter
219+
GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)
220+
221+
// return list of constraints
222+
GetConstraints() ([]model.IncentiveTableConstraintsType, error)
223+
224+
// return current data for Time Series
225+
GetData() ([]model.IncentiveTableType, error)
226+
}
227+
228+
// Common interface for SmartEnergyManagementPsClientInterface and SmartEnergyManagementPsServerInterface
229+
type SmartEnergyManagementPsCommonInterface interface {
230+
// return current data for FunctionTypeSmartEnergyManagementPsData
231+
GetData() (*model.SmartEnergyManagementPsDataType, error)
232+
}
233+
234+
// Common interface for TimeSeriesClientInterface and TimeSeriesServerInterface
235+
type TimeSeriesCommonInterface interface {
236+
// return list of descriptions for a given filter
237+
GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)
238+
239+
// return current constraints for Time Series
240+
GetConstraints() ([]model.TimeSeriesConstraintsDataType, error)
241+
242+
// return current data for Time Series for a given filter
243+
GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)
244+
}

0 commit comments

Comments
 (0)