klvencoder_web_logo.png

KlvEncoder C++ library

v1.1.0

Table of contents

Overview

The KlvEncoder C++ library provides methods to encode KLV format metadata. KLV (Key-Length-Value) is a video metadata encoding format which uses a type-length-value structure (the standard SMPTE 336M-2007 defines the KLV encoding format). Metadata is encoded into Key-Length-Value blocks that contain a data ID (a standard key or a tag number), the data length, and the data itself. Bytes are encoded in big-endian format. The KlvEncoder library prepares a buffer with KLV metadata. The library is cross-platform and compatible with Windows and Linux OS. The main file KlvEncoder.h includes the declaration of the KlvEncoder class which provides methods for encoding video metadata into KLV format. The library requires C++17 standard. The library doesn’t have any third-party dependencies. The library implements the ST0601.19 standard (Unmanned Air System (UAS) Datalink Local Set (LS) for UAS platforms) (see MISBTag enumeration for supported tags). Note: The library encodes linear KLV buffer structure with Universal Key and BER length.

Versions

Table 1 - Library versions.

Version Release date What’s new
1.0.0 18.02.2026 Initial release
1.1.0 02.03.2026 - All tags of ST0601 were implemented.

KlvEncoder class description

KlvEncoder class declaration

The KlvEncoder class is declared in KlvEncoder.h file. Class declaration:

namespace cr
{
namespace metadata
{
class  KlvEncoder
{
public:

    /// Get library version.
    static std::string getVersion();

    /// Add parameter to buffer.
    bool addParam(MISBTag key, const void* value, size_t length = 0);

    /// Reset buffer.
    void resetBuffer();

    /// Get buffer with KLV metadata.
    std::vector<uint8_t> getBuffer();
};
}
}

getVersion method

The getVersion() static method returns a string of the current class version. Method declaration:

static std::string getVersion();

Returns: the library version string in format Major.Minor.Patch. The method can be used without KlvEncoder class instance. Example:

cout << "KlvEncoder class version: " << KlvEncoder::getVersion() << endl;

Console output:

KlvEncoder class version: 1.1.0

addParam method

The addParam(…) method adds a parameter value to the buffer. The method fills the buffer which can be retrieved by the getBuffer() method. Method declaration:

bool addParam(MISBTag key, const void* value, size_t length = 0);
Parameter Value
key Name of the standard and tag number.
value Pointer to parameter value, which should be encoded.
length Length of parameter value in bytes. For fixed-size parameters (for example, float or integer) length is not required (see MISBTag enumeration). For variable-size parameters (for example, string) length should be specified.

Returns: TRUE if the value is within the valid range and the standard tag is supported (see MISBTag enumeration for supported tags), otherwise FALSE.

resetBuffer method

The resetBuffer() method resets the class object buffer. It should be called each time you need to encode a new KLV package. Method declaration:

void resetBuffer();

getBuffer method

The getBuffer() method returns the buffer with encoded KLV data. Method declaration:

std::vector<uint8_t> getBuffer();

Returns: vector of encoded data in KLV format.

Data structures

MISBTag enumeration

MISBTag enum includes standard tags according to the ST0601.19 standard. It represents data that can be encoded to KLV format using the KlvEncoder library. Each tag has a specific parameter and conversion formulas to convert input values to KLV format. The MISBTag enum is declared in KlvEncoder.h file. Enum declaration:

enum class MISBTag
{
    // Precision Time Stamp. The value is microseconds
    // since Unix epoch (January 1, 1970).
    ST0601_2_PrecisionTimeStamp = 1,
    // Mission ID. Size range: 1 to 127 symbols.
    ST0601_3_MissionId,
    // Platform Tail Number. Size range: 1 to 127 symbols.
    ST0601_4_PlatformTailNumber,
    // Platform Heading Angle. Range: 0 to 360 degrees.
    ST0601_5_PlatformHeadingAngle,
    // Platform Pitch Angle. Range: -20 to +20 degrees.
    ST0601_6_PlatformPitchAngle,
    // Platform Roll Angle. Range: -50 to +50 degrees.
    ST0601_7_PlatformRollAngle,
    // True airspeed of platform. Range: 0 to 255 meters per second.
    ST0601_8_PlatformTrueAirspeed,
    // Indicated airspeed of platform. Range: 0 to 255 meters per second.
    ST0601_9_PlatformIndicatedAirspeed,
    // Model name of the platform. Size range: 1 to 127 symbols.
    ST0601_10_PlatformDesignation,
    // Name of currently active sensor. Size range: 1 to 127 symbols.
    ST0601_11_ImageSourceSensor,
    // Name of the image coordinate system used. Size range: 1 to 127 symbols.
    ST0601_12_ImageCoordinateSystem,
    // Sensor latitude. Range: -90 to 90 degrees.
    ST0601_13_SensorLatitude,
    // Sensor longitude. Range: -180 to 180 degrees.
    ST0601_14_SensorLongitude,
    // Altitude of sensor as measured from Mean Sea Level.
    // Range: -900 to 19000 meters.
    ST0601_15_SensorTrueAltitude,
    // Sensor Horizontal Field of View. Range: 0 to 180 degrees.
    ST0601_16_SensorHorizontalFieldOfView,
    // Sensor Vertical Field of View. Range: 0 to 180 degrees.
    ST0601_17_SensorVerticalFieldOfView,
    // Sensor Relative Azimuth Angle. Relative rotation angle of sensor to
    // platform longitudinal axis. Range: 0 to 360 degrees.
    ST0601_18_SensorRelativeAzimuthAngle,
    // Sensor Relative Elevation Angle. Relative elevation angle of sensor to
    // platform longitudinal-transverse plane. Range: -180 to +180 degrees.
    ST0601_19_SensorRelativeElevationAngle,
    // Sensor Relative Roll Angle. Relative roll angle of sensor to aircraft
    // platform. Range: 0 to 360 degrees.
    ST0601_20_SensorRelativeRollAngle,
    // Slant Range. Slant range in meters. Range: 0 to 5000000 meters.
    ST0601_21_SlantRange,
    // Target width within sensor field of view. Range: 0 to 10000 meters.
    ST0601_22_TargetWidth,
    // Terrain latitude of frame center. Range: -90 to 90 degrees.
    ST0601_23_FrameCenterLatitude,
    // Terrain longitude of frame center. Range: -180 to 180 degrees.
    ST0601_24_FrameCenterLongitude,
    // Terrain elevation at frame center relative to Mean Sea Level.
    // Range: -900 to 19000 meters.
    ST0601_25_FrameCenterElevation,
    // Frame latitude offset for upper left corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_26_OffsetCornerLatitudePoint1,
    // Frame longitude offset for upper left corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_27_OffsetCornerLongitudePoint1,
    // Frame latitude offset for upper right corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_28_OffsetCornerLatitudePoint2,
    // Frame longitude offset for upper right corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_29_OffsetCornerLongitudePoint2,
    // Frame latitude offset for lower right corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_30_OffsetCornerLatitudePoint3,
    // Frame longitude offset for lower right corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_31_OffsetCornerLongitudePoint3,
    // Frame latitude offset for lower left corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_32_OffsetCornerLatitudePoint4,
    // Frame longitude offset for lower left corner.
    // Range: -0.075 to 0.075 degrees.
    ST0601_33_OffsetCornerLongitudePoint4,
    // Flag for icing detected at aircraft location.
    // Parameters: value - ST0601_34_IcingDetected enumeration,
    // length - ignored (not used).
    ST0601_34_IcingDetected,
    // Wind direction at aircraft location. Range: 0 to 360 degrees.
    ST0601_35_WindDirection,
    // Wind speed at aircraft location. Range: 0 to 100 meters per second.
    ST0601_36_WindSpeed,
    // Static pressure at aircraft location. Range: 0 to 5000 millibars.
    ST0601_37_StaticPressure,
    // Density altitude at aircraft location. Range: -900 to 19000 meters.
    ST0601_38_DensityAltitude,
    // Temperature outside of aircraft. Range: -128 to +127 degrees Celsius.
    ST0601_39_OutsideAirTemperature,
    // Calculated target latitude. Range: -90 to 90 degrees.
    ST0601_40_TargetLocationLatitude,
    // Calculated target longitude. Range: -180 to 180 degrees.
    ST0601_41_TargetLocationLongitude,
    // Calculated target elevation. Range: -900 to 19000 meters.
    ST0601_42_TargetLocationElevation,
    // Tracking gate width (x value) of tracked target within field of view.
    // Range: 0 to 510 pixels.
    ST0601_43_TargetTrackGateWidth,
    // Tracking gate height (y value) of tracked target within field of view.
    // Range: 0 to 510 pixels.
    ST0601_44_TargetTrackGateHeight,
    // Circular error 90 is the estimated error distance in the horizontal
    // direction. Range: 0 to 4095 meters.
    ST0601_45_TargetErrorEstimateCE90,
    // Linear error 90 is the estimated error distance in the vertical direction.
    // Range: 0 to 4095 meters.
    ST0601_46_TargetErrorEstimateLE90,
    // The Generic Data Flags are miscellaneous boolean (yes/no) aircraft
    // and image related data settings which are individual bits in a single
    // byte value.
    // | Bit | Name          | One indicates  | Zero indicates    |
    // | --- | ------------- | -------------- | ----------------- |
    // | 0   | Laser range   | Laser on       | Laser off         |
    // | 1   | Auto-track    | Auto-track on  | Auto-track off    |
    // | 2   | IR polarity   | Black hot      | White hot         |
    // | 3   | Icing status  | Icing detected | No icing detected |
    // | 4   | Slant range   | Measured       | Calculated        |
    // | 5   | Image invalid | Image invalid  | Image valid       |
    // | 6   | Reserved      | Not used       |  Not used         |
    // | 7   | Reserved      | Not used       |  Not used         |
    // Example: 0000011 = 0x03, laser on and auto-track on
    ST0601_47_GenericFlagData,
    // MISB ST 0102 local set Security Metadata items. The value is a byte
    // buffer containing the encoded local set.
    ST0601_48_SecurityLocalSet,
    // Differential pressure at aircraft location. Range: 0 to 5000 millibars.
    ST0601_49_DifferentialPressure,
    // Platform attack angle. Range: -20 to 20 degrees.
    ST0601_50_PlatformAngleOfAttack,
    // Vertical speed of the aircraft relative to zenith.
    // Range: -180 to 180 meters per second.
    ST0601_51_PlatformVerticalSpeed,
    // Angle between the platform longitudinal axis and the relative wind.
    // Range: -20 to 20 degrees.
    ST0601_52_PlatformSideslipAngle,
    // Local pressure at airfield of known height. Range: 0 to 5000 millibars.
    ST0601_53_AirfieldBarometricPressure,
    // Elevation of airfield corresponding to Airfield Barometric Pressure.
    // Range: -900 to 19000 meters.
    ST0601_54_AirfieldElevation,
    // Relative humidity at aircraft location. Range: 0 to 100 percent.
    ST0601_55_RelativeHumidity,
    // Speed projected on the ground of an airborne platform passing overhead.
    // Range: 0 to 255 meters per second.
    ST0601_56_PlatformGroundspeed,
    // Horizontal distance from ground position of aircraft relative to nadir,
    // and target of interest. Range: 0 to 5000000 meters.
    ST0601_57_GroundRange,
    // Remaining fuel on airborne platform. Range: 0 to 10000 kilograms.
    ST0601_58_PlatformFuelRemaining,
    // Call sign of platform or operating unit. Size range: 1 to 127 symbols.
    ST0601_59_PlatformCallSign,
    // Current weapons stored on aircraft. Range: 0 to 65535.
    ST0601_60_WeaponLoad,
    // Indication when a particular weapon is released. Range: 0 to 255.
    ST0601_61_WeaponFired,
    // A laser's Pulse Repetition Frequency (PRF) code used to mark a target.
    // Range: 0 to 65535.
    ST0601_62_LaserRPFCode,
    // Sensor field of view names.
    ST0601_63_SensorFieldOfViewName,
    // Aircraft magnetic heading angle. Range: 0 to 360 degrees.
    ST0601_64_PlatformMagneticHeading,
    // Version number of the UAS Datalink LS document used to generate
    // KLV metadata. Range: 0 to 255.
    ST0601_65_UASDatalinkLSVersionNumber,
    // The tag is deprecated.
    ST0601_66_Deprecated,
    // Alternate platform latitude. Range: -90 to 90 degrees.
    ST0601_67_AlternatePlatformLatitude,
    // Alternate platform longitude. Range: -180 to 180 degrees.
    ST0601_68_AlternatePlatformLongitude,
    // Alternate platform altitude. Range: -900 to 19000 meters.
    ST0601_69_AlternatePlatformAltitude,
    // Alternate platform name. Size range: 1 to 127 symbols.
    ST0601_70_AlternatePlatformName,
    // Heading angle of alternate platform connected to UAS.
    // Range: 0 to 360 degrees.
    ST0601_71_AlternatePlatformHeading,
    // Start time of scene, event, mission, etc. The value is microseconds
    // since Unix epoch (January 1, 1970).
    ST0601_72_EventStartTime,
    // MISB ST 0806 Local Set metadata items. The value is a nested KLV Local
    // Set structure encoded as a byte buffer.
    ST0601_73_RVTLocalSet,
    // MISB ST 0903 VMTI Local Set metadata items. The value is a nested KLV
    // Local Set structure encoded as a byte buffer.
    ST0601_74_VMTILocalSet,
    // Sensor ellipsoid height as measured from WGS84 ellipsoid.
    // Range: -900 to 19000 meters.
    ST0601_75_SensorEllipsoidHeight,
    // Alternate platform ellipsoid height as measured from WGS84 ellipsoid.
    // Range: -900 to 19000 meters.
    ST0601_76_AlternatePlatformEllipsoidHeight,
    // Indicates the mode of operations of the event portrayed
    // in Motion Imagery.
    ST0601_77_OperationalMode,
    // Frame center ellipsoid height as measured from WGS84 ellipsoid.
    // Range: -900 to 19000 meters.
    ST0601_78_FrameCenterHeightAboveEllipsoid,
    // Sensor north velocity. Range: -327 to 327 meters per second.
    ST0601_79_SensorNorthVelocity,
    // Sensor east velocity. Range: -327 to 327 meters per second.
    ST0601_80_SensorEastVelocity,
    // Location of earth-sky horizon in the Imagery.
    ST0601_81_ImageHorizonPixelPack,
    // Frame latitude for upper left corner. Range: -90 to 90 degrees.
    ST0601_82_CornerLatitudePoint1Full,
    // Frame longitude for upper left corner. Range: -180 to 180 degrees.
    ST0601_83_CornerLongitudePoint1Full,
    // Frame latitude for upper right corner. Range: -90 to 90 degrees.
    ST0601_84_CornerLatitudePoint2Full,
    // Frame longitude for upper right corner. Range: -180 to 180 degrees.
    ST0601_85_CornerLongitudePoint2Full,
    // Frame latitude for lower right corner. Range: -90 to 90 degrees.
    ST0601_86_CornerLatitudePoint3Full,
    // Frame longitude for lower right corner. Range: -180 to 180 degrees.
    ST0601_87_CornerLongitudePoint3Full,
    // Frame latitude for lower left corner. Range: -90 to 90 degrees.
    ST0601_88_CornerLatitudePoint4Full,
    // Frame longitude for lower left corner. Range: -180 to 180 degrees.
    ST0601_89_CornerLongitudePoint4Full,
    // Aircraft pitch angle. Range: -90 to 90 degrees.
    ST0601_90_PlatformPitchAngleFull,
    // Aircraft roll angle. Range: -90 to 90 degrees.
    ST0601_91_PlatformRollAngleFull,
    // Platform attack angle. Range: -90 to 90 degrees.
    ST0601_92_PlatformAngleOfAttackFull,
    // Angle between the platform longitudinal axis and relative wind.
    // Range: -180 to 180 degrees.
    ST0601_93_PlatformSideslipAngleFull,
    // MISB ST 1204 MIIS Core Identifier binary value.
    // The value is a byte buffer.
    ST0601_94_MIISCoreIdentifier,
    // MISB ST 1206 SAR Motion Imagery Metadata Local Set metadata items.
    // The value is a nested KLV Local Set structure encoded as a byte buffer.
    ST0601_95_SARMotionImageryLocalSet,
    // Target width within sensor field of view.
    // Range: 0 to 1500000 meters.
    ST0601_96_TargetWidthExtended,
    // MISB ST 1002 Range Imaging Local Set metadata items. The value is
    // a nested KLV Local Set structure encoded as a byte buffer.
    ST0601_97_RangeImageLocalSet,
    // MISB ST 1601 Geo-Registration Local Set metadata items. The value is
    // a nested KLV Local Set structure encoded as a byte buffer.
    ST0601_98_GeoRegistrationLocalSet,
    // MISB ST 1602 Composite Imaging Local Set metadata items. The value is
    // a nested KLV Local Set structure encoded as a byte buffer.
    ST0601_99_CompositeImagingLocalSet,
    // MISB ST 1607 Segment Local Set metadata items, used to enable metadata
    // sharing. The value is a nested KLV Local Set structure encoded as
    // a byte buffer.
    ST0601_100_SegmentLocalSet,
    // MISB ST 1607 Amend Local Set metadata items, used to provide metadata
    // corrections. The value is a nested KLV Local Set structure encoded as
    // a byte buffer.
    ST0601_101_AmendLocalSet,
    // MISB ST 1010 Floating Length Pack metadata item, providing
    // Standard Deviation and Cross Correlation (SDCC) metadata. The value is
    // a nested KLV Local Set structure encoded as a byte buffer.
    ST0601_102_SDCCFLP,
    // Density altitude above MSL at aircraft location.
    // Range: -900 to 40000 meters.
    ST0601_103_DensityAltitudeExtended,
    // Sensor ellipsoid height extended as measured from WGS84 ellipsoid.
    // Range: -900 to 40000 meters.
    ST0601_104_SensorEllipsoidHeightExtended,
    // Alternate platform ellipsoid height extended as measured from WGS84 ellipsoid.
    // Range: -900 to 40000 meters.
    ST0601_105_AlternatePlatformEllipsoidHeightExtended,
    // A second designation given to a sortie. Size range: 1 to 127 symbols.
    ST0601_106_StreamDesignator,
    // Name of the operational base hosting the platform. Size range: 1 to 127 symbols.
    ST0601_107_OperationalBase,
    // Name of the source, where the Motion Imagery is first broadcast.
    // Size range: 1 to 127 symbols.
    ST0601_108_BroadcastSource,
    // Distance from current position to airframe recovery position.
    // Range: 0 to 21000 kilometers.
    ST0601_109_RangeToRecoveryLocation,
    // Number of seconds aircraft has been airborne.
    ST0601_110_TimeAirborne,
    // The speed the engine is rotating at.
    ST0601_111_PropulsionUnitSpeed,
    // Direction the aircraft is moving relative to True North.
    // Range: 0 to 360 degrees.
    ST0601_112_PlatformCourseAngle,
    // Above Ground Level (AGL) height above the ground or water.
    // Range: -900 to 40000 meters.
    ST0601_113_AltitudeAGL,
    // Height above the ground or water as reported by a radar altimeter.
    // Range: -900 to 40000 meters.
    ST0601_114_RadarAltimeter,
    // Record of command from GCS to aircraft.
    // Parameters: value - ST0601_115_ControlCommand structure,
    // length - ignored (not used).
    ST0601_115_ControlCommand,
    // Acknowledgement of one or more control commands were received
    // by the platform.
    // Parameters: value - uint32_t array, length - array size.
    ST0601_116_ControlCommandVerificationList,
    // The rate the sensor's azimuth angle is changing.
    // Range: -1000 to 1000 degrees per second.
    ST0601_117_SensorAzimuthRate,
    // The rate the sensor's elevation angle is changing.
    // Range: -1000 to 1000 degrees per second.
    ST0601_118_SensorElevationRate,
    // The rate the sensor's roll angle is changing.
    // Range: -1000 to 1000 degrees per second.
    ST0601_119_SensorRollRate,
    // Amount of on-board Motion Imagery storage used as
    // a percentage of the total storage. Range: 0 to 100 percent.
    ST0601_120_OnboardMiStoragePercentFull,
    // List of wavelengths in Motion Imagery.
    ST0601_121_ActiveWavelengthList,
    // Country codes associated with the platform and operation.
    ST0601_122_CountryCodes,
    // Count of navigation satellites in view of platform. Range: 0 to 255.
    ST0601_123_NumberOfNAVSATsInView,
    // Source of the navigation positioning information.
    // The value meanings are:
    // | Bit | Type   | Name                                | Country |
    // | --- | ------ | ----------------------------------- | ------- |
    // | 0   | INS    | On-board Inertial Navigation System | N/A     |
    // | 1   | NAVSAT | GPS                                 | USA     |
    // | 2   | NAVSAT | Galileo                             | EU      |
    // | 3   | NAVSAT | QZSS                                | Japan   |
    // | 4   | NAVSAT | NAVIC                               | India   |
    // | 5   | NAVSAT | GLONASS                             | Russia  |
    // | 6   | NAVSAT | BeiDou-1                            | China   |
    // | 7   | NAVSAT | BeiDou-2                            | China   |
    ST0601_124_PositioningMethodSource,
    // Enumeration of operational modes of the platform.
    ST0601_125_PlatformStatus,
    // Enumerated value for the current sensor control operational status.
    ST0601_126_SensorControlMode,
    // Value used to calculate the frame rate of the Motion Imagery
    // at the sensor.
    ST0601_127_SensorFrameRatePack,
    // List of wavelength bands provided by sensor(s).
    ST0601_128_WavelengthList,
    // Alpha-numeric identification of a target. Size range: 1 to 32 symbols.
    ST0601_129_TargetID,
    // Geographic location of the take-off site and recovery site.
    // First location is the take-off location (mandatory),
    // second location is the recovery location (optional).
    ST0601_130_AirbaseLocations,
    // Time when aircraft became airborne. The value is microseconds since
    // Unix epoch (January 1, 1970).
    ST0601_131_TakeOffTime,
    // Radio frequency used to transmit the Motion Imagery.
    // Range: 1 to 99999 MHz.
    ST0601_132_TransmissionFrequency,
    // The total capacity of on-board Motion Imagery storage.
    // Range: 0 to 4294967295 Gigabytes.
    ST0601_133_OnboardMIStoreageCapacity,
    // The zoom percentage of the sensor. Range: 0 to 100 percent.
    ST0601_134_ZoomPercentage,
    // Type of communications used with platform. Size range: 1 to 127 symbols.
    ST0601_135_CommunicationsMethod,
    // Number of leap seconds since MISP Epoch to use when converting
    // Precision Time Stamp (Tag 2) to UTC. Range: 0 to 4294967295 seconds.
    ST0601_136_LeapSeconds,
    // Post-flight time adjustment to correct
    // Precision Time Stamp (Tag 2) as needed.
    ST0601_137_CorrectionOffset,
    // List of payloads available on the platform.
    ST0601_138_PayloadList,
    // List of currently active payloads from the payload list (Tag 138).
    // The value is a byte with each bit representing an active payload
    // according to the payload list.
    // | Bit | Payload ID |
    // | --- | ---------- |
    // | 0   | 0          |
    // | 1   | 1          |
    // | 2   | 2          |
    // | 3   | 3          |
    // | 4   | 4          |
    // | 5   | Not used   |
    // | 6   | Not used   |
    // | 7   | Not used   |
    ST0601_139_ActivePayloads,
    // List of weapons stores and status.
    ST0601_140_WeaponsStores,
    // List of waypoints and their status.
    ST0601_141_WaypointList,
    // Specifies the domain of values for Relative Sensor
    // Azimuth, Elevation and Roll angles.
    ST0601_142_ViewDomain,
    // Identifier for Segment or Amend items.
    // Parameters: value - ST0601_143_MetadataSubstreamIDPack structure,
    // length - ignored (not used).
    ST0601_143_MetadataSubstreamIDPack,
};

Table 2 - Supported MISB standards and tags.

Tag Name Parameters type Description
ST0601_2_PrecisionTimeStamp value - uint64_t
length - not used
Precision Time Stamp. The value is microseconds since Unix epoch (January 1, 1970).
ST0601_3_MissionId value - char* string
length - string length
Mission ID. Size range: 1 to 127 symbols.
ST0601_4_PlatformTailNumber value - char* string
length - string length
Platform Tail Number. Size range: 1 to 127 symbols.
ST0601_5_PlatformHeadingAngle value - float
length - not used
Platform Heading Angle. Range: 0 to 360 degrees.
Conversion formula: uint16_t KlvValue = (degrees / 360) * 65535.
ST0601_6_PlatformPitchAngle value - float
length - not used
Platform Pitch Angle. Range: -20 to +20 degrees.
Conversion formula: int16_t KlvValue = (degrees / 40) * 65534.
ST0601_7_PlatformRollAngle value - float
length - not used
Platform Roll Angle. Range: -50 to +50 degrees.
Conversion formula: uint16_t KlvValue = (degrees / 100) * 65534.
ST0601_8_PlatformTrueAirspeed value - uint8
length - not used
True airspeed of platform. Range: 0 to 255 meters per second.
ST0601_9_PlatformIndicatedAirspeed value - uint8
length - not used
Indicated airspeed of platform. Range: 0 to 255 meters per second.
ST0601_10_PlatformDesignation value - char* string
length - string length
Model name of the platform. Size range: 1 to 127 symbols.
ST0601_11_ImageSourceSensor value - char* string
length - string length
Name of currently active sensor. Size range: 1 to 127 symbols.
ST0601_12_ImageCoordinateSystem value - char* string
length - string length
Name of the image coordinate system used. Size range: 1 to 127 symbols.
ST0601_13_SensorLatitude value - double
length - not used
Sensor latitude. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
ST0601_14_SensorLongitude value - double
length - not used
Sensor longitude. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
ST0601_15_SensorTrueAltitude value - float
length - not used
Altitude of sensor as measured from Mean Sea Level. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_16_SensorHorizontalFieldOfView value - float
length - not used
Sensor Horizontal Field of View. Range: 0 to 180 degrees.
Conversion formula: uint16_t KlvValue = (degrees / 180) * 65535.
ST0601_17_SensorVerticalFieldOfView value - float
length - not used
Sensor Vertical Field of View. Range: 0 to 180 degrees.
Conversion formula: uint16_t KlvValue = (degrees / 180) * 65535.
ST0601_18_SensorRelativeAzimuthAngle value - double
length - not used
Sensor Relative Azimuth Angle. Relative rotation angle of sensor to platform longitudinal axis. Range: 0 to 360 degrees.
Conversion formula: uint32_t KlvValue = (4294967295 / 360) * degrees.
ST0601_19_SensorRelativeElevationAngle value - double
length - not used
Sensor Relative Elevation Angle. Relative elevation angle of sensor to platform longitudinal-transverse plane. Range: -180 to +180 degrees.
Conversion formula: uint32_t KlvValue = ((degrees + 180) / 360) * 4294967295.
ST0601_20_SensorRelativeRollAngle value - double
length - not used
Sensor Relative Roll Angle. Relative roll angle of sensor to aircraft platform. Range: 0 to 360 degrees.
Conversion formula: uint32_t KlvValue = (degrees / 360) * 4294967295.
ST0601_21_SlantRange value - double
length - not used
Slant Range. Slant range in meters. Range: 0 to 5000000 meters.
Conversion formula: uint32_t KlvValue = (meters / 5000000) * 4294967295.
ST0601_22_TargetWidth value - float
length - not used
Target width within sensor field of view. Range: 0 to 10000 meters.
Conversion formula: uint16_t KlvValue = (meters / 10000) * 65535.
ST0601_23_FrameCenterLatitude value - double
length - not used
Terrain latitude of frame center. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_24_FrameCenterLongitude value - double
length - not used
Terrain longitude of frame center. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_25_FrameCenterElevation value - float
length - not used
Terrain elevation at frame center relative to Mean Sea Level. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_26_OffsetCornerLatitudePoint1 value - float
length - not used
Frame latitude offset for upper left corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_27_OffsetCornerLongitudePoint1 value - float
length - not used
Frame longitude offset for upper left corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_28_OffsetCornerLatitudePoint2 value - float
length - not used
Frame latitude offset for upper right corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_29_OffsetCornerLongitudePoint2 value - float
length - not used
Frame longitude offset for upper right corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_30_OffsetCornerLatitudePoint3 value - float
length - not used
Frame latitude offset for lower right corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_31_OffsetCornerLongitudePoint3 value - float
length - not used
Frame longitude offset for lower right corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_32_OffsetCornerLatitudePoint4 value - float
length - not used
Frame latitude offset for lower left corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_33_OffsetCornerLongitudePoint4 value - float
length - not used
Frame longitude offset for lower left corner. Range: -0.075 to 0.075 degrees.
Conversion formula: int16_t KlvValue = (degrees / 0.15) * 65534.
“N/A (Off-Earth)” indicator special value is 0x8000
ST0601_34_IcingDetected value - custom enumeration
length - not used
Flag for icing detected at aircraft location. Check Table 6 for the enumeration information.
ST0601_35_WindDirection value - float
length - not used
Wind direction at aircraft location. Range: 0 to 360 degrees.
Conversion formula: uint16_t KlvValue = (degrees / 360) * 65535.
ST0601_36_WindSpeed value - uint8_t
length - not used
Wind speed at aircraft location. Range: 0 to 100 meters per second.
Conversion formula: uint8_t KlvValue = (speed / 100) * 255.
ST0601_37_StaticPressure value - float
length - not used
Static pressure at aircraft location. Range: 0 to 5000 millibars.
Conversion formula: uint16_t KlvValue = (pressure / 5000) * 65535.
ST0601_38_DensityAltitude value - float
length - not used
Density altitude at aircraft location. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_39_OutsideAirTemperature value - int8_t
length - not used
Temperature outside of aircraft. Range: -128 to +127 degrees Celsius.
ST0601_40_TargetLocationLatitude value - double
length - not used
Calculated target latitude. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_41_TargetLocationLongitude value - double
length - not used
Calculated target longitude. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_42_TargetLocationElevation value - float
length - not used
Calculated target elevation. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_43_TargetTrackGateWidth value - uint16_t
length - not used
Tracking gate width (x value) of tracked target within field of view. Range: 0 to 510 pixels.
Conversion formula: uint16_t KlvValue = round(pixels / 2).
ST0601_44_TargetTrackGateHeight value - uint16_t
length - not used
Tracking gate height (y value) of tracked target within field of view. Range: 0 to 510 pixels.
Conversion formula: uint16_t KlvValue = round(pixels / 2).
ST0601_45_TargetErrorEstimateCE90 value - float
length - not used
Circular error 90 is the estimated error distance in the horizontal direction. Range: 0 to 4095 meters.
uint16_t KlvValue = (meters / 4095) * 65535.
ST0601_46_TargetErrorEstimateLE90 value - float
length - not used
Linear error 90 is the estimated error distance in the vertical direction. Range: 0 to 4095 meters.
uint16_t KlvValue = (meters / 4095) * 65535.
ST0601_47_GenericFlagData value - uint8_t
length - not used
The Generic Data Flags are miscellaneous boolean (yes/no) aircraft and image related data settings which are individual bits in a single byte value. Check Table 3 for more information.
ST0601_48_SecurityLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 0102 local set Security Metadata items. The value is a byte buffer containing the encoded local set. The local set must be encoded according to MISB ST 0102 standard.
ST0601_49_DifferentialPressure value - float
length - not used
Differential pressure at aircraft location. Range: 0 to 5000 millibars.
Conversion formula: uint16_t KlvValue = (pressure / 5000) * 65535.
ST0601_50_PlatformAngleOfAttack value - float
length - not used
Platform attack angle. Range: -20 to 20 degrees.
Conversion formula: int16_t KlvValue = (degrees / 40) * 65534.
Out of range special value is 0x8000
ST0601_51_PlatformVerticalSpeed value - float
length - not used
Vertical speed of the aircraft relative to zenith. Range: -180 to 180 meters per second.
Conversion formula: int16_t KlvValue = (speed / 360) * 65534.
Out of range special value is 0x8000
ST0601_52_PlatformSideslipAngle value - float
length - not used
Angle between the platform longitudinal axis and the relative wind. Range: -20 to 20 degrees.
Conversion formula: int16_t KlvValue = (degrees / 40) * 65534.
Out of range special value is 0x8000
ST0601_53_AirfieldBarometricPressure value - float
length - not used
Local pressure at airfield of known height. Range: 0 to 5000 millibars.
Conversion formula: uint16_t KlvValue = (pressure / 5000) * 65535.
ST0601_54_AirfieldElevation value - float
length - not used
Elevation of airfield corresponding to Airfield Barometric Pressure. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_55_RelativeHumidity value - float
length - not used
Relative humidity at aircraft location. Range: 0 to 100 percent.
Conversion formula: uint8_t KlvValue = (humidity / 100) * 255.
ST0601_56_PlatformGroundspeed value - uint8_t
length - not used
Speed projected on the ground of an airborne platform passing overhead. Range: 0 to 255 meters per second.
ST0601_57_GroundRange value - double
length - not used
Horizontal distance from ground position of aircraft relative to nadir, and target of interest. Range: 0 to 5000000 meters.
Conversion formula: uint32_t KlvValue = (meters / 5000000) * 4294967295.
ST0601_58_PlatformFuelRemaining value - float
length - not used
Remaining fuel on airborne platform. Range: 0 to 10000 kilograms.
Conversion formula: uint16_t KlvValue = (kilograms / 10000) * 65535.
ST0601_59_PlatformCallSign value - char* string
length - string length
Call sign of platform or operating unit. Size range: 1 to 127 symbols.
ST0601_60_WeaponLoad value - uint16_t
length - not used
Current weapons stored on aircraft. Range: 0 to 65535.
ST0601_61_WeaponFired value - uint8_t
length - not used
Indication when a particular weapon is released. Range: 0 to 255.
ST0601_62_LaserRPFCode value - uint16_t
length - not used
A laser’s Pulse Repetition Frequency (PRF) code used to mark a target. Range: 0 to 65535.
ST0601_63_SensorFieldOfViewName value - custom enumeration value
length - not used
Sensor field of view names. Check Table 7 for the enumeration information.
ST0601_64_PlatformMagneticHeading value - float
length - not used
Aircraft magnetic heading angle. Range: 0 to 360 degrees.
Conversion formula: uint16_t KlvValue = (degrees / 360) * 65535.
ST0601_65_UASDatalinkLSVersionNumber value - uint8_t
length - not used
Version number of the UAS Datalink LS document used to generate KLV metadata. Range: 0 to 255.
ST0601_66_Deprecated value - not used
length - not used
Deprecated tag.
ST0601_67_AlternatePlatformLatitude value - double
length - not used
Alternate platform latitude. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
Reserved special value is 0x80000000
ST0601_68_AlternatePlatformLongitude value - double
length - not used
Alternate platform longitude. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
Reserved special value is 0x80000000
ST0601_69_AlternatePlatformAltitude value - float
length - not used
Alternate platform altitude. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_70_AlternatePlatformName value - char* string
length - string length
Alternate platform name. Size range: 1 to 127 symbols.
ST0601_71_AlternatePlatformHeading value - float
length - not used
Heading angle of alternate platform connected to UAS. Range: 0 to 360 degrees.
Conversion formula: uint16_t KlvValue = (degrees / 360) * 65535.
ST0601_72_EventStartTime value - uint64_t
length - not used
Start time of scene, event, mission, etc. The value is microseconds since Unix epoch (January 1, 1970).
ST0601_73_RVTLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 0806 Local Set metadata items. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_74_VMTILocalSet value - uint8_t* buffer
length - buffer length
MISB ST 0903 VMTI Local Set metadata items. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_75_SensorEllipsoidHeight value - float
length - not used
Sensor ellipsoid height as measured from WGS84 ellipsoid. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_76_AlternatePlatform
EllipsoidHeight
value - float
length - not used
Alternate platform ellipsoid height as measured from WGS84 ellipsoid. Range: -900 to 19000 meters.
Conversion formula: uint16_t KlvValue = ((meters + 900) / 19900) * 65535.
ST0601_77_OperationalMode value - custom enumeration
length - not used
Indicates the mode of operations of the event portrayed in Motion Imagery. Check Table 8 for the enumeration information.
ST0601_78_FrameCenterHeight
AboveEllipsoid
value - float
length - not used
Frame center ellipsoid height as measured from WGS84 ellipsoid. Range: -900 to 19000 meters.
ST0601_79_SensorNorthVelocity value - float
length - not used
Sensor north velocity. Range: -327 to 327 meters per second.
Conversion formula: int16_t KlvValue = (speed / 654) * 65534.
“Out of range” special value is 0x8000.
ST0601_80_SensorEastVelocity value - float
length - not used
Sensor east velocity. Range: -327 to 327 meters per second.
Conversion formula: int16_t KlvValue = (speed / 654) * 65534.
“Out of range” special value is 0x8000.
ST0601_81_ImageHorizonPixelPack value - custom structure
length - not used
Location of earth-sky horizon in the Imagery. Check Table 9 for the data structure information.
ST0601_82_CornerLatitudePoint1Full value - double
length - not used
Frame latitude for upper left corner. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_83_CornerLongitudePoint1Full value - double
length - not used
Frame longitude for upper left corner. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_84_CornerLatitudePoint2Full value - double
length - not used
Frame latitude for upper right corner. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_85_CornerLongitudePoint2Full value - double
length - not used
Frame longitude for upper right corner. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_86_CornerLatitudePoint3Full value - double
length - not used
Frame latitude for lower right corner. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_87_CornerLongitudePoint3Full value - double
length - not used
Frame longitude for lower right corner. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_88_CornerLatitudePoint4Full value - double
length - not used
Frame latitude for lower left corner. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_89_CornerLongitudePoint4Full value - double
length - not used
Frame longitude for lower left corner. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_90_PlatformPitchAngleFull value - double
length - not used
Aircraft pitch angle. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_91_PlatformRollAngleFull value - double
length - not used
Aircraft roll angle. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_92_PlatformAngleOfAttackFull value - double
length - not used
Platform attack angle. Range: -90 to 90 degrees.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_93_PlatformSideslipAngleFull value - double
length - not used
Angle between the platform longitudinal axis and relative wind. Range: -180 to 180 degrees.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000
ST0601_94_MIISCoreIdentifier value - uint8_t* buffer
length - buffer length
MISB ST 1204 MIIS Core Identifier binary value. The value is a byte buffer.
ST0601_95_SARMotionImageryLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 1206 SAR Motion Imagery Metadata Local Set metadata items. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_96_TargetWidthExtended value - double
length - not used
Target width within sensor field of view. Range: 0 to 1500000 meters. The input meters will be converted to KLV value using MISPB algorithm.
ST0601_97_RangeImageLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 1002 Range Imaging Local Set metadata items. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_98_GeoRegistrationLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 1601 Geo-Registration Local Set metadata items. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_99_CompositeImagingLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 1602 Composite Imaging Local Set metadata items. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_100_SegmentLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 1607 Segment Local Set metadata items, used to enable metadata sharing. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_101_AmendLocalSet value - uint8_t* buffer
length - buffer length
MISB ST 1607 Amend Local Set metadata items, used to provide metadata corrections. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_102_SDCCFLP value - uint8_t* buffer
length - buffer length
MISB ST 1010 Floating Length Pack metadata item, providing Standard Deviation and Cross Correlation (SDCC) metadata. The value is a nested KLV Local Set structure encoded as a byte buffer.
ST0601_103_DensityAltitudeExtended value - double
length - not used
Density altitude above MSL at aircraft location. Range: -900 to 40000 meters.
The input meters will be converted to KLV value using MISPB algorithm.
ST0601_104_SensorEllipsoid
HeightExtended
value - double
length - not used
Sensor ellipsoid height extended as measured from WGS84 ellipsoid. Range: -900 to 40000 meters.
The input meters will be converted to KLV value using MISPB algorithm.
ST0601_105_AlternatePlatform
EllipsoidHeightExtended
value - double
length - not used
Alternate platform ellipsoid height extended as measured from WGS84 ellipsoid. Range: -900 to 40000 meters.
The input meters will be converted to KLV value using MISPB algorithm.
ST0601_106_StreamDesignator value - char* string
length - string length
A second designation given to a sortie. The value is a string with size range: 1 to 127 symbols.
ST0601_107_OperationalBase value - char* string
length - string length
Name of the operational base hosting the platform. The value is a string with size range: 1 to 127 symbols.
ST0601_108_BroadcastSource value - char* string
length - string length
Name of the source, where the Motion Imagery is first broadcast. The value is a string with size range: 1 to 127 symbols.
ST0601_109_RangeToRecoveryLocation value - float
length - not used
Distance from current position to airframe recovery position. Range: 0 to 21000 kilometers.
The input kilometers will be converted to KLV value using MISPB algorithm.
ST0601_110_TimeAirborne value - uint32_t
length - not used
Number of seconds aircraft has been airborne.
ST0601_111_PropulsionUnitSpeed value - uint32_t
length - not used
The speed the engine is rotating at. Value is in RPM.
ST0601_112_PlatformCourseAngle value - double
length - not used
Direction the aircraft is moving relative to True North. Range: 0 to 360 degrees.
The input degrees will be converted to KLV value using MISPB algorithm.
ST0601_113_AltitudeAGL value - double
length - not used
Above Ground Level (AGL) height above the ground or water. Range: -900 to 40000 meters.
The input meters will be converted to KLV value using MISPB algorithm.
ST0601_114_RadarAltimeter value - double
length - not used
Height above the ground or water as reported by a radar altimeter. Range: -900 to 40000 meters.
The input meters will be converted to KLV value using MISPB algorithm.
ST0601_115_ControlCommand value - custom structure
length - not used
Record of command from GCS to aircraft. Check Table 10 for the data structure information.
ST0601_116_ControlCommand
VerificationList
value - uint32_t array
length - array size
Acknowledgement of one or more control commands were received by the platform.
ST0601_117_SensorAzimuthRate value - float
length - not used
The rate the sensor’s azimuth angle is changing. Range: -1000 to 1000 degrees per second.
The input degrees per second will be converted to KLV value using MISPB algorithm.
ST0601_118_SensorElevationRate value - float
length - not used
The rate the sensor’s elevation angle is changing. Range: -1000 to 1000 degrees per second.
The input degrees per second will be converted to KLV value using MISPB algorithm.
ST0601_119_SensorRollRate value - float
length - not used
The rate the sensor’s roll angle is changing. Range: -1000 to 1000 degrees per second.
The input degrees per second will be converted to KLV value using MISPB algorithm.
ST0601_120_OnboardMiStoragePercentFull value - float
length - not used
Amount of on-board Motion Imagery storage used as a percentage of the total storage. Range: 0 to 100 percent.
ST0601_121_ActiveWavelengthList value - uint32_t array
length - array length
List of wavelengths in Motion Imagery.
ST0601_122_CountryCodes value - custom structure
length - not used
Country codes associated with the platform and operation. Check Table 11 for the data structure information.
ST0601_123_NumberOfNAVSATsInView value - uint8_t
length - not used
Count of navigation satellites in view of platform. Range: 0 to 255.
ST0601_124_PositioningMethodSource value - uint8_t
length - not used
Source of the navigation positioning information. The byte value is a bitmask. Check Table 4 for more information.
ST0601_125_PlatformStatus value - custom enumeration
length - not used
Enumeration of operational modes of the platform. Check Table 12 for the enumeration information.
ST0601_126_SensorControlMode value - custom enumeration
length - not used
Enumerated value for the current sensor control operational status. Check Table 13 for the enumeration information.
ST0601_127_SensorFrameRatePack value - custom structure
length - not used
Value used to calculate the frame rate of the Motion Imagery at the sensor. Check Table 14 for the data structure information.
ST0601_128_WavelengthList value - custom structures array
length - array length
List of wavelength bands provided by sensor(s). Check Table 15 for the data structure information.
ST0601_129_TargetID value - char* string
length - string length
Alpha-numeric identification of a target. Size range: 1 to 32 symbols.
ST0601_130_AirbaseLocations value - custom structures array
length - array length
Geographic location of the take-off site and recovery site. First location is the take-off location (mandatory), second location is the recovery location (optional). Check Table 16 for the data structure information.
ST0601_131_TakeOffTime value - uint64_t
length - not used
Time when aircraft became airborne. The value is microseconds since Unix epoch (January 1, 1970).
ST0601_132_TransmissionFrequency value - double
length - not used
Radio frequency used to transmit the Motion Imagery. Range: 1 to 99999 MHz. The input MHz will be converted to KLV value using MISPB algorithm.
ST0601_133_OnboardMIStoreageCapacity value - uint32_t
length - not used
The total capacity of on-board Motion Imagery storage. Range: 0 to 4294967295 Gigabytes.
ST0601_134_ZoomPercentage value - float
length - not used
The zoom percentage of the sensor. Range: 0 to 100 percent.
The input percentage will be converted to KLV value using MISPB algorithm.
ST0601_135_CommunicationsMethod value - char* string
length - string length
Type of communications used with platform. Size range: 1 to 127 symbols.
ST0601_136_LeapSeconds value - int32_t
length - not used
Number of leap seconds since MISP Epoch to use when converting Precision Time Stamp (Tag 2) to UTC. Range: 0 to 4294967295 seconds.
ST0601_137_CorrectionOffset value - int64_t
length - not used
Post-flight time adjustment to correct Precision Time Stamp (Tag 2) as needed.
ST0601_138_PayloadList value - custom structures array
length - array length
List of payloads available on the platform. Check Table 17 for the data structure information.
ST0601_139_ActivePayloads value - uint8_t
length - not used
List of currently active payloads from the payload list (Tag 138). The value is a byte with each bit representing an active payload according to the payload list. Check Table 5 for more information.
ST0601_140_WeaponsStores value - custom structures array
length - array length
List of weapons stores and status. Check Table 19 for the data structure information.
ST0601_141_WaypointList value - custom structures array
length - array length
List of waypoints and their status. Check Table 21 for the data structure information.
ST0601_142_ViewDomain value - custom structure
length - not used
Specifies the domain of values for Relative Sensor Azimuth, Elevation and Roll angles. Check Table 22 for the data structure information.
ST0601_143_MetadataSubstreamIDPack value - custom structure
length - not used
Identifier for Segment or Amend items. Check Table 23 for the data structure information.

Table 3 - Generic Flag Data bits (Tag 47).

Bit Name One indicates Zero indicates
0 Laser range Laser on Laser off
1 Auto-track Auto-track on Auto-track off
2 IR polarity Black hot White hot
3 Icing status Icing detected No icing detected
4 Slant range Measured Calculated
5 Image invalid Image invalid Image valid
6 Reserved Not used Not used
7 Reserved Not used Not used

Table 4 - Positioning Method Source bits (Tag 124).

Bit Type Name Country
0 INS On-board Inertial Navigation System N/A
1 NAVSAT GPS USA
2 NAVSAT Galileo EU
3 NAVSAT QZSS Japan
4 NAVSAT NAVIC India
5 NAVSAT GLONASS Russia
6 NAVSAT BeiDou-1 China
7 NAVSAT BeiDou-2 China

Table 5 - Active Payloads bits (Tag 139).

Bit Payload ID
0 0
1 1
2 2
3 3
4 4
5 Not used
6 Not used
7 Not used

ST0601_34_IcingDetected enumeration

Enumeration for ST0601 Tag 34 - Icing Detected.

enum class ST0601_34_IcingDetected : uint8_t
{
	DetectorOff = 0,
	NoIcingDetected,
	IcingDetected
};

Table 6.

Field Value
DetectorOff 0
NoIcingDetected 1
IcingDetected 2

ST0601_63_SensorFieldOfViewName enumeration

Sensor field of view names (Tag 63). The Sensor Field of View Name indicates the Motion Imagery sensor’s current lens type.

enum class ST0601_63_SensorFieldOfViewName : uint8_t
{
    Other = 0,
    Narrow,
    Medium,
    Wide,
    Ultrawide,
    NarrowMedium,
    TwoTimesUltranarrow,
    FourTimesUltranarrow,
    ContinuousZoom
};

Table 7.

Field Value
Other 0
Narrow 1
Medium 2
Wide 3
Ultrawide 4
NarrowMedium 5
TwoTimesUltranarrow 6
FourTimesUltranarrow 7
ContinuousZoom 8
Reserved 9-255

ST0601_77_OperationalMode enumeration

Operational Mode (Tag 77). The enumeration provides an indication of the event portrayed in the metadata.

enum class ST0601_77_OperationalMode : uint8_t
{
    Other = 0,
    Operational,
    Training,
    Exercise,
    Maintenance,
    Test
};

Table 8.

Field Value
Other 0
Operational 1
Training 2
Exercise 3
Maintenance 4
Test 5
Reserved 6-255

ST0601_81_ImageHorizonPixelPackData structure

Data structure for ST0601 Tag 81 - Image Horizon Pixel Pack.

struct ST0601_81_ImageHorizonPixelPackData
{
    // The coordinate is representing the start x position of
    // a vector crossing an image horizon. The coordinate is in
    // percentage of the image size.
    // Mandatory.
    uint8_t x0;
    // The coordinate is representing the start y position of
    // a vector crossing an image horizon. The coordinate is in
    // percentage of the image size.
    // Mandatory.
    uint8_t y0;
    // The coordinate is representing the end x position of
    // a vector crossing an image horizon. The coordinate is in
    // percentage of the image size.
    // Mandatory.
    uint8_t x1;
    // The coordinate is representing the end y position of
    // a vector crossing an image horizon. The coordinate is in
    // percentage of the image size.
    // Mandatory.
    uint8_t y1;
    // The latitude of the start point on the image border.
    // Based on WGS84 ellipsoid. The coordinate is in degrees.
    // Optional, but recommended.
    std::optional<double> startLatitude;
    // The longitude of the start point on the image border.
    // Based on WGS84 ellipsoid. The coordinate is in degrees.
    // Optional, but recommended.
    std::optional<double> startLongitude;
    // The latitude of the end point on the image border.
    // Based on WGS84 ellipsoid. The coordinate is in degrees.
    // Optional, but recommended.
    std::optional<double> endLatitude;
    // The longitude of the end point on the image border.
    // Based on WGS84 ellipsoid. The coordinate is in degrees.
    // Optional, but recommended.
    std::optional<double> endLongitude;
};

Table 9.

Field Type Description
x0 uint8_t The coordinate is representing the start x position of a vector crossing an image horizon. The coordinate is in percentage of the image size.
Mandatory.
y0 uint8_t The coordinate is representing the start y position of a vector crossing an image horizon. The coordinate is in percentage of the image size.
Mandatory.
x1 uint8_t The coordinate is representing the end x position of a vector crossing an image horizon. The coordinate is in percentage of the image size.
Mandatory.
y1 uint8_t The coordinate is representing the end y position of a vector crossing an image horizon. The coordinate is in percentage of the image size.
Mandatory.
startLatitude double The latitude of the start point on the image border. Based on WGS84 ellipsoid. The coordinate is in degrees.
Optional, but recommended.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000.
startLongitude double The longitude of the start point on the image border. Based on WGS84 ellipsoid. The coordinate is in degrees.
Optional, but recommended.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000.
endLatitude double The latitude of the end point on the image border. Based on WGS84 ellipsoid. The coordinate is in degrees.
Optional, but recommended.
Conversion formula: int32_t KlvValue = (degrees / 180) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000.
endLongitude double The longitude of the end point on the image border. Based on WGS84 ellipsoid. The coordinate is in degrees.
Optional, but recommended.
Conversion formula: int32_t KlvValue = (degrees / 360) * 4294967294.
“N/A (Off-Earth)” indicator special value is 0x80000000.

ST0601_115_ControlCommand structure

Data structure for ST0601 Tag 115 - Control Command.

struct ST0601_115_ControlCommand
{
    // This is an increasing and unique number
    // assigned to each command as it is issued.
    uint32_t commandId;
    // Command description. Size range: 1 to 127 symbols.
    // Mandatory.
    std::string commandStr;
    // Time when the command was issued.
    // Optional.
    std::optional<uint64_t> timestamp;
};

Table 10.

Field Type Description
commandId uint32_t This is an increasing and unique number assigned to each command as it is issued.
Encoded using BER-OID encoding.
Mandatory.
commandStr string Command description. Size range: 1 to 127 symbols.
Mandatory.
timestamp uint64_t Time when the command was issued.
Optional.

ST0601_122_CountryCodesData structure

Data structure for ST0601 Tag 122 - Country Codes Data.

struct ST0601_122_CountryCodesData
{
    // Coding method used for the country codes.
    // Mandatory.
    uint8_t codingMethod;
    // The country the platform is operating or flying over.
    // Mandatory.
    std::string overflightCountryCode;
    // Country where the operator is located.
    // Optional.
    std::string operatorCountryCode;
    // Country where the platform was manufactured.
    // Optional.
    std::string manufactureCountryCode;
};

Table 11.

Field Type Description
codingMethod uint8_t Coding method used for the country codes.
Mandatory.
overflightCountryCode string The country the platform is operating or flying over.
Mandatory.
operatorCountryCode string Country where the operator is located.
Optional.
manufactureCountryCode string Country where platform was manufactured.
Optional.

ST0601_125_PlatformStatus enumeration

Enumeration for ST0601 Tag 125 - Platform Status.

enum class ST0601_125_PlatformStatus : uint8_t
{
    // Platform is active but with unknown status
    Active = 0,
    // Platform is performing pre-flight tasks
    PreFlight,
    // Platform is taxiing before take-off
    PreFlightTaxiing,
    // Engine run-up before take-off
    RunUp,
    // Platform is taking off
    TakeOff,
    // Platform is flying to first target
    Ingress,
    // Human is piloting the platform
    ManualOperation,
    // Automated system is piloting platform
    AutomatedOrbits,
    // Platform is transitioning to new target
    Transitioning,
    // Platform is flying to recovery location
    Egress,
    // Platform is landing - wheels down
    Landing,
    // Platform has landed and is taxiing
    LandedTaxiing,
    // Platform is parked after mission, awaiting power down
    LandedParked
};

Table 12.

Field Value Description
Active 0 Platform is active but with unknown status
PreFlight 1 Platform is performing pre-flight tasks
PreFlightTaxiing 2 Platform is taxiing before take-off
RunUp 3 Engine run-up before take-off
TakeOff 4 Platform is taking off
Ingress 5 Platform is flying to first target
ManualOperation 6 Human is piloting the platform
AutomatedOrbits 7 Automated system is piloting platform
Transitioning 8 Platform is transitioning to new target
Egress 9 Platform is flying to recovery location
Landing 10 Platform is landing - wheels down
LandedTaxiing 11 Platform has landed and is taxiing
LandedParked 12 Platform is parked after mission, awaiting power down
Reserved 13-255 Reserved for future use

ST0601_126_SensorControlMode enumeration

Enumeration for ST0601 Tag 126 - Sensor Control Mode.

enum class ST0601_126_SensorControlMode : uint8_t
{
    // The sensor is powered off
    Off = 0,
    // The sensor is at its home or lock position
    HomePosition,
    // No person or system is controlling the sensor
    Uncontrolled,
    // A person is directing the sensor
    ManualControl,
    // The sensor is calibrating
    Calibrating,
    // An automated system is controlling the sensor, holding it in position
    AutoHoldingPosition,
    // An automated system is controlling the sensor, tracking a target
    AutoTracking
};

Table 13.

Field Value Description
Off 0 The sensor is powered off
HomePosition 1 The sensor is at its home or lock position
Uncontrolled 2 No person or system is controlling the sensor
ManualControl 3 A person is directing the sensor
Calibrating 4 The sensor is calibrating
AutoHoldingPosition 5 An automated system is controlling the sensor, holding it in position
AutoTracking 6 An automated system is controlling the sensor, tracking a target
Reserved 7-255 Reserved for future use

ST0601_127_SensorFrameRatePackData structure

Data structure for ST0601 Tag 127 - Sensor Frame Rate Pack. Values are used to calculate the frame rate. For example, 29.97 FPS can be represented as numerator=30000 and denominator=1001.

struct ST0601_127_SensorFrameRatePackData
{
    // Mandatory.
    uint32_t numerator;
    // Optional. If not provided, denominator is assumed to be 1.
    uint32_t denominator = 1;
};

Table 14.

Field Type Description
numerator uint32_t Mandatory.
denominator uint32_t Optional. If not provided, denominator is assumed to be 1.

ST0601_128_WavelengthRecord structure

Data structure for ST0601 Tag 128 - Wavelength List.

struct ST0601_128_WavelengthRecord
{
    // Wavelength ID. Encoded using BER-OID encoding.
    // Mandatory.
    uint32_t id;
    // Minimum wavelength. Encoded using IMAPB algorithm.
    // Mandatory.
    float min;
    // Maximum wavelength. Encoded using IMAPB algorithm.
    // Mandatory.
    float max;
    // Name of the wavelength.
    // Mandatory.
    std::string name;
};

Table 15.

Field Type Description
id uint32_t Wavelength ID. Encoded using BER-OID encoding.
Mandatory.
min float Minimum wavelength. Encoded using IMAPB algorithm.
Mandatory.
max float Maximum wavelength. Encoded using IMAPB algorithm.
Mandatory.
name string Name of the wavelength.
Mandatory.

ST0601_130_AirbaseLocation structure

Data structure for ST0601 Tag 130 - Airbase Locations.

struct ST0601_130_AirbaseLocation
{
    // Range: -90 to 90 degrees.
    double latitude;
    // Range: -180 to 180 degrees.
    double longitude;
    // Height Above Ellipsoid. Range: -900 to 9000 meters.
    std::optional<double> hae;
};

Table 16.

Field Type Description
latitude double Range: -90 to 90 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Mandatory.
longitude double Range: -180 to 180 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Mandatory.
hae double Height Above Ellipsoid. Range: -900 to 9000 meters.
The input meter value will be converted to KLV value using IMAPB algorithm.
Optional.

ST0601_138_PayloadRecord structure

Data structure for ST0601 Tag 138 - Payload List.

struct ST0601_138_PayloadRecord
{
    // Payload ID. Range: 0 to 255.
    uint8_t id;
    // Payload type.
    ST0601_138_PayloadType type;
    // Payload name.
    std::string name;
};

Table 17.

Field Type Description
id uint8_t Payload ID. Range: 0 to 255.
Mandatory.
type ST0601_138_PayloadType Payload type. Check Table 18 for more information.
Mandatory.
name string Payload name.
Mandatory.

ST0601_138_PayloadType enumeration

Payload types for ST0601 Tag 138 - Payload List.

enum class ST0601_138_PayloadType : uint8_t
{
    ElectroOpticalMiSensor = 0,
    Lidar,
    Radar,
    SIGINT,
    SAR
};

Table 18.

Field Value
ElectroOpticalMiSensor 0
Lidar 1
Radar 2
SIGINT 3
SAR 4

ST0601_140_WeaponsRecord structure

Data structure for ST0601 Tag 140 - Weapons Stores.

struct ST0601_140_WeaponsRecord
{
    // ID of the fuselage.
    uint8_t stationId;

    // ID of hard point for attaching weapons.
    uint8_t hardpointId;

    // ID of carriage system, which is attached to hard point.
    uint8_t carriageId;

    // ID of the store, which is a part of carriage system.
    uint8_t storeId;

    // Fuze enabled.
    bool fuzeEnabled;

    // Laser enabled.
    bool laserEnabled;

    // Target enabled.
    bool targetEnabled;

    // Weapon armed.
    bool weaponArmed;

    // Weapon General Status.
    ST0601_140_WeaponStatus weaponGeneralStatus;

    // Weapon type.
    std::string typeName;
};

Table 19.

Field Type Description
stationId uint8_t ID of the fuselage. Range: 0 to 255.
Mandatory.
hardpointId uint8_t ID of hard point for attaching weapons. Range: 0 to 255.
Mandatory.
carriageId uint8_t ID of carriage system, which is attached to hard point. Range: 0 to 255.
Mandatory.
storeId uint8_t ID of the store, which is a part of carriage system. Range: 0 to 255.
Mandatory.
fuzeEnabled bool Fuze enabled.
True - Fuze functions are set.
False - Fuze functions are not set.
Mandatory.
laserEnabled bool Laser enabled.
True - Laser functions are set.
False - Laser functions are not set.
Mandatory.
targetEnabled bool Target enabled.
True - Target functions are set.
False - Target functions are not set.
Mandatory.
weaponArmed bool Weapon armed.
True - Master Arm is set.
False - Master Arm is not set.
Mandatory.
weaponGeneralStatus ST0601_140_WeaponStatus Weapon General Status. Check Table 20 for more information.
Mandatory.
typeName string Weapon type name.
Mandatory.

ST0601_140_WeaponStatus enumeration

Enumeration for ST0601 Tag 140 - Weapon General Status.

enum class ST0601_140_WeaponStatus : uint8_t
{
    // No power operating power is available to the Store.
    Off = 0,
    // Operating Power is on and the Store is initializing.
    Initialization,
    // Store initialization completed - full capability not available.
    Degraded,
    // Store initialization completed - full capability is available.
    AllUpRound,
    // Dedicated release processes started including activation of
    // irreversible functions.
    Launch,
    // Store has successfully separated from the platform.
    FreeFlight,
    // Either commanded into or safety critical anomaly detected.
    Abort,
    // Weapon miss - fired.
    MissFire,
    // Weapon which does not separate from aircraft when activated for
    // employment or jettison.
    HangFire,
    // Intentional or emergency separation of weapon from aircraft
    // with the weapon in the unarmed state (fuze - safe).
    Jettisoned,
    // Weapon is bypassed due to failure. Weapon can still be jettisoned.
    SteppedOver,
    // Unknown status.
    NoStatusAvailable
};

Table 20.

Field Value Description
Off 0 No power operating power is available to the Store.
Initialization 1 Operating Power is on and the Store is initializing.
Degraded 2 Store initialization completed - full capability not available.
AllUpRound 3 Store initialization completed � full capability is available.
Launch 4 Dedicated release processes started including activation of irreversible functions.
FreeFlight 5 Store has successfully separated from the platform.
Abort 6 Either commanded into or safety critical anomaly detected.
MissFire 7 Weapon miss - fired.
HangFire 8 Weapon which does not separate from aircraft when activated for employment or jettison.
Jettisoned 9 Intentional or emergency separation of weapon from aircraft with the weapon in the unarmed state (fuze - safe).
SteppedOver 10 Weapon is bypassed due to failure. Weapon can still be jettisoned.
NoStatusAvailable 11 Unknown status.

ST0601_141_WaypointRecord structure

Data structure for ST0601 Tag 141 - Waypoint List. It uses ST0601_130_AirbaseLocation structure for waypoint location, because waypoint location has the same format as airbase location. Check Table 16 for more information.

struct ST0601_141_WaypointRecord
{
    // Waypoint ID.
    uint16_t id;

    // Waypoint prosecution order.
    int16_t prosecutionOrder;

    // Creation waypoint method.
    bool source;

    // Method of control to fly to the waypoint.
    bool mode;

    // Waypoint location.
    ST0601_130_AirbaseLocation location;
};

Table 21.

Field Type Description
id uint16_t Waypoint ID. Range: 0 to 65535.
Mandatory.
prosecutionOrder int16_t Waypoint prosecution order. Range: -32768 to 32766.
Positive value is planned waypoint.
Negative value is historical waypoint.
Cancelled waypoint value is 32767 (0x7FFF).
Mandatory.
source bool Creation waypoint method.
True - it is ad hoc.
False - it is pre-planned.
Mandatory.
mode bool Method of control to fly to the waypoint.
True - it is manual.
False - it is automated.
Mandatory.
location ST0601_130_AirbaseLocation Waypoint location. Check Table 16 for more information.
Mandatory.

ST0601_142_ViewDomainData structure

Data structure for ST0601 Tag 142 - View Domain.

struct ST0601_142_ViewDomainData
{
    // The start angle of azimuth bounds.
    std::optional<double> azimuthStart;

    // The range of azimuth bounds.
    std::optional<double> azimuthRange;

    // The start angle of elevation bounds.
    std::optional<double> elevationStart;

    // The range of elevation bounds.
    std::optional<double> elevationRange;

    // The start angle of roll bounds.
    std::optional<double> rollStart;

    // The range of roll bounds.
    std::optional<double> rollRange;
};

Table 22.

Field Type Description
azimuthStart double The start angle of azimuth bounds. Range: 0 to 360 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Optional.
azimuthRange double The range of azimuth bounds. Range: 0 to 360 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Optional.
elevationStart double The start angle of elevation bounds. Range: -180 to 180 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Optional.
elevationRange double The range of elevation bounds. Range: 0 to 360 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Optional.
rollStart double The start angle of roll bounds. Range: 0 to 360 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Optional.
rollRange double The range of roll bounds. Range: 0 to 360 degrees.
The input degree value will be converted to KLV value using IMAPB algorithm.
Optional.

ST0601_143_MetadataSubstreamIDPack structure

Data structure for ST0601 Tag 143 - Metadata Substream ID Pack.

struct ST0601_143_MetadataSubstreamIDPack
{
    // Local identifier.
    uint8_t localId;
    // Universal identifier. Size is 16 bytes.
    std::array<uint8_t, 16> universalId;
};

Table 23.

Field Type Description
localId uint8_t Local identifier.
Mandatory.
universalId array<uint8_t, 16> Universal identifier. Size is 16 bytes.
Mandatory.

Example

Here is the example of usage of this library. It shows how to create a new buffer with KLV metadata. It resets the buffer in the encoder, adds parameters to the encoder, gets the buffer from the encoder, displays the buffer in HEX format, and saves the buffer to the output.klv file located in the compiled example app folder. You can find the example in the example folder of this repository. It is ready for compilation. You can build the example by following the instructions; it will be built with the library.

#include <iostream>
#include <filesystem>
#include <fstream>
#include "KlvEncoder.h"

// Link namespaces.
using namespace std;
using namespace filesystem;
using namespace cr::metadata;

// Entry point.
int main(void)
{
    // Create encoder instance.
    KlvEncoder encoder;

    // Reset buffer before encoding new KLV package.
    encoder.resetBuffer();

    // Add camera horizontal Field of View, Tag 16.
    float horizontalFov = 90.0f;
    encoder.addParam(MISBTag::ST0601_16_SensorHorizontalFieldOfView, (void*)&horizontalFov);

    // Add camera vertical Field of View, Tag 17.
    float verticalFov = 45.0f;
    encoder.addParam(MISBTag::ST0601_17_SensorVerticalFieldOfView, (void*)&verticalFov);

    // Add relative Azimuth Angle, Tag 18.
    double azimuth = 45.0;
    encoder.addParam(MISBTag::ST0601_18_SensorRelativeAzimuthAngle, (void*)&azimuth);

    // Add relative Elevation Angle, Tag 19.
    double elevation = -30.0;
    encoder.addParam(MISBTag::ST0601_19_SensorRelativeElevationAngle, (void*)&elevation);

    // Get KLV buffer.
    vector<uint8_t> klvBuffer = encoder.getBuffer();

    // Show bytes in hex.
    cout << "KLV Buffer (" << klvBuffer.size() << " bytes): ";
    for (size_t i = 0; i < klvBuffer.size(); i++)
        cout << hex << (int)klvBuffer[i] << " ";
    cout << endl;

    // Save KLV buffer to file.
    path outputPath = "output.klv";
    ofstream outputFile(outputPath, ios::binary);
    for (size_t i = 0; i < klvBuffer.size(); i++)
        outputFile << klvBuffer[i];
    outputFile.close();

    return 1;
}

After building the example, you can run it.

Linux OS:

./KlvEncoderExample

Windows OS:

.\KlvEncoderExample.exe

KLV data verification

If you want to verify that the KLV data is encoded correctly, you can use the klvp open source C++ library. This library includes the example application klv2xml. You need to clone the klvp repository, configure for your OS and build the library with the example app. You need to use a KLV metadata file. You can use the output.klv file that can be saved by our example. After that, you can run klv2xml from the command line:

Linux OS:

./klv2xml ./path/to/output.klv ./data/klv.s3db

Windows OS:

.\klv2xml.exe .\path\to\output.klv .\data\klv.s3db

The klv.s3db file is located in the data folder of the klvp repository. If you verify the KLV data from our example, you will get the following output:

<KLV file="./path/to/output.klv">
        <Local_Set length="20" count="0">
                <KLVSensorHorizontalFieldofView key="16">90.001373</KLVSensorHorizontalFieldofView>
                <KLVSensorVerticalFieldofView key="17">45.000687</KLVSensorVerticalFieldofView>
                <KLVSensorRelativeAzimuthAngle key="18">45.000000</KLVSensorRelativeAzimuthAngle>
                <KLVSensorRelativeElevationAngle key="19">150.000000</KLVSensorRelativeElevationAngle>
                <ERROR msg="Invalid Checksum" pos="0"/>
        </Local_Set>
</KLV>

Build and connect to your project

Typical commands to build KlvEncoder library (on Linux OS and Windows OS):

cd KlvEncoder
mkdir build
cd build
cmake ..
make

If you want to connect the KlvEncoder library to your CMake project as source code, you can do the following. For example, if your repository has the following structure:

CMakeLists.txt
src
    CMakeList.txt
    yourLib.h
    yourLib.cpp

Create a 3rdparty folder in your repository and copy the KlvEncoder repository folder there. The new structure of your repository:

CMakeLists.txt
src
    CMakeList.txt
    yourLib.h
    yourLib.cpp
3rdparty
    KlvEncoder

Create CMakeLists.txt file in 3rdparty folder. CMakeLists.txt should contain:

cmake_minimum_required(VERSION 3.13)

################################################################################
## 3RD-PARTY
## dependencies for the project
################################################################################
project(3rdparty LANGUAGES CXX)

################################################################################
## SETTINGS
## basic 3rd-party settings before use
################################################################################
# To inherit the top-level architecture when the project is used as a submodule.
SET(PARENT ${PARENT}_YOUR_PROJECT_3RDPARTY)
# Disable self-overwriting of parameters inside included subdirectories.
SET(${PARENT}_SUBMODULE_CACHE_OVERWRITE OFF CACHE BOOL "" FORCE)

################################################################################
## INCLUDING SUBDIRECTORIES
## Adding subdirectories according to the 3rd-party configuration
################################################################################
if (${PARENT}_SUBMODULE_KLV_ENCODER)
    add_subdirectory(KlvEncoder)
endif()

File 3rdparty/CMakeLists.txt adds folder KlvEncoder to your project and excludes examples from compiling (by default examples are excluded from compiling if KlvEncoder is included as a submodule). Your repository’s new structure will be:

CMakeLists.txt
src
    CMakeList.txt
    yourLib.h
    yourLib.cpp
3rdparty
    CMakeLists.txt
    KlvEncoder

Next, you need to include the 3rdparty folder in the main CMakeLists.txt file of your repository. Add the following line at the end of your main CMakeLists.txt:

add_subdirectory(3rdparty)

Next, you have to include the KlvEncoder library in your src/CMakeLists.txt file:

target_link_libraries(${PROJECT_NAME} KlvEncoder)

Done!


Table of contents