| | |
| | | |
| | | import ( |
| | | "encoding/json" |
| | | "plc-recorder/util" |
| | | "time" |
| | | |
| | | "plc-recorder/config" |
| | | "plc-recorder/logger" |
| | | "plc-recorder/nsqclient" |
| | | "plc-recorder/util" |
| | | ) |
| | | |
| | | func SendDeviceLiveData(response *PLCResponse) { |
| | |
| | | |
| | | // aps 发布 |
| | | if config.Options.PostPLCDataWebApi != "" { |
| | | _, err := util.HttpPost(config.Options.PostPLCDataWebApi, b) |
| | | token, _ := util.CreateToken() |
| | | _, err := util.HttpPost(config.Options.PostPLCDataWebApi, b, token) |
| | | if err != nil { |
| | | logger.Warn(err.Error()) |
| | | } |
| | |
| | | DeviceName: "test", |
| | | DeviceIP: "0.0.0.0", |
| | | Online: true, |
| | | Message: "", |
| | | PLCData: []PLCData{{ |
| | | StartAddress: 100, |
| | | Length: 1, |