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