// Package dto ----------------------------- // @file : led.go // @author : JJXu // @contact : wavingbear@163.com // @time : 2024/5/21 上午10:32 // ------------------------------------------- package dto import "fmt" type LedControlRequest struct { MchId string `json:"mchId"` LedNo string `json:"ledNo"` Status int `json:"status"` // 0: off, 1: on Color [3]int `json:"color"` Light int `json:"light"` } func (r *LedControlRequest) TcpMsg() string { //003 06000 001 1 255 255 255 100 return fmt.Sprintf("003%s%s%d%03d%03d%03d%03d", r.MchId, r.LedNo, r.Status, r.Color[0], r.Color[1], r.Color[2], r.Light) }