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 15:50:17 UTC

[plc4x] branch develop updated (927baf333 -> 10962f133)

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 927baf333 fix(plc4go/spi): fixed transaction await never ending
     new b95a929de fix(plc4go/cbus): fixed cal pattern
     new 10962f133 fix(plc4go/spi): fix AwaitCompletion of RequestTransactionManager

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                  |  2 +-
 plc4go/spi/RequestTransactionManager.go               | 15 ++++++++++++++-
 plc4go/tests/drivers/tests/manual_cbus_driver_test.go |  5 +----
 3 files changed, 16 insertions(+), 6 deletions(-)


[plc4x] 02/02: fix(plc4go/spi): fix AwaitCompletion of RequestTransactionManager

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 10962f133609d4ed31b8efecd39f667d749612b1
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Aug 29 17:50:10 2022 +0200

    fix(plc4go/spi): fix AwaitCompletion of RequestTransactionManager
---
 plc4go/spi/RequestTransactionManager.go               | 15 ++++++++++++++-
 plc4go/tests/drivers/tests/manual_cbus_driver_test.go |  5 +----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/plc4go/spi/RequestTransactionManager.go b/plc4go/spi/RequestTransactionManager.go
index 0113cd165..a6b025502 100644
--- a/plc4go/spi/RequestTransactionManager.go
+++ b/plc4go/spi/RequestTransactionManager.go
@@ -377,5 +377,18 @@ func (t *RequestTransaction) AwaitCompletion() error {
 	for t.completionFuture == nil {
 		time.Sleep(time.Millisecond * 10)
 	}
-	return t.completionFuture.AwaitCompletion()
+	if err := t.completionFuture.AwaitCompletion(); err != nil {
+		return err
+	}
+	stillActive := true
+	for stillActive {
+		stillActive = false
+		for _, runningRequest := range t.parent.runningRequests {
+			if runningRequest.transactionId == t.transactionId {
+				stillActive = true
+				break
+			}
+		}
+	}
+	return nil
 }
diff --git a/plc4go/tests/drivers/tests/manual_cbus_driver_test.go b/plc4go/tests/drivers/tests/manual_cbus_driver_test.go
index 6fbc971d3..b385a4e09 100644
--- a/plc4go/tests/drivers/tests/manual_cbus_driver_test.go
+++ b/plc4go/tests/drivers/tests/manual_cbus_driver_test.go
@@ -154,9 +154,7 @@ func TestManualCBusRead(t *testing.T) {
 	readRequest, err := connection.ReadRequestBuilder().
 		AddQuery("asd", "cal/3/identify=OutputUnitSummary").
 		Build()
-	if err != nil {
-		panic(err)
-	}
+	require.NoError(t, err)
 	readRequestResult := <-readRequest.Execute()
 	fmt.Printf("%s", readRequestResult.GetResponse())
 }
@@ -179,5 +177,4 @@ func TestManualDiscovery(t *testing.T) {
 		println(event.(fmt.Stringer).String())
 	})
 	require.NoError(t, err)
-
 }


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

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 b95a929de4a7849b455ed74d75479f169405e977
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Aug 29 17:34:36 2022 +0200

    fix(plc4go/cbus): fixed cal pattern
---
 plc4go/internal/cbus/FieldHandler.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4go/internal/cbus/FieldHandler.go b/plc4go/internal/cbus/FieldHandler.go
index 62766c183..f6fceb055 100644
--- a/plc4go/internal/cbus/FieldHandler.go
+++ b/plc4go/internal/cbus/FieldHandler.go
@@ -71,7 +71,7 @@ type FieldHandler struct {
 func NewFieldHandler() FieldHandler {
 	return FieldHandler{
 		statusRequestPattern: regexp.MustCompile(`^status/(?P<statusRequestType>(?P<binary>binary)|level=0x(?P<startingGroupAddressLabel>00|20|40|60|80|A0|C0|E0))/(?P<application>.*)`),
-		calPattern:           regexp.MustCompile(`^cal/(?P<unitAddress>.+)/(?P<calType>reset|recall=\[(?P<recallParamNo>\w+), ?(?P<recallCount>\d+)]|identify=(?P<identifyAttribute>\w+), ?(?P<getstatusCount>\d+)|getstatus=(?P<getstatusParamNo>\w+)|write=\[(?P<writeParamNo>\w+), ?(?P<writeCode>0[xX][0-9a-fA-F][0-9a-fA-F])]|identifyReply=(?P<replyAttribute>\w+)|reply=(?P<replyParamNo>\w+)|status=(?P<statusApplication>.*)|statusExtended=(?P<statusExtendedApplication>.*))`),
+		calPattern:           regexp.MustCompile(`^cal/(?P<unitAddress>.+)/(?P<calType>reset|recall=\[(?P<recallParamNo>\w+), ?(?P<recallCount>\d+)]|identify=(?P<identifyAttribute>\w+)|getstatus=(?P<getstatusParamNo>\w+), ?(?P<getstatusCount>\d+)|write=\[(?P<writeParamNo>\w+), ?(?P<writeCode>0[xX][0-9a-fA-F][0-9a-fA-F])]|identifyReply=(?P<replyAttribute>\w+)|reply=(?P<replyParamNo>\w+)|status=(?P<statusApplication>.*)|statusExtended=(?P<statusExtendedApplication>.*))`),
 		salPattern:           regexp.MustCompile(`^sal/(?P<application>.*)/(?P<salCommand>.*)`),
 		salMonitorPattern:    regexp.MustCompile(`^salmonitor/(?P<unitAddress>.+)/(?P<application>.+)`),
 		mmiMonitorPattern:    regexp.MustCompile(`^mmimonitor/(?P<unitAddress>.+)/(?P<application>.+)`),