| 1234567891011121314151617181920212223242526272829303132 |
- package iotDownService
- import (
- 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)
- reportHandler.Report(d, cfg)
- }(data, &rc)
- }
- }
- }
|