/** * ASTM F3411-22a Remote ID message types * * Spec reference: ASTM F3411-22a "Standard Specification for Remote ID * and Tracking" (2022). Message size is 25 bytes on the wire (1-byte * header + 24-byte payload), total broadcast frame is 25 bytes. * Header nibble layout: high nibble = MessageType, low nibble = ProtocolVersion. * * We keep the domain types here in SI units and decoded form. Wire * serialization lives in f3411.ts. */ /** ASTM F3411-22a §5.4.2 — ID Type enum (UAS_ID_Type). */ export enum F3411IdType { NONE = 0, SERIAL_NUMBER = 1, // ANSI/CTA-2063-A serial REGISTRATION_ID = 2, // ICAO CAA assigned registration ID UTM_ASSIGNED_UUID = 3, SPECIFIC_SESSION_ID = 4, } /** ASTM F3411-22a §5.4.2 — UA (aircraft) Type enum. */ export enum F3411UaType { NONE = 0, AEROPLANE = 1, ROTORCRAFT_HELI_OR_MULTIROTOR = 2, GYROPLANE = 3, HYBRID_LIFT = 4, ORNITHOPTER = 5, GLIDER = 6, KITE = 7, FREE_BALLOON = 8, CAPTIVE_BALLOON = 9, AIRSHIP = 10, FREE_FALL_PARACHUTE = 11, ROCKET = 12, TETHERED_POWERED_AIRCRAFT = 13, GROUND_OBSTACLE = 14, OTHER = 15, } /** ASTM F3411-22a §5.4.3 — Operational Status enum (LocationVector Status). */ export enum F3411OpStatus { UNDECLARED = 0, GROUND = 1, AIRBORNE = 2, EMERGENCY = 3, REMOTE_ID_SYSTEM_FAILURE = 4, } /** ASTM F3411-22a §5.4.4 — Height type (AGL vs Takeoff). */ export enum F3411HeightType { ABOVE_TAKEOFF = 0, AGL = 1, } /** ASTM F3411-22a §5.4.6 — Description type (SelfID). */ export enum F3411DescriptionType { TEXT = 0, EMERGENCY = 1, EXTENDED_STATUS = 2, } /** ASTM F3411-22a §5.4.7 — Operator Location Source (SystemMessage). */ export enum F3411OperatorLocationType { TAKEOFF = 0, LIVE_GNSS = 1, FIXED = 2, } /** ASTM F3411-22a §5.4.7 — UA Classification Type (SystemMessage). */ export enum F3411ClassificationType { UNDECLARED = 0, EU = 1, } /** ASTM F3411-22a §5.4.8 — Operator ID type. */ export enum F3411OperatorIdType { OPERATOR_ID = 0, } /** ASTM F3411-22a §5.4 — Top-level message type enum (high nibble of header). */ export enum F3411MessageType { BASIC_ID = 0x0, LOCATION_VECTOR = 0x1, AUTHENTICATION = 0x2, // not implemented here SELF_ID = 0x3, SYSTEM = 0x4, OPERATOR_ID = 0x5, MESSAGE_PACK = 0xF, // container — not implemented here } /** Protocol version implemented (F3411-22a). */ export const F3411_PROTOCOL_VERSION = 2; /** * ASTM F3411-22a §5.4.2 — Basic ID message. * UAS identity: up to 20-byte UAS_ID + IDType + UAType. */ export interface BasicIdMessage { kind: 'basic_id'; idType: F3411IdType; uaType: F3411UaType; /** Up to 20 ASCII/ANSI bytes. Serial number, registration ID, or UUID. */ uasId: string; } /** * ASTM F3411-22a §5.4.3 — Location/Vector message. * Lat/lng/altitude + speed + track + timestamp. Timestamps are ms precision * in the domain type; wire format downgrades to F3411's 0.1s tenth-second * encoding when serialised. */ export interface LocationVectorMessage { kind: 'location_vector'; status: F3411OpStatus; heightType: F3411HeightType; /** Track direction in degrees true [0, 359]. */ trackDirectionDeg: number; /** Horizontal speed in m/s (ground speed). */ speedHorizontalMs: number; /** Vertical speed in m/s (positive = up). */ speedVerticalMs: number; /** WGS-84 latitude in decimal degrees. */ latitude: number; /** WGS-84 longitude in decimal degrees. */ longitude: number; /** Pressure altitude in metres above 1013.25 hPa datum. */ pressureAltitudeM: number; /** Geodetic altitude WGS-84 in metres. */ geodeticAltitudeM: number; /** Height above takeoff or AGL (see heightType) in metres. */ heightM: number; /** Horizontal accuracy enum value 0..12 (see F3411 Table 1). */ horizontalAccuracy: number; /** Vertical accuracy enum value 0..15. */ verticalAccuracy: number; /** Barometric altitude accuracy enum value 0..15. */ barometricAccuracy: number; /** Speed accuracy enum value 0..10. */ speedAccuracy: number; /** Unix epoch milliseconds. */ timestampMs: number; /** Timestamp accuracy enum value 0..15 (tenths of a second). */ timestampAccuracy: number; } /** * ASTM F3411-22a §5.4.6 — Self ID message. * Up to 23-byte human-readable description plus 1-byte description type. */ export interface SelfIdMessage { kind: 'self_id'; descriptionType: F3411DescriptionType; /** UTF-8 text — serialiser truncates to 23 bytes. */ description: string; } /** * ASTM F3411-22a §5.4.7 — System message. * Operator location plus flight-area geometry and classification. */ export interface SystemMessage { kind: 'system'; operatorLocationType: F3411OperatorLocationType; classificationType: F3411ClassificationType; /** Operator WGS-84 latitude in decimal degrees. */ operatorLatitude: number; /** Operator WGS-84 longitude in decimal degrees. */ operatorLongitude: number; /** Operator altitude (WGS-84 geodetic) in metres. */ operatorAltitudeM: number; /** Count of aircraft in the flight area (for swarms). */ areaCount: number; /** Flight area radius in metres. */ areaRadiusM: number; /** Flight area ceiling in metres (WGS-84 altitude). */ areaCeilingM: number; /** Flight area floor in metres (WGS-84 altitude). */ areaFloorM: number; /** EU class category (0..6) when classificationType === EU; else 0. */ euCategory: number; /** EU class (0..6) when classificationType === EU; else 0. */ euClass: number; /** * System message timestamp — F3411 uses Unix epoch seconds since * 00:00 UTC 2019-01-01. Domain type keeps ms; serialiser converts. */ timestampMs: number; } /** * ASTM F3411-22a §5.4.8 — Operator ID message. * Up to 20-byte operator ID string (e.g. FAA CAA Operator ID / FAA * FA-xxxx registration). */ export interface OperatorIdMessage { kind: 'operator_id'; operatorIdType: F3411OperatorIdType; /** Up to 20 ASCII bytes. */ operatorId: string; } /** Union of all supported F3411 message payloads. */ export type RemoteIdMessage = | BasicIdMessage | LocationVectorMessage | SelfIdMessage | SystemMessage | OperatorIdMessage; /** * A signed Remote ID log entry. The signature is Ed25519 over the * canonical wire-encoded message bytes (25 bytes) concatenated with * the timestamp and keyId. Verification uses the raw public key. */ export interface SignedRemoteIdLog { /** The decoded, domain-level message. */ message: RemoteIdMessage; /** Hex-encoded 25-byte canonical wire frame that was signed. */ frameHex: string; /** Hex-encoded Ed25519 signature (64 bytes → 128 hex chars). */ signature: string; /** Stable identifier for the signing key (e.g. SHA-256 of the public key). */ keyId: string; /** Unix epoch milliseconds when the log entry was signed. */ timestampMs: number; }