完善尿布台和吸顶的设备型号

This commit is contained in:
yu 2019-05-29 10:21:37 +08:00
parent 69c9c2d829
commit 1250fc5d6d
1 changed files with 9 additions and 3 deletions

View File

@ -143,7 +143,7 @@ func dealDatav3(data []byte) string{
strs := data strs := data
buffer := new(bytes.Buffer) buffer := new(bytes.Buffer)
for _, b := range data[:4] { for _, b := range data[:4] {
s := strconv.FormatInt(int64(b&0xff), 16) s := strconv.FormatInt(int64(b&0xff), 16)
if len(s) == 1 { if len(s) == 1 {
@ -169,7 +169,7 @@ func dealDatav3(data []byte) string{
R_data.CODE = 1008 R_data.CODE = 1008
R_data.ID = adr R_data.ID = adr
//尿布台 //尿布台
R_data.VERSION = "yunhorn_2_v1" R_data.VERSION = "sts_hps_3ir"
R_data.ONLINE = true R_data.ONLINE = true
R_data.DATA = make(map[string]interface{}) R_data.DATA = make(map[string]interface{})
R_data.DATA["cs2001"]=cs2001 R_data.DATA["cs2001"]=cs2001
@ -194,7 +194,7 @@ func dealDatav3(data []byte) string{
if newdtype==1{ if newdtype==1{
tof = data[7] tof = data[7]
R_data.VERSION = "yunhorn_1_v1" R_data.VERSION = "sts_lts_01"
R_data.DATA["tof"]=tof R_data.DATA["tof"]=tof
tofTmp := strconv.FormatInt(int64(data[7]&0xff), 10) tofTmp := strconv.FormatInt(int64(data[7]&0xff), 10)
readyData.WriteString("*") readyData.WriteString("*")
@ -669,11 +669,17 @@ type Seat_data struct {
func seat_api(c *gin.Context) { func seat_api(c *gin.Context) {
DEVICEDATAS.RLock() DEVICEDATAS.RLock()
type_id := c.Param("id") type_id := c.Param("id")
//locationCode := c.Param("locationCode")
var data Seat_data var data Seat_data
var conf_data [][]interface{} var conf_data [][]interface{}
//conf.GATEWAY_INFO.CONFIG 采集器配置信息 //conf.GATEWAY_INFO.CONFIG 采集器配置信息
// log.Println("DEVICEDATAS.data:",DEVICEDATAS.DATA) // log.Println("DEVICEDATAS.data:",DEVICEDATAS.DATA)
for _, i := range conf.GATEWAY_INFO.CONFIG { for _, i := range conf.GATEWAY_INFO.CONFIG {
//if i.LOCATION_CODE != locationCode{
// continue
//}
arr := get_seat_device_data(i.ID) arr := get_seat_device_data(i.ID)
//获取到设备版本 //获取到设备版本
version, num := arr[0], arr[1] version, num := arr[0], arr[1]