report.go 739 B

1234567891011121314151617181920212223242526272829303132
  1. package iotDownService
  2. import (
  3. iotProtocol "IotAdmin/iot/protocol"
  4. iotElProtocol "IotAdmin/iot/protocol/electric"
  5. iotStruct "IotAdmin/iot/struct"
  6. )
  7. func reportData(dataArray *[]*iotStruct.CollectData) {
  8. if dataArray == nil || len(*dataArray) == 0 {
  9. return
  10. }
  11. var reportHandler iotProtocol.ReportHandler
  12. for _, data := range *dataArray {
  13. cfg := data.SlaveConfig
  14. if cfg == nil {
  15. continue
  16. }
  17. for _, rc := range *cfg.ReportConfig {
  18. switch rc.Protocol {
  19. case iotProtocol.PlatElHj212:
  20. reportHandler = iotElProtocol.NewElHj212ReportHandler()
  21. default:
  22. }
  23. go func(d *iotStruct.CollectData, cfg *iotStruct.ReportConfig) {
  24. reportHandler.Adapter(d)
  25. reportHandler.Report(d, cfg)
  26. }(data, &rc)
  27. }
  28. }
  29. }