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/05 13:08:02 UTC
[plc4x] 02/03: feat(plc4xbrowser): made read produce a proper message
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
commit 5af52b7652e823ddd2604848a40ecae3c126e2dd
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Aug 5 15:07:32 2022 +0200
feat(plc4xbrowser): made read produce a proper message
---
plc4go/tools/plc4xbrowser/commands.go | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/plc4go/tools/plc4xbrowser/commands.go b/plc4go/tools/plc4xbrowser/commands.go
index bec0d764b..b0a2132bc 100644
--- a/plc4go/tools/plc4xbrowser/commands.go
+++ b/plc4go/tools/plc4xbrowser/commands.go
@@ -134,6 +134,7 @@ var rootCommand = Command{
if connection, ok := connections[connectionsString]; !ok {
return errors.Errorf("%s not connected", connectionsString)
} else {
+ start := time.Now()
readRequest, err := connection.ReadRequestBuilder().
AddQuery("readField", split[1]).
Build()
@@ -144,7 +145,12 @@ var rootCommand = Command{
if err := readRequestResult.GetErr(); err != nil {
return errors.Wrapf(err, "%s can't read", connectionsString)
}
- log.Info().Msgf("read result %s", readRequestResult.GetResponse())
+ plc4xBrowserLog.Debug().Msgf("read took %f seconds", time.Now().Sub(start).Seconds())
+ if err := readRequestResult.GetErr(); err != nil {
+ return errors.Wrapf(err, "%s error reading", connectionsString)
+ }
+ numberOfMessagesReceived++
+ messageReceived(numberOfMessagesReceived, time.Now(), readRequestResult.GetResponse())
}
return nil
},
@@ -228,9 +234,7 @@ var rootCommand = Command{
AddEventQuery("subscriptionField", split[1]).
AddItemHandler(func(event model.PlcSubscriptionEvent) {
numberOfMessagesReceived++
- start := time.Now()
- messageReceived(numberOfMessagesReceived, start, event)
- plc4xBrowserLog.Debug().Msgf("write took %f seconds", time.Now().Sub(start).Seconds())
+ messageReceived(numberOfMessagesReceived, time.Now(), event)
}).
Build()
if err != nil {