You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/08/29 12:02:13 UTC
[plc4x] branch develop updated: feat(plc4go/cbus): map cal data using the WriteBufferPlcValueBased
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 08ac93ca0 feat(plc4go/cbus): map cal data using the WriteBufferPlcValueBased
08ac93ca0 is described below
commit 08ac93ca0b1f4f8bad444fbc388dbd62f23cfed9
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Aug 29 14:02:00 2022 +0200
feat(plc4go/cbus): map cal data using the WriteBufferPlcValueBased
---
plc4go/internal/cbus/Reader.go | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/plc4go/internal/cbus/Reader.go b/plc4go/internal/cbus/Reader.go
index bb04a34a0..b2949dab2 100644
--- a/plc4go/internal/cbus/Reader.go
+++ b/plc4go/internal/cbus/Reader.go
@@ -365,8 +365,13 @@ func (m *Reader) Read(ctx context.Context, readRequest apiModel.PlcReadRequest)
return transaction.EndRequest()
}
default:
- log.Warn().Msgf("Unmapped cal data type %T. Returning raw to string", calData)
- addPlcValue(fieldNameCopy, spiValues.NewPlcSTRING(fmt.Sprintf("%s", calData)))
+ wbpcb := spiValues.NewWriteBufferPlcValueBased()
+ if err := calData.Serialize(wbpcb); err != nil {
+ log.Warn().Err(err).Msgf("Unmapped cal data type %T. Returning raw to string", calData)
+ addPlcValue(fieldNameCopy, spiValues.NewPlcSTRING(fmt.Sprintf("%s", calData)))
+ } else {
+ addPlcValue(fieldNameCopy, wbpcb.GetPlcValue())
+ }
}
default:
panic(fmt.Sprintf("All types should be mapped here. Not mapped: %T", reply))