| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package meter
- const (
- // 电表类型
- MeterAdw300 = "ADW300"
- MeterPmc350b = "PMC350B"
- // 上报平台协议
- PlatYcHj212 = "YC-HJ212"
- )
- var (
- meterProto = make([]string, 0) //电表协议列表
- platProto = make([]string, 0) //上报协议列表
- )
- // InitMeterProto 初始化电表协议列表和上报协议列表
- func InitMeterProto() {
- //在这里添加支持的电表协议列表
- meterProto = append(meterProto, MeterAdw300)
- meterProto = append(meterProto, MeterPmc350b)
- meterProto = append(meterProto, "TEST")
- //在这里添加支持的上报协议列表
- platProto = append(platProto, PlatYcHj212)
- }
- // GetMeterProtoList 获取电表协议列表
- func GetMeterProtoList() []string {
- return meterProto
- }
- // GetPlatProtoList 获取上报协议列表
- func GetPlatProtoList() []string {
- return platProto
- }
- func VerifyMeterProto(proto string) bool {
- if proto == "" {
- return false
- }
- for _, v := range meterProto {
- if proto == v {
- return true
- }
- }
- return false
- }
|