添加新类型设备接口

This commit is contained in:
lyp 2019-03-19 10:42:25 +08:00
parent f72c769a25
commit 433d480754
1 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,24 @@ type Device struct {
DATA map[string]interface{} `json:"data"`
}
func yunhorn_ys_l_v1(data_buf []byte){
//log.Println(data_buf)
log.Println(data_buf[3:4])
data_int := Bytes2Bits(data_buf[3:4])
var device Device
device.ID="deb03e28-ddcb-4e5d-aa31-d870a1f0f09b"
device.VERSION="yunhorn_ys_l_v1"
device.ONLINE=true
device.DATA=make(map[string]interface{})
device.DATA["data"]=data_int[0]
if conf.DEBUG {
log.Println(device)
}
send_data(1005, device)
}
func yunhorn_lorawan_l_v1(s *serial.Port) {
for {
buf := make([]byte, 128)