本文整理汇总了Golang中github.com/skypies/adsb.Msg.HasVerticalRate方法的典型用法代码示例。如果您正苦于以下问题:Golang Msg.HasVerticalRate方法的具体用法?Golang Msg.HasVerticalRate怎么用?Golang Msg.HasVerticalRate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/skypies/adsb.Msg
的用法示例。
在下文中一共展示了Msg.HasVerticalRate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateFromMsg
// Some subtype packets have data we don't get in the bulk of position packets (those of subtype:3),
// so just cache their interesting data and inject it into next position packet.
// http://woodair.net/SBS/Article/Barebones42_Socket_Data.htm
func (s *ADSBSender) updateFromMsg(m *adsb.Msg) {
s.LastSeen = time.Now().UTC()
// If the message had any of the optional fields, cache the value for later
if m.HasCallsign() {
if len(m.Callsign) > 0 {
s.LastCallsign = m.Callsign
} else {
s.LastCallsign = "_._._._." // Our nil value :/
}
}
if m.HasSquawk() {
s.LastSquawk = m.Squawk
}
if m.HasGroundSpeed() {
s.LastGroundSpeed = m.GroundSpeed
}
if m.HasTrack() {
s.LastTrack = m.Track
}
if m.HasVerticalRate() {
s.LastVerticalSpeed = m.VerticalRate
}
if m.Type == "MSG_foooo" {
if m.SubType == 1 {
// TODO: move this to m.hasCallsign()
// MSG,1 - the callsign/ident subtype - is sometimes blank. But we
// don't really want to confuse flights that have a purposefully
// blank callsign with those for yet we've yet to receive a MSG,1.
// So we use a magic string instead.
if m.Callsign == "" {
s.LastCallsign = "_._._._."
}
if m.Callsign != "" {
s.LastCallsign = m.Callsign
}
} else if m.SubType == 2 {
if m.HasGroundSpeed() {
s.LastGroundSpeed = m.GroundSpeed
}
if m.HasTrack() {
s.LastTrack = m.Track
}
} else if m.SubType == 4 {
if m.HasGroundSpeed() {
s.LastGroundSpeed = m.GroundSpeed
}
if m.HasVerticalRate() {
s.LastVerticalSpeed = m.VerticalRate
}
if m.HasTrack() {
s.LastTrack = m.Track
}
} else if m.SubType == 6 {
if m.Squawk != "" {
s.LastSquawk = m.Squawk
}
}
}
}