吸顶类型传感器使用特定配置项

This commit is contained in:
fish 2019-04-27 15:17:17 +08:00
parent cca97cc694
commit da82f1a765
1 changed files with 36 additions and 2 deletions

View File

@ -48,6 +48,8 @@ func gw_router() {
type DparkConf struct {
ExtensionInTime int `json:"in"`
ExtensionOutTime int `json:"out"`
ExtensionInTime2 int `json:"in2"`
ExtensionOutTime2 int `json:"out2"`
}
var dparkConf DparkConf
@ -407,6 +409,16 @@ func dealDatav3(data []byte) string{
cs2001 := data[6]
var R_data P1004_6
R_data.CODE = 1008
R_data.ID = adr
//尿布台
R_data.VERSION = "yunhorn_2_v1"
R_data.ONLINE = true
R_data.DATA = make(map[string]interface{})
R_data.DATA["cs2001"]=cs2001
datatypeStr := strconv.FormatInt(int64(data[5]&0xff), 16)
cs2001Str := strconv.FormatInt(int64(data[6]&0xff), 16)
@ -427,11 +439,17 @@ func dealDatav3(data []byte) string{
if newdtype==1{
tof = data[7]
R_data.VERSION = "yunhorn_1_v1"
R_data.DATA["tof"]=tof
tofTmp := strconv.FormatInt(int64(data[7]&0xff), 10)
readyData.WriteString("*")
readyData.WriteString(tofTmp)
}
data_bufTmp, _ := json.Marshal(R_data)
data_buf := string(data_bufTmp)
go post_to_server(data_buf)
// log.Println("readyData:",readyData.String())
// go pushCODE1007(data)
@ -496,13 +514,29 @@ func dealDatav3(data []byte) string{
log.Println("yunhorndeug.push.data.durationAsInt64:",durationAsInt64)
if current == 0 {
if durationAsInt64 < extensionOutTime {
//类型2 吸顶
if datatype==2{
if durationAsInt64 < extensionOutTime2 {
return ""
}
}else{
if durationAsInt64 < extensionOutTime {
return ""
}
}
}else{
//类型2 吸顶
if datatype==2{
if durationAsInt64 < extensionInTime2 {
return ""
}
}else{
}else{
if durationAsInt64 < extensionInTime {
return ""
}
}
}
//改变状态