当前位置: 首页>>代码示例>>Golang>>正文


Golang Setting.Oltarget方法代码示例

本文整理汇总了Golang中github.com/grayzone/devicemonitor/conn.Setting.Oltarget方法的典型用法代码示例。如果您正苦于以下问题:Golang Setting.Oltarget方法的具体用法?Golang Setting.Oltarget怎么用?Golang Setting.Oltarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/grayzone/devicemonitor/conn.Setting的用法示例。


在下文中一共展示了Setting.Oltarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: worker


//.........这里部分代码省略.........
			s.Maxretrycount = sessionres.MaxRetryCount
			s.UpdateMaxretrycount()

		case ftprotocol.DEVICENAMERESPONSE:
			var res ftprotocol.DeviceNameResponse
			res.Frame = f
			err := res.ParseMessageData(f.MessageData)
			if err != nil {
				log.Println(err.Error())
				m.Status = conn.INVALID
				m.UpdateStatus()
				continue
			}
			var s conn.Setting
			//		log.Println("device  name : ", res.StringName)
			s.Devicename = res.StringName
			err = s.UpdateDevicename()
			if err != nil {
				log.Println("UpdateDevicename:", err.Error())
			}

		case ftprotocol.GETSENSORRESPONSE:
			var res ftprotocol.GetSensorResponse
			res.Frame = f
			err := res.ParseMessageData(f.MessageData)
			if err != nil {
				log.Println("GETSENSORRESPONSE:", err.Error())
				m.Status = conn.INVALID
				m.UpdateStatus()
				continue
			}
			var s conn.Setting
			s.Sensorbroadcastperiod = res.BroadcastPeriod
			err = s.UpdateSensorbroadcastperiod()
			if err != nil {
				log.Println("UpdateSensorbroadcastperiod :", err.Error())
			}

		case ftprotocol.DSP1SENSORDATA:
			var res ftprotocol.Dsp1SensorData
			res.Frame = f
			err := res.ParseMessageData(f.MessageData)
			if err != nil {
				log.Println("DSP1SENSORDATA:", err.Error())
				m.Status = conn.INVALID
				m.UpdateStatus()
				continue
			}
			var s conn.Sensordata
			s.Isvaliddata = res.IsValidData
			s.Sequencenumber = res.SequenceNumber
			s.Isactivatingflag = res.IsActivatingFlag
			s.Vavg = res.Vavg
			s.Iavg = res.Iavg
			s.Pavg = res.Pavg
			s.Vrms = res.Vrms
			s.Irms = res.Irms
			s.Viphase = res.Viphase
			s.Vpk = res.Vpk
			s.Ipk = res.Ipk
			s.Vcf = res.Vcf
			s.Icf = res.Icf
			s.Zload = res.Zload
			s.T1 = res.T1
			s.T2 = res.T2
			s.Leakage = res.Leakage
			s.Stimpos = res.Stimpos
			s.Stimneg = res.Stimneg
			s.Oltarget = res.Oltarget

			s.Createtime = time.Now()

			s.InsertSensordata()

		case ftprotocol.EMPTY:
			var s conn.Setting
			s.Sequence = string(f.Sequence)
			//			log.Printf("sequence : %X", s.Sequence)
			s.UpdateSequence()
		default:
			log.Printf("unsupported message : %X", msgid)

		}
		if len(s) > 0 {
			m.Info = s
			m.UpdateInfo()
		} else {
			//			log.Println(m)
			if bSoftDelete {
				m.Status = conn.DELETED
				m.UpdateStatus()
			} else {
				m.DeleteMessage()
				//		log.Println("the request is deleted.")
			}
		}

	}

}
开发者ID:grayzone,项目名称:devicemonitor,代码行数:101,代码来源:devicemonitor.go


注:本文中的github.com/grayzone/devicemonitor/conn.Setting.Oltarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。