| | |
| | | addr := protocol.ConvertLabelToAddress(label) |
| | | proto := protocol.MakeReadProtocol(addr) |
| | | bp := base64.StdEncoding.EncodeToString(proto) |
| | | |
| | | resp, err := http.Get(url + bp) |
| | | fullUrl := fmt.Sprintf("%v?proto=%v", url, bp) |
| | | resp, err := http.Get(fullUrl) |
| | | if err != nil { |
| | | logx.Errorf("ReadPLC http get failed:%v", err) |
| | | return 0, err |
| | |
| | | body := readBody(resp.Body) |
| | | data, err := base64.StdEncoding.DecodeString(string(body)) |
| | | if err != nil { |
| | | logx.Errorf("ReadPLC base64.StdEncoding.DecodeString failed:%v", err) |
| | | logx.Errorf("ReadPLC base64.StdEncoding.DecodeString failed: %v, data: %v", err, string(body)) |
| | | return 0, err |
| | | } |
| | | val = protocol.ParseReadValue(data) |