1 Star 0 Fork 0

iiot软件库/driver-develop-go-demo

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 981 Bytes
一键复制 编辑 原始数据 按行查看 历史
常文才 提交于 2021-09-13 16:55 +08:00 . go driver demo
package main
import (
"gitee.com/magusiiot/driver-develop-go-demo/send/SendService"
"gitee.com/magusiiot/driver-develop-go-demo/send/byteschange"
"time"
)
// 发包测试程序
func main() {
send:=SendService.SendController{
Config: SendService.Config{
Ip:[4]byte{0,0,0,0},
Port: 9999,
},
}
send.Initialize()
//data:=[]byte{0x27,0x10,0x64,0xd0,0x00,0x18,
// 0x42,0x3c,0x7e,0xdd,0x61,0x31,0xe4,0xb0,
// 0x42,0x3c,0x7e,0xdd,0x61,0x31,0xe4,0xb0,
// 0x42,0x3c,0x7e,0xdd,0x61,0x31,0xe4,0xb0,
// 0x27,0x11}
for {
tm := byteschange.IntToBytes(int(time.Now().Unix()))
d1 := byteschange.IntToBytes(int(time.Now().Unix())%100+100)
d2 := byteschange.IntToBytes(int(time.Now().Unix())%100+200)
d3 := byteschange.IntToBytes(int(time.Now().Unix())%100+300)
data := append(append(append(append(append(append(append([]byte{0x27,0x10,0x64,0xd0,0x00,0x18},d1...),tm...),d2...),tm...),d3...),tm...),0x27,0x11)
send.Send(data)
time.Sleep(1*time.Second)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/magusiiot/driver-develop-go-demo.git
git@gitee.com:magusiiot/driver-develop-go-demo.git
magusiiot
driver-develop-go-demo
driver-develop-go-demo
864f6724ae67

搜索帮助