diff --git a/monitoring/mock_uss/riddp/routes_observation.py b/monitoring/mock_uss/riddp/routes_observation.py index 6c6f46cc69..332631e2e4 100644 --- a/monitoring/mock_uss/riddp/routes_observation.py +++ b/monitoring/mock_uss/riddp/routes_observation.py @@ -79,6 +79,7 @@ def _make_flight_observation( h.distance = limit_resolution(h.distance, MinHeightResolution) return observation_api.Flight( id=flight.id, + aircraft_type=flight.aircraft_type, most_recent_position=observation_api.Position( lat=p.lat, lng=p.lng, diff --git a/monitoring/monitorlib/fetch/rid.py b/monitoring/monitorlib/fetch/rid.py index e03abd045c..3f8219f23f 100644 --- a/monitoring/monitorlib/fetch/rid.py +++ b/monitoring/monitorlib/fetch/rid.py @@ -358,6 +358,23 @@ def timestamp_accuracy(self) -> Optional[float]: f"Cannot retrieve speed using RID version {self.rid_version}" ) + @property + def aircraft_type( + self, + ) -> Optional[Union[v19.api.RIDAircraftType, v22a.api.UAType]]: + if self.rid_version == RIDVersion.f3411_19: + if not self.v19_value.has_field_with_value("aircraft_type"): + return None + return self.v19_value.aircraft_type + elif self.rid_version == RIDVersion.f3411_22a: + if not self.v22a_value.has_field_with_value("aircraft_type"): + return None + return self.v22a_value.aircraft_type + else: + raise NotImplementedError( + f"Cannot retrieve aircraft_type using RID version {self.rid_version}" + ) + def errors(self) -> List[str]: try: rid_version = self.rid_version