zhangzengfei
2023-08-11 fc2160552167a4fdfe5cc582f9533b455674983e
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
}