Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.

Commit 5ba82fa

Browse files
committed
Fix KEO workaround for UCLPCServer
1 parent 9ac5268 commit 5ba82fa

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

uclpcserver/events.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (e *UCLPCServer) HandleEvent(payload spineapi.EventPayload) {
2727
if payload.EventType == spineapi.EventTypeBindingChange &&
2828
payload.ChangeType == spineapi.ElementChangeAdd &&
2929
payload.LocalFeature != nil &&
30-
payload.LocalFeature.Type() == model.FeatureTypeTypeDeviceDiagnosis &&
30+
payload.LocalFeature.Type() == model.FeatureTypeTypeLoadControl &&
3131
payload.LocalFeature.Role() == model.RoleTypeServer {
3232
e.subscribeHeartbeatWorkaround(payload)
3333
return
@@ -106,16 +106,16 @@ func (e *UCLPCServer) deviceConnected(payload spineapi.EventPayload) {
106106
return
107107
}
108108

109-
// we only found more one matching entity, this is not good
109+
// we found more than one matching entity, this is not good
110110
// according to KEO the subscription should be done on the entity that requests a binding to
111111
// the local loadControlLimit server feature
112-
e.heartbeatWorkaround = true
112+
e.heartbeatKeoWorkaround = true
113113
}
114114

115115
// subscribe to the DeviceDiagnosis Server of the entity that created a binding
116116
func (e *UCLPCServer) subscribeHeartbeatWorkaround(payload spineapi.EventPayload) {
117117
// the workaround is not needed, exit
118-
if !e.heartbeatWorkaround {
118+
if !e.heartbeatKeoWorkaround {
119119
return
120120
}
121121

uclpcserver/events_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (s *UCLPCServerSuite) Test_Events() {
5050

5151
payload.EventType = spineapi.EventTypeBindingChange
5252
payload.ChangeType = spineapi.ElementChangeAdd
53-
payload.LocalFeature = s.deviceDiagnosisFeature
53+
payload.LocalFeature = s.loadControlFeature
5454
s.sut.HandleEvent(payload)
5555
}
5656

uclpcserver/uclpc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type UCLPCServer struct {
1717

1818
validEntityTypes []model.EntityTypeType
1919

20-
heartbeatWorkaround bool
20+
heartbeatKeoWorkaround bool // required because KEO Stack uses multiple identical entities for the same functionality, and it is not clear which to use
2121
}
2222

2323
var _ UCLCPServerInterface = (*UCLPCServer)(nil)

0 commit comments

Comments
 (0)