Added Radio.ID and refactored the Stats interface
This commit is contained in:
176
protocol/adsb/fields/bds62.go
Normal file
176
protocol/adsb/fields/bds62.go
Normal file
@@ -0,0 +1,176 @@
|
||||
package fields
|
||||
|
||||
// VerticalDataAvailableSourceIndicator is the Vertical Data Available / Source Indicator definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.3
|
||||
type VerticalDataAvailableSourceIndicator byte
|
||||
|
||||
const (
|
||||
VDANoValidDataAvailable VerticalDataAvailableSourceIndicator = iota // No data available
|
||||
VDAAutopilot // Autopilot control panel selected value, such as Mode Control Panel (MCP) or Flight Control Unit (FCU)
|
||||
VDAHoldingAltitude // Holding altitude
|
||||
VDAFMS // FMS/RNAV system
|
||||
)
|
||||
|
||||
func ParseVerticalDataAvailableSourceIndicator(data []byte) VerticalDataAvailableSourceIndicator {
|
||||
return VerticalDataAvailableSourceIndicator((data[0]&0x01)<<1 + (data[1]&0x80)>>7)
|
||||
}
|
||||
|
||||
// TargetAltitudeType is the Target Altitude Type definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.4
|
||||
type TargetAltitudeType byte
|
||||
|
||||
const (
|
||||
TATReferencedToPressureAltitude TargetAltitudeType = iota // Referenced to pressure-altitude (flight level)
|
||||
TATReferencedToBarometricAltitude // Referenced to barometric corrected altitude (mean sea level)
|
||||
)
|
||||
|
||||
// ReadTargetAltitudeType reads the TargetAltitudeType from a 56 bits data field
|
||||
func ParseTargetAltitudeType(data []byte) TargetAltitudeType {
|
||||
return TargetAltitudeType((data[1] & 0x40) >> 6)
|
||||
}
|
||||
|
||||
// TargetAltitudeCapability is the Target Altitude Capability definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.5
|
||||
type TargetAltitudeCapability byte
|
||||
|
||||
const (
|
||||
TACAltitudeOnly TargetAltitudeCapability = iota // Holding altitude only
|
||||
TACAltitudeOrAutopilot // Either holding altitude or autopilot control panel selected altitude
|
||||
TACAltitudeOrAutopilotOrFMS // Either holding altitude, autopilot control panel selected altitude, or any FMS/RNAV level-off altitude
|
||||
TACReserved3 // Reserved
|
||||
)
|
||||
|
||||
// ParseTargetAltitudeCapability reads the TargetAltitudeCapability from a 56 bits data field
|
||||
func ParseTargetAltitudeCapability(data []byte) TargetAltitudeCapability {
|
||||
return TargetAltitudeCapability((data[1] & 0x18) >> 3)
|
||||
}
|
||||
|
||||
// VerticalModeIndicator is the Vertical Mode Indicator definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.6
|
||||
type VerticalModeIndicator byte
|
||||
|
||||
const (
|
||||
VMIUnknown VerticalModeIndicator = iota // Unknown mode or information unavailable
|
||||
VMIAcquiringMode // Acquiring Mode
|
||||
VMICapturingMode // Capturing or Maintaining Mode
|
||||
VMIReserved3 // Reserved
|
||||
)
|
||||
|
||||
// ParseVerticalModeIndicator reads the VerticalModeIndicator from a 56 bits data field
|
||||
func ParseVerticalModeIndicator(data []byte) VerticalModeIndicator {
|
||||
return VerticalModeIndicator((data[1] & 0x06) >> 1)
|
||||
}
|
||||
|
||||
// HorizontalDataAvailableSourceIndicator is the Horizontal Data Available / Source Indicator definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.8
|
||||
type HorizontalDataAvailableSourceIndicator byte
|
||||
|
||||
const (
|
||||
HDANoValidDataAvailable HorizontalDataAvailableSourceIndicator = iota // No data available
|
||||
HDAAutopilot // Autopilot control panel selected value, such as Mode Control Panel (MCP) or Flight Control Unit (FCU)
|
||||
HDAHoldingAltitude // Maintaining current heading or track angle (e.g. autopilot mode select)
|
||||
HDAFMS // FMS/RNAV system (indicates track angle specified by leg type)
|
||||
)
|
||||
|
||||
// ParseHorizontalDataAvailableSourceIndicator reads the HorizontalDataAvailableSourceIndicator from a 56 bits data field
|
||||
func ParseHorizontalDataAvailableSourceIndicator(data []byte) HorizontalDataAvailableSourceIndicator {
|
||||
return HorizontalDataAvailableSourceIndicator((data[3] & 0x60) >> 5)
|
||||
}
|
||||
|
||||
// TargetHeadingTrackIndicator is the Target Heading / Track Angle Indicator definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.10
|
||||
type TargetHeadingTrackIndicator byte
|
||||
|
||||
const (
|
||||
TargetTrackHeadingAngle TargetHeadingTrackIndicator = iota // Target heading angle is being reported
|
||||
TargetTrackAngle // Track angle is being reported
|
||||
|
||||
)
|
||||
|
||||
// ParseTargetHeadingTrackIndicator reads the TargetHeadingTrackIndicator from a 56 bits data field
|
||||
func ParseTargetHeadingTrackIndicator(data []byte) TargetHeadingTrackIndicator {
|
||||
return TargetHeadingTrackIndicator((data[4] & 0x08) >> 3)
|
||||
}
|
||||
|
||||
// ReadTargetHeadingTrackAngle reads the TargetAltitude from a 56 bits data field
|
||||
// Specified in Doc 9871 / B.2.3.9.9
|
||||
func ReadTargetHeadingTrackAngle(data []byte) (uint16, NumericValueStatus) {
|
||||
heading := (uint16(data[3]&0x1F)<<8 | uint16(data[2]&0xF0)) >> 4
|
||||
if heading > 359 {
|
||||
return 0, NVSMaximum
|
||||
}
|
||||
return heading, NVSRegular
|
||||
}
|
||||
|
||||
// HorizontalModeIndicator is the Horizontal Mode Indicator definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.11
|
||||
type HorizontalModeIndicator byte
|
||||
|
||||
const (
|
||||
HMIUnknown HorizontalModeIndicator = iota // Unknown mode or information unavailable
|
||||
HMIAcquiringMode // Acquiring Mode
|
||||
HMICapturingMode // Capturing or Maintaining Mode
|
||||
HMIReserved3 // Reserved
|
||||
)
|
||||
|
||||
// ParseHorizontalModeIndicator reads the HorizontalModeIndicator from a 56 bits data field
|
||||
func ParseHorizontalModeIndicator(data []byte) HorizontalModeIndicator {
|
||||
return HorizontalModeIndicator((data[4] & 0x06) >> 1)
|
||||
}
|
||||
|
||||
// NavigationalAccuracyCategoryPositionV1 is the Navigational Accuracy Category Position definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.12
|
||||
type NavigationalAccuracyCategoryPositionV1 byte
|
||||
|
||||
const (
|
||||
NACPV1EPUGreaterThan18Point52Km NavigationalAccuracyCategoryPositionV1 = iota // EPU >= 18.52 km (10 NM) - Unknown accuracy
|
||||
NACPV1EPULowerThan18Point52Km // EPU < 18.52 km (10 NM) - RNP-10 accuracy
|
||||
NACPV1EPULowerThan7Point408Km // EPU < 7.408 km (4 NM) - RNP-4 accuracy
|
||||
NACPV1EPULowerThan3Point704Km // EPU < 3.704 km (2 NM) - RNP-2 accuracy
|
||||
NACPV1EPUGreaterThan1852M // EPU < 1 852 m (1 NM) - RNP-1 accuracy
|
||||
NACPV1EPULowerThan926M // EPU < 926 m (0.5 NM) - RNP-0.5 accuracy
|
||||
NACPV1EPUGreaterThan555Point6M // EPU < 555.6 m ( 0.3 NM) - RNP-0.3 accuracy
|
||||
NACPV1EPULowerThan185Point2M // EPU < 185.2 m (0.1 NM) - RNP-0.1 accuracy
|
||||
NACPV1EPUGreaterThan92Point6M // EPU < 92.6 m (0.05 NM) - e.g. GPS (with SA)
|
||||
NACPV1EPULowerThan30MAndVEPULowerThan45M // EPU < 30 m and VEPU < 45 m - e.g. GPS (SA off)
|
||||
NACPV1EPULowerThan10MAndVEPULowerThan15M // EPU < 10 m and VEPU < 15 m - e.g. WAAS
|
||||
NACPV1EPULowerThan4MAndVEPULowerThan3M // EPU < 3 m and VEPU < 4 m - e.g. LAAS
|
||||
NACPV1Reserved12 // Reserved
|
||||
NACPV1Reserved13 // Reserved
|
||||
NACPV1Reserved14 // Reserved
|
||||
NACPV1Reserved15 // Reserved
|
||||
)
|
||||
|
||||
// ParseNavigationalAccuracyCategoryPositionV1 reads the NavigationalAccuracyCategoryPositionV1 from a 56 bits data field
|
||||
func ParseNavigationalAccuracyCategoryPositionV1(data []byte) NavigationalAccuracyCategoryPositionV1 {
|
||||
return NavigationalAccuracyCategoryPositionV1((data[4]&0x01)<<3 + (data[5]&0xE0)>>5)
|
||||
}
|
||||
|
||||
// NICBaro is the NIC Baro definition
|
||||
//
|
||||
// Specified in Doc 9871 / B.2.3.9.13
|
||||
type NICBaro byte
|
||||
|
||||
const (
|
||||
// NICBGilhamNotCrossChecked indicates that the barometric altitude that is being reported in the Airborne
|
||||
// Position Message is based on a Gilham coded input that has not been cross-checked against another source of
|
||||
// pressure-altitude
|
||||
NICBGilhamNotCrossChecked NICBaro = iota
|
||||
// NICBGilhamCrossCheckedOrNonGilham indicates that the barometric altitude that is being reported in the Airborne
|
||||
// Position Message is either based on a Gilham code input that has been cross-checked against another source of
|
||||
// pressure-altitude and verified as being consistent, or is based on a non-Gilham coded source
|
||||
NICBGilhamCrossCheckedOrNonGilham
|
||||
)
|
||||
|
||||
// ParseNICBaro reads the NICBaro from a 56 bits data field
|
||||
func ParseNICBaro(data []byte) NICBaro {
|
||||
return NICBaro((data[5] & 0x10) >> 4)
|
||||
}
|
||||
Reference in New Issue
Block a user