| | |
| | | package collector |
| | | |
| | | import ( |
| | | "errors" |
| | | "fmt" |
| | | |
| | | plc4go "github.com/apache/plc4x/plc4go/pkg/api" |
| | |
| | | // 判断响应码是否正确 |
| | | 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 |
| | | |
| | | } |