Skip to content

Commit

Permalink
fix(plc4go/cbus): don't misreport fields which are meant for sal or mmi
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Aug 17, 2022
1 parent 2651c29 commit 23df43e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions plc4go/internal/cbus/Subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,9 @@ func (m *Subscriber) handleMonitoredMMI(calReply readWriteModel.CALReply) bool {
plcValues := map[string]values.PlcValue{}

for _, fieldName := range subscriptionRequest.GetFieldNames() {
field, ok := subscriptionRequest.GetField(fieldName).(MMIMonitorField)
field, ok := subscriptionRequest.GetField(fieldName).(*mmiMonitorField)
if !ok {
log.Warn().Msgf("Unusable field for subscription %s", field)
responseCodes[fieldName] = apiModel.PlcResponseCode_INVALID_ADDRESS
plcValues[fieldName] = nil
log.Debug().Msgf("Unusable field for mmi subscription %s", field)
continue
}
if unitAddress := field.GetUnitAddress(); unitAddress != nil {
Expand Down Expand Up @@ -223,9 +221,7 @@ func (m *Subscriber) handleMonitoredSal(sal readWriteModel.MonitoredSAL) bool {
for _, fieldName := range subscriptionRequest.GetFieldNames() {
field, ok := subscriptionRequest.GetField(fieldName).(SALMonitorField)
if !ok {
log.Warn().Msgf("Unusable field for subscription %s", field)
responseCodes[fieldName] = apiModel.PlcResponseCode_INVALID_ADDRESS
plcValues[fieldName] = nil
log.Debug().Msgf("Unusable field for sal subscription %s", field)
continue
}

Expand Down

0 comments on commit 23df43e

Please sign in to comment.