From fc2160552167a4fdfe5cc582f9533b455674983e Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期五, 11 八月 2023 17:50:37 +0800
Subject: [PATCH] 修复长度大于1的读取结果

---
 collector/plc4x.go |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/collector/plc4x.go b/collector/plc4x.go
index 8d5cb1b..b4c6087 100644
--- a/collector/plc4x.go
+++ b/collector/plc4x.go
@@ -1,6 +1,7 @@
 package collector
 
 import (
+	"errors"
 	"fmt"
 
 	plc4go "github.com/apache/plc4x/plc4go/pkg/api"
@@ -92,11 +93,17 @@
 	// 鍒ゆ柇鍝嶅簲鐮佹槸鍚︽纭�
 	if readResult.GetResponse().GetResponseCode("tag") != apiModel.PlcResponseCode_OK {
 		fmt.Printf("error an non-ok return code: %s", readResult.GetResponse().GetResponseCode("tag").GetName())
-		return nil, nil
+		return nil, errors.New("error  code: " + readResult.GetResponse().GetResponseCode("tag").GetName())
 	}
 
 	value := readResult.GetResponse().GetValue("tag")
 
-	return value.GetRaw(), err
+	var result []byte
+
+	for _, val := range value.GetList() {
+		result = append(result, val.GetRaw()...)
+	}
+
+	return result, nil
 
 }

--
Gitblit v1.8.0