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 16:22:15 UTC

[plc4x] branch develop updated (3c7065cb4 -> 5ce93fbd9)

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


    from 3c7065cb4 feat(plc-simulator/cbus): implemented identify responses
     new 55397a5ae fix(plc4go/cbus): fixed FieldHandler
     new 5ce93fbd9 fix(plc4xbrowser): fixed command escaping when using brackets

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/internal/cbus/FieldHandler.go | 13 +++++--------
 plc4go/tools/plc4xbrowser/actions.go |  2 +-
 2 files changed, 6 insertions(+), 9 deletions(-)


[plc4x] 01/02: fix(plc4go/cbus): fixed FieldHandler

Posted by sr...@apache.org.
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 55397a5ae282813e5eceedf1f7f36bcda7892a23
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Aug 5 18:09:27 2022 +0200

    fix(plc4go/cbus): fixed FieldHandler
---
 plc4go/internal/cbus/FieldHandler.go | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/plc4go/internal/cbus/FieldHandler.go b/plc4go/internal/cbus/FieldHandler.go
index f54d4b9f0..ece7035b4 100644
--- a/plc4go/internal/cbus/FieldHandler.go
+++ b/plc4go/internal/cbus/FieldHandler.go
@@ -122,8 +122,8 @@ func (m FieldHandler) ParseQuery(query string) (model.PlcField, error) {
 				}
 				recalParamNo = readWriteModel.Parameter(decodedHex[0])
 			} else {
-				atoi, err := strconv.ParseUint(recallParamNoArgument, 10, 8)
-				if err != nil {
+
+				if atoi, err := strconv.ParseUint(recallParamNoArgument, 10, 8); err == nil {
 					recalParamNo = readWriteModel.Parameter(atoi)
 				} else {
 					parameterByName, ok := readWriteModel.ParameterByName(recallParamNoArgument)
@@ -153,8 +153,7 @@ func (m FieldHandler) ParseQuery(query string) (model.PlcField, error) {
 				}
 				attribute = readWriteModel.Attribute(decodedHex[0])
 			} else {
-				atoi, err := strconv.ParseUint(attributeArgument, 10, 8)
-				if err != nil {
+				if atoi, err := strconv.ParseUint(attributeArgument, 10, 8); err == nil {
 					attribute = readWriteModel.Attribute(atoi)
 				} else {
 					parameterByName, ok := readWriteModel.AttributeByName(attributeArgument)
@@ -178,8 +177,7 @@ func (m FieldHandler) ParseQuery(query string) (model.PlcField, error) {
 				}
 				recalParamNo = readWriteModel.Parameter(decodedHex[0])
 			} else {
-				atoi, err := strconv.ParseUint(recallParamNoArgument, 10, 8)
-				if err != nil {
+				if atoi, err := strconv.ParseUint(recallParamNoArgument, 10, 8); err == nil {
 					recalParamNo = readWriteModel.Parameter(atoi)
 				} else {
 					parameterByName, ok := readWriteModel.ParameterByName(recallParamNoArgument)
@@ -293,8 +291,7 @@ func applicationIdFromArgument(applicationIdArgument string) (readWriteModel.App
 		}
 		return readWriteModel.ApplicationIdContainer(decodedHex[0]), nil
 	}
-	atoi, err := strconv.ParseUint(applicationIdArgument, 10, 8)
-	if err != nil {
+	if atoi, err := strconv.ParseUint(applicationIdArgument, 10, 8); err == nil {
 		return readWriteModel.ApplicationIdContainer(atoi), nil
 	}
 	// We try first the application id


[plc4x] 02/02: fix(plc4xbrowser): fixed command escaping when using brackets

Posted by sr...@apache.org.
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 5ce93fbd9dca87b3c17e9eb676471e6d9c1a6aad
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Aug 5 18:20:36 2022 +0200

    fix(plc4xbrowser): fixed command escaping when using brackets
---
 plc4go/tools/plc4xbrowser/actions.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4go/tools/plc4xbrowser/actions.go b/plc4go/tools/plc4xbrowser/actions.go
index 31ccda044..6f9f581bb 100644
--- a/plc4go/tools/plc4xbrowser/actions.go
+++ b/plc4go/tools/plc4xbrowser/actions.go
@@ -67,7 +67,7 @@ func initSubsystem() {
 func outputCommandHistory() {
 	_, _ = fmt.Fprintln(commandOutput, "[#0000ff]Last 10 commands[white]")
 	for i, command := range config.History.Last10Commands {
-		_, _ = fmt.Fprintf(commandOutput, "   [#00ff00]%d[white]: [\"%d\"]%s[\"\"]\n", i, i, command)
+		_, _ = fmt.Fprintf(commandOutput, "   [#00ff00]%d[white]: [\"%d\"]%s[\"\"]\n", i, i, tview.Escape(command))
 	}
 }