package iotDownService import ( iotLog "IotAdmin/iot/log" iotProtocol "IotAdmin/iot/protocol" iotElProtocol "IotAdmin/iot/protocol/electric" iotStruct "IotAdmin/iot/struct" ) func reportData(dataArray *[]*iotStruct.CollectData) { if dataArray == nil || len(*dataArray) == 0 { return } var reportHandler iotProtocol.ReportHandler for _, data := range *dataArray { cfg := data.SlaveConfig if cfg == nil { continue } for _, rc := range *cfg.ReportConfig { switch rc.Protocol { case iotProtocol.PlatElHj212: reportHandler = iotElProtocol.NewElHj212ReportHandler() default: } go func(d *iotStruct.CollectData, cfg *iotStruct.ReportConfig) { reportHandler.Adapter(d) str := reportHandler.Report(d, cfg) go iotLog.LogData(d, cfg, str) }(data, &rc) } } }