當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Setting.Vpk方法代碼示例

本文整理匯總了Golang中github.com/grayzone/devicemonitor/conn.Setting.Vpk方法的典型用法代碼示例。如果您正苦於以下問題:Golang Setting.Vpk方法的具體用法?Golang Setting.Vpk怎麽用?Golang Setting.Vpk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/grayzone/devicemonitor/conn.Setting的用法示例。


在下文中一共展示了Setting.Vpk方法的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.Vpk方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。