| | |
| | | } |
| | | |
| | | // 判断响应码是否正确 |
| | | if readResult.GetResponse().GetResponseCode("tag") != apiModel.PlcResponseCode_OK { |
| | | fmt.Printf("error an non-ok return code: %s", readResult.GetResponse().GetResponseCode("tag").GetName()) |
| | | 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 |
| | | } |
| | | |
| | | value := readResult.GetResponse().GetValue("tag") |
| | | value := readResult.GetResponse().GetValue(tag) |
| | | |
| | | return value.GetRaw(), err |
| | | |
| | |
| | | } |
| | | |
| | | // 判断响应码是否正确 |
| | | if readResult.GetResponse().GetResponseCode("tag") != apiModel.PlcResponseCode_OK { |
| | | fmt.Printf("error an non-ok return code: %s", readResult.GetResponse().GetResponseCode("tag").GetName()) |
| | | return nil, errors.New("error code: " + readResult.GetResponse().GetResponseCode("tag").GetName()) |
| | | if readResult.GetResponse().GetResponseCode(tag) != apiModel.PlcResponseCode_OK { |
| | | fmt.Printf("error an non-ok return code: %s", readResult.GetResponse().GetResponseCode(tag).GetName()) |
| | | return nil, errors.New("error code: " + readResult.GetResponse().GetResponseCode(tag).GetName()) |
| | | } |
| | | |
| | | value := readResult.GetResponse().GetValue("tag") |
| | | value := readResult.GetResponse().GetValue(tag) |
| | | |
| | | var result []byte |
| | | |
| | |
| | | } |
| | | |
| | | // 判断响应码是否正确 |
| | | if writeResult.GetResponse().GetResponseCode("tag") != apiModel.PlcResponseCode_OK { |
| | | fmt.Printf("error an non-ok return code: %s", writeResult.GetResponse().GetResponseCode("tag").GetName()) |
| | | return "", errors.New("error code: " + writeResult.GetResponse().GetResponseCode("tag").GetName()) |
| | | if writeResult.GetResponse().GetResponseCode(tag) != apiModel.PlcResponseCode_OK { |
| | | fmt.Printf("error an non-ok return code: %s", writeResult.GetResponse().GetResponseCode(tag).GetName()) |
| | | return "", errors.New("error code: " + writeResult.GetResponse().GetResponseCode(tag).GetName()) |
| | | } |
| | | |
| | | result := writeResult.GetResponse().String() |