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 2023/06/14 09:09:37 UTC

[plc4x] branch develop updated: feat(plc4go): improve logging on browse

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 6fa5bc147f feat(plc4go): improve logging on browse
6fa5bc147f is described below

commit 6fa5bc147f8ee0687ec994e36579d620329fbd28
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Jun 14 11:09:31 2023 +0200

    feat(plc4go): improve logging on browse
---
 plc4go/internal/cbus/Browser.go | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/plc4go/internal/cbus/Browser.go b/plc4go/internal/cbus/Browser.go
index 9fbffe99e4..eddccc3a31 100644
--- a/plc4go/internal/cbus/Browser.go
+++ b/plc4go/internal/cbus/Browser.go
@@ -254,19 +254,22 @@ func (m Browser) getInstalledUnitAddressBytes(ctx context.Context) (map[byte]any
 		}
 		// We notify here so we don't exit to early
 		switch blockStart {
+		case 0:
+			select {
+			case blockOffset0ReceivedChan <- true:
+				m.log.Trace().Msg("0 notified")
+			default:
+			}
 		case 88:
 			select {
 			case blockOffset88ReceivedChan <- true:
+				m.log.Trace().Msg("88 notified")
 			default:
 			}
 		case 176:
 			select {
 			case blockOffset176ReceivedChan <- true:
-			default:
-			}
-		case 0:
-			select {
-			case blockOffset0ReceivedChan <- true:
+				m.log.Trace().Msg("176 notified")
 			default:
 			}
 		}
@@ -292,8 +295,9 @@ func (m Browser) getInstalledUnitAddressBytes(ctx context.Context) (map[byte]any
 			m.log.Warn().Err(err).Msg("Error reading the mmi")
 			return
 		}
-		if responseCode := readRequestResult.GetResponse().GetResponseCode("installationMMI"); responseCode == apiModel.PlcResponseCode_OK {
-			rootValue := readRequestResult.GetResponse().GetValue("installationMMI")
+		response := readRequestResult.GetResponse()
+		if responseCode := response.GetResponseCode("installationMMI"); responseCode == apiModel.PlcResponseCode_OK {
+			rootValue := response.GetValue("installationMMI")
 			if !rootValue.IsStruct() {
 				m.log.Warn().Err(err).Msgf("%v should be a struct", rootValue)
 				return
@@ -310,6 +314,7 @@ func (m Browser) getInstalledUnitAddressBytes(ctx context.Context) (map[byte]any
 			} else {
 				blockStart = int(blockStartValue.GetByte())
 			}
+			m.log.Debug().Msgf("Read MMI with block start %d", blockStart)
 
 			if plcListValue := rootStruct["values"]; plcListValue == nil || !plcListValue.IsList() {
 				m.log.Warn().Err(err).Msgf("%v should contain a values tag of type list", rootStruct)
@@ -335,10 +340,13 @@ func (m Browser) getInstalledUnitAddressBytes(ctx context.Context) (map[byte]any
 			switch blockStart {
 			case 0:
 				blockOffset0Received = true
+				m.log.Trace().Msg("block 0 read by read")
 			case 88:
 				blockOffset88Received = true
+				m.log.Trace().Msg("block 88 read by read")
 			case 176:
 				blockOffset176Received = true
+				m.log.Trace().Msg("block 176 read by read")
 			}
 
 		} else {