package iotProtocolHandler import ( iotInterface "IotAdmin/iot/interface" iotProtocol "IotAdmin/iot/protocol" iotElProtocol "IotAdmin/iot/protocol/collect" iotReportProtocol "IotAdmin/iot/protocol/report" "errors" ) // GetMeterHandler 获取表计协议处理器 func GetMeterHandler(protocol string) (handler iotInterface.MeterHandler, err error) { switch protocol { case iotProtocol.MeterElAdw300: handler = iotElProtocol.NewAdw300MeterHandler() case iotProtocol.MeterElPmc350b: handler = iotElProtocol.NewPmc350bMeterHandler() default: err = errors.New("not support protocol") } return } // GetReportHandler 获取上报协议处理器 func GetReportHandler(protocol string) (handler iotInterface.ReportHandler, err error) { switch protocol { case iotProtocol.PlatElHj212: handler = iotReportProtocol.NewElHj212ReportHandler() default: err = errors.New("not support protocol") } return }